TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Redis on the Raspberry Pi: Adventures in unaligned lands

201 pointsby bjerunalmost 8 years ago

13 comments

drejalmost 8 years ago
I never deal with such low level issues, so I don&#x27;t have to read this, but... reading these posts by antirez is such a joy. He makes this topic so clear and understandable, he doesn&#x27;t assume much, he doesn&#x27;t use overly complex explanations, he just &quot;says it like it is&quot; :-)<p>Thanks!
评论 #14769952 未加载
drewg123almost 8 years ago
I fondly remember unaligned access faults &quot;back in the day&quot; with FreeBSD&#x2F;alpha. We implemented a fixup for applications, but not for the kernel. I seem to recall that even though x86 could deal with unaligned accesses, it caused minor performance problems, so fixing alignment issues on alpha would benefit x86 as well.<p>Most (definitely not all) of the mis-alignment problems were in the network stack, and were centered around the fact that ethernet headers are 14 bytes, while nearly all other protocols had headers that were a multiple of at least 4 bytes.<p>I&#x27;ve said it before, and I&#x27;ll say it again: If I had a time machine, I would not kill Hitler. I&#x27;d go back to the 70s and make the ethernet header be 16 bytes long, rather than 14.
评论 #14769356 未加载
blattimwindalmost 8 years ago
There is a funny mode on ARM processors (turned on in some images, by default) which causes unaligned reads to silently return bogus data (just increasing a kernel counter).<p>PowerPC, and really, most non-x86 architectures, do this one way or another.
评论 #14769797 未加载
throwaway000002almost 8 years ago
I&#x27;m probably the only weirdo that thinks this, but if you support byte-addressing you&#x27;d better as well be happy with byte-alignment. Atomics being the only place where it&#x27;s reasonable to be different.<p>Which brings me to padding. I wonder what percentage of memory of the average 64-bit user&#x27;s system is padding? I&#x27;m afraid of the answer. The heroes of yesteryear could&#x27;ve coded miracles in the ignored spaces in our data.
评论 #14770495 未加载
评论 #14771010 未加载
MrBuddyCasinoalmost 8 years ago
Accessing memory locations ending in 0x7? Gather round the campfire folks, James Mickens has a story to tell: <a href="https:&#x2F;&#x2F;www.usenix.org&#x2F;system&#x2F;files&#x2F;1311_05-08_mickens.pdf" rel="nofollow">https:&#x2F;&#x2F;www.usenix.org&#x2F;system&#x2F;files&#x2F;1311_05-08_mickens.pdf</a>
luhnalmost 8 years ago
&gt; Redis is adding a “Stream” data type that is specifically suited for streams of data and time series storage, at this point the specification is near complete and work to implement it will start in the next weeks.<p>This sounds like it could be really exciting. Is there anywhere I can find out more?<p>Specifically, I&#x27;ve been struggling to find an appropriate backend for HTTP Server-Sent Events, could this feature help with that?
评论 #14770837 未加载
评论 #14772577 未加载
评论 #14781584 未加载
msarnoffalmost 8 years ago
Recently I&#x27;ve been doing a lot of low-level work with ARMv7-M microcontrollers (specifically, NXP&#x27;s Kinetis Cortex-M4 chips) and was quite pleased to find out that they are pretty lenient about unaligned accesses. To quote from the ARM Cortex-M4 Processor Technical Reference Manual:<p>&quot;Unaligned word or halfword loads or stores add penalty cycles. A byte aligned halfword load or store adds one extra cycle to perform the operation as two bytes. A halfword aligned word load or store adds one extra cycle to perform the operation as two halfwords. A byte-aligned word load or store adds two extra cycles to perform the operation as a byte, a halfword, and a byte. These numbers increase if the memory stalls.&quot;<p>However, multi-word memory instructions (LDRD, STRD, LDM, STM, etc.) always require their arguments to be word-aligned.
type0almost 8 years ago
Great article, this project just begs the name of <i>Redisberry Pi</i>
JefeChuloalmost 8 years ago
In future project I might be interested in the use of Redis for queuing jobs, this comes very handy to now early the main issues I could get when developing.
ameliusalmost 8 years ago
Could Rust&#x27;s typesystem catch unaligned pointer dereferences?
评论 #14771724 未加载
评论 #14769409 未加载
dis-sysalmost 8 years ago
wondering what kind of performance overhead it is going to cause by letting the kernel to handle unaligned access vs. fixing the software to actually always use aligned access?
crncostaalmost 8 years ago
Nice article!
k__almost 8 years ago
OT: Is blattimwind shadow banned?
评论 #14769099 未加载
评论 #14769127 未加载