F5F Stay Refreshed Software Operating Systems Executing Linux solely on swap memory only

Executing Linux solely on swap memory only

Executing Linux solely on swap memory only

Pages (2): Previous 1 2
E
explizip
Member
227
06-19-2023, 06:48 PM
#11
Mounting your drive as swap demands available RAM. While @igormp noted you could bypass RAM sticks using CPU cache, it's still essentially memory usage. You can run it with minimal RAM and plenty of swap space. It might seem odd, but it's feasible.
E
explizip
06-19-2023, 06:48 PM #11

Mounting your drive as swap demands available RAM. While @igormp noted you could bypass RAM sticks using CPU cache, it's still essentially memory usage. You can run it with minimal RAM and plenty of swap space. It might seem odd, but it's feasible.

C
Cra123
Senior Member
251
06-20-2023, 03:14 AM
#12
Modern computers came with 640K of RAM by default because the BIOS required it to operate. Without that memory, the BIOS couldn't run, which meant no operating system and thus no PC. Even now, I'm confident the initial 640K was set aside specifically for BIOS functions.
C
Cra123
06-20-2023, 03:14 AM #12

Modern computers came with 640K of RAM by default because the BIOS required it to operate. Without that memory, the BIOS couldn't run, which meant no operating system and thus no PC. Even now, I'm confident the initial 640K was set aside specifically for BIOS functions.

C
Cianide24
Junior Member
29
07-10-2023, 09:48 AM
#13
It actually isn't. The reset vector in x86 points to the ROM inside your BIOS, allowing you to run instructions directly from there—this is why some malware sends memory errors. In theory, you could swap in your own code and avoid using RAM altogether. But is it practical? I’m not sure, and I definitely wouldn’t be the one trying that.
C
Cianide24
07-10-2023, 09:48 AM #13

It actually isn't. The reset vector in x86 points to the ROM inside your BIOS, allowing you to run instructions directly from there—this is why some malware sends memory errors. In theory, you could swap in your own code and avoid using RAM altogether. But is it practical? I’m not sure, and I definitely wouldn’t be the one trying that.

O
oOEmmaOo
Posting Freak
818
07-10-2023, 01:49 PM
#14
I think you're making a little misunderstanding in what SWAP is and how it works. Although the SWAP space is kind of a part of of your memory footprint in a way, it's not used directly. Think of your RAM as your hands, SWAP as your pockets. Things in your hands are the things you're actually able to use and manipulate. If your hands start filling up, you might start putting things into your pocket and kind of swapping items between your hands and your pockets based on what you need to use at a given moment. The key thing here is that things in your pocket cannot be manipulated directly, they must be moved into your hands first. So it goes for SWAP; functions and data in SWAP must be paged in before they can be used. To the specific formulation if your question, the answer is no. While RAM works just fine without SWAP and pants work just fine without pockets, the reverse is not true. But the vibe of your question is more: "Could I just tell my OS to use these 8GB of my harddrive as if it's RAM?" There's a great German word "jein" which is the real answer here. It means both yes (ja) and no (nein) at once. You could maybe write your own OS from scratch that for some reason does this SSD as RAM thing, but it would be really difficult and once you're done it wouldn't be Linux. It would be "Defective Soul's Weird New OS" and it would be unbearably slow. If you want to do it with Linux, you need to write your own hypervisor which would pretend to your Linux distro that it has completely normal RAM available, when it reality it would only be reading/writing to some place on the hard drive. But even this might require some custom hardware, I am not sure if a normal motherboard/CPU would actually let you completely bypass RAM for a specific process. I suspect that even this option would require some custom hardware. So, can you run a theoretical custom Linux distro which uses an SSD as RAM? Jein.
O
oOEmmaOo
07-10-2023, 01:49 PM #14

I think you're making a little misunderstanding in what SWAP is and how it works. Although the SWAP space is kind of a part of of your memory footprint in a way, it's not used directly. Think of your RAM as your hands, SWAP as your pockets. Things in your hands are the things you're actually able to use and manipulate. If your hands start filling up, you might start putting things into your pocket and kind of swapping items between your hands and your pockets based on what you need to use at a given moment. The key thing here is that things in your pocket cannot be manipulated directly, they must be moved into your hands first. So it goes for SWAP; functions and data in SWAP must be paged in before they can be used. To the specific formulation if your question, the answer is no. While RAM works just fine without SWAP and pants work just fine without pockets, the reverse is not true. But the vibe of your question is more: "Could I just tell my OS to use these 8GB of my harddrive as if it's RAM?" There's a great German word "jein" which is the real answer here. It means both yes (ja) and no (nein) at once. You could maybe write your own OS from scratch that for some reason does this SSD as RAM thing, but it would be really difficult and once you're done it wouldn't be Linux. It would be "Defective Soul's Weird New OS" and it would be unbearably slow. If you want to do it with Linux, you need to write your own hypervisor which would pretend to your Linux distro that it has completely normal RAM available, when it reality it would only be reading/writing to some place on the hard drive. But even this might require some custom hardware, I am not sure if a normal motherboard/CPU would actually let you completely bypass RAM for a specific process. I suspect that even this option would require some custom hardware. So, can you run a theoretical custom Linux distro which uses an SSD as RAM? Jein.

J
Jayhawk_Down
Senior Member
350
07-29-2023, 12:34 AM
#15
I also need to mention that even an SSD can be slower than RAM.
J
Jayhawk_Down
07-29-2023, 12:34 AM #15

I also need to mention that even an SSD can be slower than RAM.

K
KeezusiekYT
Junior Member
9
07-31-2023, 03:14 AM
#16
It's theoretically feasible but would shift focus from "hacking Linux" to creating a new BIOS, possibly modifying the CPU microcode. The assembly techniques taught emphasize reading from and writing to memory. Older BIOS systems relied on CPU cache, especially before RAM was widespread. The challenge lies in accessing disks under such conditions. A DMA solution that writes to the CPU cache could be useful, though it's uncommon and uncertain. If microcode rewriting is possible, it might work, but I'm unsure. Ultimately, even if memory control is handled by the CPU, the physical connections may prevent it.
K
KeezusiekYT
07-31-2023, 03:14 AM #16

It's theoretically feasible but would shift focus from "hacking Linux" to creating a new BIOS, possibly modifying the CPU microcode. The assembly techniques taught emphasize reading from and writing to memory. Older BIOS systems relied on CPU cache, especially before RAM was widespread. The challenge lies in accessing disks under such conditions. A DMA solution that writes to the CPU cache could be useful, though it's uncommon and uncertain. If microcode rewriting is possible, it might work, but I'm unsure. Ultimately, even if memory control is handled by the CPU, the physical connections may prevent it.

S
Smoofie
Member
213
08-07-2023, 03:43 PM
#17
For what’s mentioned, the command line doesn’t really make things simpler much. Running it through a serial port would already be a tough task. When it comes to "arch," most distros aren’t crucial, particularly during the early stages of OS boot—this is where the final decision lies.
S
Smoofie
08-07-2023, 03:43 PM #17

For what’s mentioned, the command line doesn’t really make things simpler much. Running it through a serial port would already be a tough task. When it comes to "arch," most distros aren’t crucial, particularly during the early stages of OS boot—this is where the final decision lies.

Pages (2): Previous 1 2