Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there an OS which can be used without RAM, specifically the kind I can create a bootable pendrive from and use it in the computer? This gets awkward, since booting is essentially loading OS in RAM.

Note: I originally wanted to know about a RAM-less OS to check if my laptop (which does not boot but presents a blank screen) RAM had gone bad, but I like the way this question has snowballed.

share|improve this question
20  
I'm not sure if a CPU can even function at all without RAM, that may be a good question for Computer Science.SE. What I do know for sure is that you won't get anywhere if you don't even manage to get past the BIOS. –  André Daniel Aug 31 at 8:18
10  
@AndréDaniel a CPU has cache which, from a CS perspective, is also random access memory. So in theory you don't need additional RAM modules. But in practice I doubt that the x86 architecture allows this. –  Philipp Aug 31 at 18:41
29  
All these arguments about using the processor cache are of dubious validity, since, at least on x86, the cache is not a memory you can access directly. Your code always refers to RAM, but the processor automatically manages its caches so that it doesn't actually have to fetch the data in RAM for most frequently accessed data. But again, there's no assembly instruction to say "store this in cache" "write this in cache", there are registers and there is main memory (with all its weird accessing modes), period. –  Matteo Italia Aug 31 at 21:43
3  
(OTOH, in theory you could exploit other RAM (e.g. video RAM) or peripherals mapped in the physical address space) –  Matteo Italia Aug 31 at 21:50
11  
Modern x86 CPUs let you put the on-die cache in "Cache as RAM" mode - I think some MSR's need to be set to do that. This may apply for some ARM CPUs as well. Cache on modern CPUs is in greater quantity than what your first PCs could have as maximum memory. On a PC, the firmware still won't boot without RAM present, though. You'd need a custom firmware or something not a PC platform. –  ultrasawblade Sep 1 at 0:08

11 Answers 11

up vote 80 down vote accepted

Does every OS need RAM?
For IBM PC compatible hardware, a mandatory step of the BIOS POST process is to check if there is RAM to load the BIOS into. Optionally the POST process checks of your RAM functions correctly. After the POST process, the BIOS loads the bootloader to the RAM and gives control to the bootloader. So the answer to your question ("Does every OS need RAM?") is: yes, every IBM PC compatible hardware requires at least some functioning RAM to boot. This is true for any OS that runs on that hardware.

Note that in the OP's original question, there was a reference to a "laptop", which I interpreted as: IBM PC compatible hardware. For the remainder of this answer, I'll assume IBM PC compatible hardware.

Can an OS boot with faulty RAM?
If your RAM is faulty (and not entirely absent/broken) or if you can (partially) replace your RAM, you might be able to boot using the BadRAM of BadMEM kernel patches. It requires you to recompile the kernel (sounds easier than it is if you do it for the first time) and you can reboot and tell the kernel where your bad memory is. A nice explanation of the use of Memtest86/Memtest86+, BadRAM/BadMEM can be found here.

Can an OS boot without RAM and using the CPU's cache as RAM?
As far as I know there is no way to use your CPU's cache as RAM without any RAM present on your system (as is suggested by @philipp and other) in the comments. If there is, it would be nice to add it here. The only paper I could find on this subject is this paper that states: "Using processor’s cache as RAM until the RAM is initialized". Not sure if (and how) it will work without RAM. As far as I know there is no working code that boots an OS on a IBM compatible PC. Any references to proof-of-concepts, working code or anything is welcome in the comments and I'll add it to this answer.

Can I get to the BIOS?
The OP's question is a bit vague if the laptop is able to pass the BIOS POST. As @Tonny points out, no OS will help you to "get to the BIOS". You enter the BIOS using the F1 or F2 or F10 or DEL or ESC key, depending on your brand of BIOS.

How to recover data from the laptop without RAM?
As for the goal behind your question: why do you need access to your laptop? Probably because there is still data on the HDD that you want to recover? If that's the case, it is far more easy to pull out the HDD (see manual) and attach it to an external storage device or directly to a PC. Here is a nice guide to do just that.

