How does Memtest86 function with bad RAM?
I was reading another question about Memtest and started wondering: How does Memtest86 function with bad RAM?
Think about it: Memtest86 needs to store information about how large the RAM is, what it put in RAM to compare later, where to update the screen, and a lot more information. The act of using a variable requires RAM to be functioning properly. But how can you get reliable results when your running the program on possibly defective RAM?
An analogy to this is running a hard drive checking program from the hard drive that your checking. You would never do that, a bad block could affect the program in lots of unexpected ways
How does Memtest86 function with bad RAM?
Solution 1:
Mostly because the amount of ram that it takes to load memtest is extremely small. If the program runs, it's likely that the memory in this one area is ok.
The chance that-
- The small section of memory memtest was loaded in is bad.
- It was still good enough that the it was able to complete all the tests successfully without noticeable issues.
Is -highly- unlikely.
Solution 2:
Memtest is quite durable in that it doesn't really depend on the RAM it's testing.
For example, test 0 uses a walking ones algorithm, and all it requires for that test is a single pointer (probably cached), because it's only comparing two consecutive memory addresses.
So if we have a 3-bit RAM stick, memtest loads it with this:
<pointer location> 00000001 00000010 00000100 00001000 00010000 00100000 01000000
And if the first address is corrupted, it'll compare two random locations:
00000001 00100000
And it'll still fail, even if memtest's variables are corrupted.
Solution 3:
Memtest absolutely has to make at least one assumption, that at least the memory it itself is loaded into is good. After that it is able to scan and test the rest of memory in its entirety.
It may be that it is still able to read and detect errors in its own memory as, being the only program loaded, it should have access to practically all of the memory on the system and so be able to read and compare that memory to a "known good" sample.