top | item 37035311

(no title)

sdfzguf | 2 years ago

> makes sense to use swap space in aiding suspend to disk if some of the allocated memory is already paged out to it.

Maybe I can learn something here. From my understanding, the RAM image moves completely to the swap space, since the RAM memory is shut down (cleared). I thought, that's why it's calles 'suspend to disk'. During hibernation most components are in a state of being almost shut down. And that would be why you need a disk that can hold data non-volatile (eg not the RAM memory). Edit: From your comment it reads like the swap space is only for assisting the process, while from my understanding that's the place where the whole RAM image resides during sleep.

> a swap partition for the purposes of hibernation, while also disabling swapping of memory while your machine is in-use.

I thought the exact same. Avoid tear of the SSD and security implications, while having the option of hibernation (including the security implications) in case of need.

discuss

order

ac2u|2 years ago

> Maybe I can learn something here. From my understanding, the RAM image moves completely to the swap space, since the RAM memory is shut down (cleared)

I think your understanding is broadly correct. My point was centred on the nuance that the primary purpose of swap space is for the OS to move less frequently used parts of virtual memory to disk to allow more recently/frequently used virtual memory to occupy the physical RAM.

So theoretically, if you wanted to implement hibernation on top of such a system, you wouldn't need the OS to have swapping enabled. (Although from your examples, practically, in some cases at least you do)

Without swap space, the OS would still use virtual memory addressing and allocation, but it would only be translatable to physical addresses in RAM, and exhaustion of RAM would lead to the OS out of memory killer to start killing processes to free RAM up.

But you could still write a hibernation program to take everything in memory and write it to disk and restore it later even if you're not using the OS swap capability to provide programs with the illusion of more memory to use than RAM allows.