3 ms·
If swap trashing makes a system unusable, why not get rid of the swap and let the program crash? Isn't that the preferred behavior?
by windsurfer 15y ago
If swap trashing makes a system unusable, why not get rid of the swap and let the program crash? Isn't that the preferred behavior?
- argus 15y agoswapping is a fundamental part of a multi-tasking o/s and unfortunately unless a program starts writing into memory addresses that have not been allocated to it the o/s would not be able to know if the program is crashing or not (segmentation faulting)... to the o/s this bug would just look like a memory hungry program so it just keeps on allocating more memory... once all physical memory has been used up, the o/s has to swap out old data to disk and re-use addresses for this program that just doesn't stop asking for more memory... i.e the program doesn't know it's doing stupid shit and the o/s doesn't know it is hosting a stupid program.. it's kinda like a house party where everyone starts the night normal, then as the night goes on some idiot doesn't recognize their own limits and they keep drinking more and more and the host doesn't know what this guy is doing and before he knows it he has to clean up vomit in the morning... hope this makes sense..
- gsg 15y agoYou are conflating virtual memory and swapping. A disk-backed page cache is not necessary for memory protection.
- rbranson 15y agoThis makes sense for servers, because they shouldn't really have any significant amount of virtual memory space tied up by non-resident allocations. On a desktop OS, the user has a much larger breadth of software loaded and is only using a subset of a handful of software's allocated memory at once. As long as all of that can be in RAM at once, everything else can be safely swapped out without serious performance degradation. The OS can even prefer to swap out long-dormant processes (like, say, the rarely used SSH server on your desktop) to use that RAM for disk cache.