5 ms·
When I was younger, I was very pleased when I stumbled across the trick of putting all of a DOS system on a RAM-disk, which made the system fly. Then I got to c
by yjftsjthsd-h 7y ago
When I was younger, I was very pleased when I stumbled across the trick of putting all of a DOS system on a RAM-disk, which made the system fly. Then I got to college and discovered in my CS classes that CPUs now had multi-megabyte on-CPU cache, which immediately led me to wonder how hard it would be to make a DOS system that ran completely out of cache. I'm not convinced that it would be practical for any number of reasons, but it still blows me away every time I look at what modern CPUs have in-package:)
- keanebean86 7y agoRun windows 95 in L3 cache and use this to store the install: https://github.com/prsyahmi/GpuRamDrive https://github.com/prsyahmi/GpuRamDrive
- jschwartzi 7y agoThis is effectively what you do with some of the smaller MCUs -- you're running out of a megabyte or two of on-die static RAM. This is more to eliminate latency in RTOSes than it is to improve throughput but it's the same idea.
- gpderetta 7y agoMore than eliminating latency I guess is done to eliminate latency variance, which is inherent in the relatively unpredictable behaviour of caches, and is required to characterize worst case scheduling of realtime systems.
- yetihehe 7y agoMegabyte of RAM? That's a very big MCU for most of embedded programmers. 20KB is plenty for most, and some even go to zero RAM (ATtiny11).
- vardump 7y agoWorking with embedded systems. Different MCUs' memory ranges from bytes to gigabytes. What's plenty for one project isn't for another.
- jschwartzi 7y agoYeah I've worked on projects with Toshiba MCUs with 10's of kB of RAM, and the last truly embedded project I was on used a safety-critical MCU from TI with about a megabyte of internal ECC RAM.
- abbeyj 7y agoCoreboot does something similar to this. Very early in the boot process the RAM has not yet been initialized and so cannot be used. You need to execute some code to set up the RAM before you can use it. One approach to handling this is to write that initialization code in assembly language and make sure it only uses registers and doesn't touch any memory. But that's inconvenient. You'd much rather be able to write your code in something like C. Any C code compiled by an ordinary compiler is going to access memory (at least for the stack). Writing and maintaining a custom C compiler for this is a lot of work and still comes with a lot of limitations on the C code that it will accept. So they set up the cache in a way that it will never try to write its contents out to RAM. Then you can use the output of an ordinary C compiler that uses memory accesses and those accesses will all be served by the cache and never touch RAM. They call this "Cache as RAM". With some work you could probably boot into DOS like this. https://www.coreboot.org/data/yhlu/cache_as_ram_lb_09142006.pdf https://www.coreboot.org/data/yhlu/cache_as_ram_lb_09142006....
- als0 7y agoNot just coreboot, pretty much any BIOS uses cache-as-RAM.
- ahmedalsudani 7y agoWow that is so cool. Most of us never have to dig that deep and so weird stuff like that usually flies completely under the radar... Thank you for sharing!
- mcot2 7y agoInteresting that no one to my knowledge has built an architecture where sram is ‘memory’ such that it would be transparent to C code but no slower dram is used. 32MB is more than my 1998 computer had.
- jnwatson 7y agoMany embedded systems have a block of SRAM directly addressable.
- 7y ago
- baybal2 7y ago> I'm not convinced that it would be practical for any number of reasons, but it still blows me away every time I look at what modern CPUs have in-package:) The optimism is premature. A CPU may flush cache even when it pages exactly the same page. Modern CPUs have too much of completely unfathomable prefetch, and cache coherence logic
- londons_explore 7y agoBut they're also configurable via various config registers, and can be set to not touch RAM, as most early-boot firmware uses.
- baybal2 7y agoNo, all tricks to control cache behaviour are not 100% reliable on modern CPUs, or at least intel ones
- sdenton4 7y agoHa. I still use ram disk for local training of machine learning models. You can get a SOLID throughput boost by just loading up the dataset in RAM... My work desktop has something like 192Gb, so can handle a pretty sizeable dataset this way.
- thesmileyone 7y agoIsn't this what 5-eyes have been doing with MiniX3? etc