78

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.

12 Answers12

96

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.

agtoever
  • 6,402
32

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.

(Well, embedded systems-on-chip can execute code from either RAM or internal Flash memory – the PC BIOS could in theory do the same, but it can't run the whole 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.

grawity
  • 501,077
15

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.

peter
  • 251
9

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.

Tonny
  • 33,276
8

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.

sewalk
  • 81
5

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.

h22
  • 466
4

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.

3

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.

Hi Lo
  • 435
3

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. ;-)

3

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”.

Ian Ringrose
  • 1,299
3

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.)

hwertz
  • 187
2

Yes, you can have a computer without RAM. There is a special mode in most x86 processors that allows to run it with cache only. If you check for coreboot (former linuxbios), it can do that. Its called cache-as-ram. Actually you can do a whole operating system based on this, and with the modern big-sized caches it could end up even having a gui (check menuet-os). But none done so yet.