Understanding Paging in Operating System
Understanding the concept of paging in Operating System
In the absence of paging a process is loaded onto memory and executed. To increase degree of multi programming multiple processes are inserted into RAM and as and when process gets completed they are removed .
Key Take Aways.
- Process memory needs to be contiguous if paging is not implemented.
- Although 300 MB memory was available still Process 4 cannot be executed as 300 MB was fragmented and not contiguous.
- External fragmentation leads to performance degradation.
- This is the same issue what one faces with Hard disk fragmentation resulting in performance degradation.
With the advent of paging
- The concept of paging required the RAM to be divided in fixed size FRAMES and process memory footprint in Pages.
- The problem of External fragmentation is tackled by paging.
- A process is no more required to have contiguous memory footprint.
- Process is divided into pages and hence dynamic loading also became possible .
- A page can be swapped in or out of RAM resulting in increasing degree of multiprogramming.
- A frame is the minimum level of transaction.
Cons of paging .
- If a process has a memory footprint of 150 still it will occupy 2 Frames (200 MB). This results in a loss of 50 MB which is known as internal fragmentation.
- Frames are the minimum level of transaction that one can get. Any request less than a frame is served by 1 Frame.
Linux commands to Find out the page size of the executed process
/usr/bin/time -v CMD dstat (Live status about pages being brought in and swapped out)