Would it be possible to load an x86 system into cache w/o main memory?

MadRat

Lifer
Oct 14, 1999
11,971
287
126
With L2 caches growing to upwards of over 1MB, would it be possible to run DOS in the cache alone? I mean, basically using a main memory free system.
 

Peter

Elite Member
Oct 15, 1999
9,640
1
0
hmmm ... within the given architecture, that's a clean No. This is because when peripherals do a bus master transfer targetting system RAM storage, the chipset will do a cache snoop cycle toward the CPU, but then retire the data to the system RAM.

You can't reverse that because the chipset cannot make the CPU take new data into its caches, it can only make the CPU retire or invalidate cache contents to keep data coherency with main RAM.

So, you're going to need system RAM. But if you just run DOS on a 1-MB-cache machine, it'll mostly run out of the caches all by itself - with the delta between "mostly" and "always" being caused by above ongoings.
 

buleyb

Golden Member
Aug 12, 2002
1,301
0
0
The better question is why would you want to run an interactive environment from fast cache? The user is the bottleneck, and DOS is small enough to be efficient from main memory anyway, for reasons that Peter already clarified....

If anything, you would want your application to be loaded into cache, where it can be run efficiently...
 

Lynx516

Senior member
Apr 20, 2003
272
0
0
Impossible Cache by its nature is transparent. And just is not designed to work like that
 

Matthias99

Diamond Member
Oct 7, 2003
8,808
0
0
You're being a little rough on this guy. I think a better way to phrase this question might be "Is it possible to build a computer that runs some sort of reasonable OS using only on-die (cache) memory?" There's no reason a CPU couldn't treat its on-die cache as system RAM if it was built right (assuming it was fully associative, or else you'd need to jump through some hoops there).

I don't know that anyone's tried (I think you need more than 1-2MB of memory for useful OSes and apps nowadays), but I don't see why you couldn't run DOS or some very lightweight custom UNIX on such a machine if one existed. I don't know what you'd use it for (unless you had a specific application in mind that used very little RAM but lots of processor time), but it could be interesting. Besides, we're moving towards the whole "computer on a chip" thing anyway. :)
 

Peter

Elite Member
Oct 15, 1999
9,640
1
0
The point is that the architecture doesn't treat the cache as the main storage. Else the coherence measures would leave the cache alone and invalidate data elsewhere - but it's the other way around.

Now how much sense does it make to design a new processor, new chipset and new operating system just to eliminate the tiny percentage of cache misses that remains when you run CPU-centric DOS stuff on an existing x86 machine with really large caches?
 

Matthias99

Diamond Member
Oct 7, 2003
8,808
0
0
I do realize that doing this sort of makes the cache stop being a "cache" so much as just "memory", which I guess is why the original question doesn't make a whole lot of sense.

You shouldn't need a new operating system if the architecture is designed properly. You would need a new processor and chipset, but the advantage would be that you could completely eliminate the memory controller, and all of your (admittedly limited) memory would be running at full CPU speed. It could be a very interesting sort of high-speed embedded microcontroller, or a processor in a parallel architecture.
 

Cashmoney995

Senior member
Jul 12, 2002
695
0
0
The processor would be high speed, but you would have to load the software that you run on it from somewhere and that connection would be the bottle neck I think. You would need some type of Direct Processor Access to the hard drive in order for it to work. That 8 core Power PC chip by IBm with 144 megabytes of cache seems like it could do that and a little more.
 

although computers aren't built for it now, you can probably make a computer that uses only sram
however cache is a term reserved for the sram on the chip that is designated for only certain processes not anything you feed it
 

sao123

Lifer
May 27, 2002
12,653
205
106
Let me add that cache is not addressable per se. The cache cannot store data, only instructions and op codes.
Therefore your program could not run solely on cache.
 

MadRat

Lifer
Oct 14, 1999
11,971
287
126
So in order to use an on-chip SRAM cache as memory then memory addressing would need to be based on NUMA architecture and the not really be cache at all.
 

Peter

Elite Member
Oct 15, 1999
9,640
1
0
sao is of course wrong here. Caches do store data as well. In L1 cache, data and instruction caches are typically separate, while lower cache levels typically are unified.

