Coffee Space


Listen:

Linux Memory Feature

Preview Image

Article of Interest

The following was deemed related to this article and worth reading:

Single Board Revolution: Preventing Flash Memory Corruption

Idea

I’ve had an idea for a Linux memory feature whilst thinking about failing RAM. I’m not knowledgeable of how it works at all, but I remember failing RAM is actually a silent killer of normal desktop computers that go unchecked.

Detection

I thought that a nice feature would be for programs that really care about how good the memory is and checks the integrity of their stored data in RAM, it would be pretty cool if they were to detect an error that they could report it to the kernel to be checked during runtime.

For example, I have a program that has the following parity check:

0001 0 0 1 0
0002 
0003 0 0 1 1  0
0004 1 0 1 1  1
0005 0 0 0 0  0
0006 1 0 1 0  0

Of course you wouldn’t do this bit by bit, but this could be done on some kind of array of bytes. One of the bits changes, the check sum or parity check fails and you mark both check values and the actual value for checking in the kernel. Potentially this is something that could be done live.

One issue would be making sure the program or checker itself does not become corrupt. On the assumption you start correctly, it would be possible to check the program memory before you run the next section of binary.

Handling

To handle the error, the memory could be marked as bad in the kernel, where the kernel pauses the program currently holding that memory and remaps it to somewhere else (or whatever the implementation for memory skipping in the Linux kernel is).

Project

Setup a long term project to monitor a large size of RAM. It might be interesting to see if the process could be speeded up too, perhaps with a radioactive source or some electrical noise producing source that makes the program more likely to detect an error. A control without checking and a control with checking might be a nice experiment.

Keeping things simple, perhaps an Arduino is the best way forwards in this project, as it’s very simple to control the low level workings. One issue is in memory corrupting that you depend on but can’t control, i.e. for example if the Arduino bootloader memory was to fail you might get some unwanted results.

More thinking on this project is required when I have more time!