share|improve this answer
3  
In practice it is possible to run a machine with somewhat defective RAM (say, there's just one bank which does not work correctly). If the BIOS doesn't notice (or, if it does notice, there may be the usual F1 override) you can still run an OS like Linux with the BadMEM/BadRAM patch, that instructs the kernel to avoid the specified memory blocks. –  Matteo Italia Aug 31 at 21:46
5  
@VusP: to just check your RAM use a livecd/-usb with Memtest86/Memtest86+, skip the RAM testing in your BIOS and run the memtest from the livecd/-usb. –  agtoever Sep 1 at 9:16
3  
Who says testing RAM on boot is "mandatory"? It was common when machines had a few MB or less, but soon became optional as sizes grew and the time became prohibitive. –  Andrew Medico Sep 1 at 16:32
3  
@agtoever: Huh? The cache-as-RAM trick doesn't suddenly stop working when RAM is initialized. It's just that at that point it's foolish to avoid the RAM, so no one ever tries to. But the trick has nothing to do with RAM being uninitialized; that's just when it's actually useful. –  Mehrdad Sep 3 at 8:04
2  
@Hi-Angel, it can't execute directly from disk since the cpu can not directly access the contents of the disk. It has to poke commands into the disk controller and wait for it to transfer blocks of data from disk to somewhere in ram. Only from there can the cpu directly execute instructions. –  psusi Oct 29 at 18:39

Most of early computers of the 1980's or about had kind of operating system (hardware drivers, IO support, program loading, very simple command line interface, etc) in the ROM chip. It could somewhat function even while RAM chips were inoperable. This feature was used in special ROM content versions designed for running hardware tests and communicate mostly through the beeper and keyboard lights.

CPU has several registers to remember the address of the command being executed at least, but these are not normally called RAM.

Regular C code cannot run in a system without RAM as it uses stack memory to allocate variables, and stack is in RAM. When a recent computer boots, a regular dynamic RAM is initially not available as RAM refreshing device needs initial setup to work. Assembly code runs first and performs the motherboard initialization. RAM starts to work and then C code can run.

share|improve this answer
3  
The last paragraph is not entirely true. The stack does not have to be in off-chip RAM. It is actually quite common for the stack to be located in on-chip memory. Even on normal machines, the stack of the currently-executing thread will usually be in cache and will only get pushed out to DRAM when the scheduler swaps threads. I've written code for DSPs, though, where the stack resided in directly-addressable on-chip memory and never touched the DRAM. Of course, I guess you could argue that the on-chip memory is technically RAM in this case. –  reirab Sep 3 at 17:48
3  
Also, it's not unusual for at least some of the parameters and return values to be passed to C functions using registers (rather than the stack.) Furthermore, local variables are also commonly stored in registers rather than on the stack by C compilers. You can even specifically request that the compiler put a particular variable in a register using the 'register' keyword. Of course, once a function needs more local variables than you have register space for, you will need to go out to memory, but that's a hardware constraint that applies regardless of programming language. –  reirab Sep 3 at 17:50

There are specialized OSes for embedded use that run entirely out of a ROM (read only memory.) To do anything useful, though, you still usually need at least a small amount of RAM. I have not seen a PC that will boot without RAM though.

As for the original question about a memory test, if the computer will POST (i.e. make it past the Power On Self-Test and attempt to boot) then Memtest86 is designed specifically to test your RAM. It tests the first 64KB of RAM, loads itself into that RAM, then test the rest of your system memory as thoroughly as you'd like. "Flakey" memory (as opposed to just plain bad memory) is uncommon, but I have seen Memtest86 catch a intermittently bad bit that the computer's memory test missed (after all, the POST memory test is meant to complete in a reasonable length of time, while memtest86's fastest test runs 5-10 minutes, with more comprehensive tests taking hours.)

share|improve this answer

You don't need RAM e.g, use a Turing machine.

A Turing machine is a hypothetical device that manipulates symbols on a strip of tape according to a table of rules. Despite its simplicity, a Turing machine can be adapted to simulate the logic of any computer algorithm, and is particularly useful in explaining the functions of a CPU inside a computer.

(I would not consider a tape to be RAM.)

Now your real questions should be asking about “useful” and define what you mean by “useful”.

share|improve this answer
3  
At the conceptual level of a Turing Machine, all types of read-write data storage are essentially equivalent: RAM, registers, cache, magnetic tape, disk. The only difference between them is speed of access. –  Barmar Sep 5 at 18:52
    
@Barmar RAM means Random Access Memory. That means you can access the cells within it in any order. The cells on a tape on a Turing machine can only be accessed sequentially (in either direction or alternating). So I'd say the tape on a Turing machine is by definition not RAM. –  kasperd Sep 6 at 10:11
    
@kasperd Since you can move the tape in either direction, and repeat that action as many times as necessary, it's effectively random access. The tape in a TM is an abstraction for any form of storage. –  Barmar Sep 6 at 22:44
    
@Barmar That is incorrect. The definition of RAM does not allow for seek times. Hence the tape of a TM simply does not fit the definition of RAM, because you cannot access arbitrary cells without seeking. –  kasperd Sep 6 at 23:45
1  
@Barmar, no, you don't. That is why we use big "O" notation to talk about purely mathematical complexity that is unrelated to how much "time" something real might take. The mathematical model of a tape drive in this TM is such that it can only read... in either direction... not zoom forward or backward, in any amount of time. Therefor, if you last read byte 1, you can not read byte 27 without first reading the 26 bytes in between. That is why it is not ram. If you want memory that can skip those 26 bytes, whether doing so takes 0 time or 5 minutes, that would be ram, not a tape. –  psusi Oct 29 at 18:56

When I went to University in 1967 the Computing Department had a Stantec Zebra. The memory consisted of a 8192 word magnetic drum. There were also 12 registers and two accumulators. You might consider that RAM but not as we know it.

share|improve this answer

As per all other people here, I do agree on the fact you DO need RAM and cannot work without it, but I also read the following :

(I originally wanted to load a RAM-less OS to check if the RAM had gone bad, but I like the way this question has snowballed.)

This does actually exist in the BIOS, there is a function to check the RAM in depth. When booting and going inside the BIOS, change the option "Quick Power-on self test" to off, and it shall do a complete check pass on your RAM. This option should be located in "advanced BIOS features", something like second choice on AMI BIOSes.

Hope that will put you one step further. ;-)

share|improve this answer

You would need at least on chip cache for registers (essentially a very small amount of on-chip RAM) so that the CPU execution unit could function. So even your CPU has 'RAM'.

No Von-Neumann OS has been designed without the requirement of memory I believe.

So no.

share|improve this answer

If I read the question correctly everybody here is barking up the wrong tree.

He states explicitly "in order to get to the BIOS".

If the laptop is so broken it won't even get into BIOS, everything else is pointless.

You can't boot ANY OS on this regardless of the RAM situation.

share|improve this answer

Your assumption that the memory is bad is likely invalid. If you get no beeps or on-screen messages, The root cause is almost certainly a failed CPU (somewhat unlikely) or a failed mainboard (very likely). Mainboards fail with age all the time due to cold solder joints, which were a common occurrence in the early days of the ROHS movement and the requirement to use lead-free solder. Manufacturing techniques had been optimized for using lead-based solder and the industry took a while to catch on and resolve the issues. Many component manufacturers weren't very willing to spend the money to upgrade their processes. After all, the devices would test and burn in just fine, only to fail months or years later, after any warranty had likely expired. Only with a growing mountain of failures and intense negative feedback from users did the manufacturers begin to improve things. On such a laptop, having the mainboard re-flowed to rectify the cold solder joints is almost certainly cost prohibitive.

share|improve this answer
    
That's possible, but bad memory is not a bad guess, either. I've seen bad memory (and even bad memory sockets) cause a failure to POST multiple times before. Of course, the easiest check for memory is usually just to try booting with different sticks removed or booting with only one known good stick. If that resolves the problems, it was either the memory, the memory slots, or the memory controller. –  reirab Sep 3 at 17:44

You could, with some effort, design a system that contained no RAM. Load your software from ROM (or storage) and do everything in registers or on cache. Such a system would have exceptionally narrow use and given today's RAM prices be a bit pointless. An off-the-shelf laptop will not function without some onboard memory.

Your real question is more likely "How do I get information off of a computer that will not boot" and that's easy. Disassemble it, remove the drive, and connect it to an external drive case.

Note, however, that any computer old enough that you can't just get $20 worth of working RAM for it will have an ATA ( regular ATA, not SATA ) drive. This interface is nearly extinct today, so you will also need to find a drive case with an ATA card as well as a full-size to laptop-size adapter. I have one that I bought in 2000, and I keep a couple of old cases around just for this purpose.

share|improve this answer
    
Agreed. No RAM means no stack which means no ability to call a routine. Any code that could work in this situation would have to be carefully handcrafted assembly. –  Loren Pechtel Sep 1 at 16:24
    
True. I have seen code which did that though. (I was the first part of a BIOS routine before the memory controller was initialised). –  Hennes Sep 2 at 9:20
2  
@LorenPechtel That's not entirely true. The stack can be (and often is) stored in on-chip memory. –  reirab Sep 3 at 17:01
1  
@LorenPechtel not necessary. ARM doesn't use stack to call a routine. –  domen Sep 4 at 10:16
1  
As far as I can see those chips have internal SRAM... which counts as RAM. –  domen Sep 4 at 14:18

It's possible in theory, but it would be very slow, since it'd need to use the disk for any temporary storage that didn't fit in the CPU caches. (CPUs have a few megabytes of cache because even RAM is too slow for them. Think about that.) So you'd need a rather small OS.

But, another thing is, the BIOS runs before and outside any installed operating system, and it's the BIOS that lets you boot from a pendrive or whatever. So if you cannot reach the BIOS, then no other OS in the world is going to help you.

share|improve this answer
6  
It might be that a CPU can use its own cache instead of RAM. It could be a useful feature for those parts of BIOS code, which run before the memory test. But getting other hardware to work without RAM could be tricky. You wouldn't be able to do DMA, so disk I/O would have to be done differently. I guess the BIOS wouldn't even try to load an OS, if no usable RAM was found. The size of the cache is less of a problem though. A few MB may not be a lot by modern standards, but an OS from those days when one MB of RAM was a lot, should still work on modern computers. –  kasperd Aug 31 at 21:39
2  
@kasperd The DEC Alpha was designed to run its very first stage of power-on initialization from cache, preloaded from a "serial ROM". This was because the CPU could not access RAM, conventional ROM, or any other memory-mapped resource (which included all I/O devices, IIRC) until page tables had been initialized. –  Zack Sep 6 at 13:18

protected by Mokubai Sep 2 at 11:19

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.