How does live linux disk work without any swap for applications bigger than available RAM?
How does live linux disk work without any swap for applications bigger than available RAM? This question has occurred to me a lot of times. In the normal scenario I configure enough swap space on the harddis for my GNU/Linux installation. It looks clear that whenever a new request for memory is made by an application, the Linux kernel (OS) gives that request by swapping out a page into swap space ( when there wasn’t enought space available in RAM). However when an application is large and there in no swap space availabe, what does the Linux kernel do with existing process’s memory ( the pages )?
The answer to this question occured to me when I was reviewing my OS concepts from the famous book by Galvin and Gagne – Operating System Concepts which says:
Some systems attempt to limit the amount of swap space used through demand paging of binary files. Demand pages for such files are brought directly from the file system. However, when page replacement is called for, these frames can simply be overwritten (because they are never modified), and the pagesn can be read in from the file system again if needed. Using this approach, the file system itself serves as the backing store. However, swap space must still used for pages not associated with a file; these pages include the stack and heap for a process. This method apears to be a good compromise and is used in several systems, including Solaris and BSD UNIX.
It is quite clear from the above that for binary files ( the non-modifiable part of application ), the files can be read again and again without any issue of swapping out the page in memory. The only concern now is the heap and swap space that is occupying the memory. What is a solution for that?