MadRat, not quite - in order to use on-chip caches as the main system storage, both the CPU and system chipset end would have to be designed to use THAT memory as the system's main storage. With the given silicon, the caches never do more than hold copies of frequently used bits from the main RAM array.
The difference lies in the coherency activity - a normal system makes sure the cache holds no stale copies of memory locations. For the cache to become the main storage, it'd have to be the other way round.
 

sao123

Lifer
May 27, 2002
12,653
205
106
Perhaps peter would then like to address how he could create a stack or heap in the cache, and the declar a variable which would reside in there. Then he would really like to demonstrate a pointer and its address pointing to a block of cache, rather than main memory.

I'm did not mean to imply that data cells that are (accessed many times) could not be cached, because any block of memory can be. I said you cannot store data directly in the cache, nor can you access it like you can main memory.
 

MadRat

Lifer
Oct 14, 1999
11,971
287
126
Someone's comment somewhere else gave me another idea. Could video memory be used as a substitute for main memory?

OT-

I'm just looking at all the different memory and caches used in a system and wondering if somehow they could become more generalized AND shared to benefit the whole system. Its a shame to see so many cheap 64MB+ video cards out there for people running typically only low power office aps, when perhaps 4-8MB of memory is more than enough for most 2D uses. NUMA architecture utilizing multiple types of memory solutions may be miore expensive but I think the approach has merit in the not so distant future. It would be quite exciting to set aside 64-128MB on these newest superpowered 256-bit video cards for use as the primary memory. On the flipside, motherboards could integrate 256-bit pathways to shared onboard memory (i.e. use 64MB for video and 192MB for main memory) while leaving a slower 64-bit pathway to interleaved memory expansion slots. The need for pushing high quality dual-channel memory across the mainstream would be nullified. Use of HDT links between the two different memory types pretty well simplifies the engineering. The OS would then just need to be able to juggle what goes to each type of memory in order to make it optimally work. I imagine the main memory in this kind of setup would need static addressing (else how else could the OS know where to store higher priority data?) while dynamically assigned addressing (for lower priority use) could be used by the expansion slots, correct?
 

sao123

Lifer
May 27, 2002
12,653
205
106
My earlier comment lead me to more thinking....

Would it ever really be feasible or useful to cache the stack or the heap of a running program?
(IE the stack and heap, is where all static variables and dynamically allocated memory are held.)

Somehow i think this would be disadvantageous.
 

Peter

Elite Member
Oct 15, 1999
9,640
1
0
MadRat: Sure, easy job. Write yer BIOS to map the graphics card's linear frame buffer from address 0 upward, do not enable the board's own RAM controller at all, and there you are.

You'll be surprised about how much slower the path through the chipset onto the AGP bus onto the graphics chip's RAM controller is than the short path straight to the chipset's own RAM controller.

And of course, by doing that, the graphics card would become unusable as a graphics device.

Or design the stuff to specifically do this, and put the unified RAM directly on the chipset. What'd you get then? Right, a shared-memory graphics solution. As seen on low cost chipsets since 1997 - only combined with really fast RAM. Kind of like the very latest SiS chipsets do.
 

Peter

Elite Member
Oct 15, 1999
9,640
1
0
sao123, you're homing in now. That's exactly my main point. You'd have to design the hardware to treat the cache as the main storage, because the way things are now, things aren't actually stored in cache - just mirrored.
 

you actually can use your video card as an entire computer by itself, but it'll take some mad programming to make it any good. There was a thread on that earlier.
I have a quick question, I'm pretty sure the answer is no, but, can you pry the memory off a cheap ddr DIMM and replace it with the modules from a broken high end graphics card? Granted, even if it did work, you wouldn't get all the possible bandwidth because IIRC video memory can read and write at the same time unlike conventional memory, but never the less I would think that you'd get some boost.

lol sao i love that smoke thing
 

Peter

Elite Member
Oct 15, 1999
9,640
1
0
DDR RAM on video cards is just the same stuff as on DIMMs - only faster.

So yes, if you have pinout compatible chip packages there, you can do that. It'll be of no use though, since with the DIMM architecture, the electrical disadvantages of having slots and connectors are what's limiting the clock speed, not the chips themselves.