swap memory space and swapping in OS

Swapping is a simple memory/process management technique used by the operating system(os) to increase the utilization of the processor by moving some blocked process from the main memory to the secondary memory(hard disk);thus forming a queue of temporarily suspended process and the execution continues with the newly arrived process.After performing the swapping process,the operating system has two options in selecting a process for execution :

*Operating System can admit newly created process (OR) *operating system can activate suspended process from the swap memory.

what is swapping in operating system

Conclusion : If you have ever used any Linux based operating system then at the time of installation …Did you see an options/warning for the need of swap memory space?? If you have enough primary memory(RAM) e.g greater than 2GB then you may need not any swapping memory space for desktop users(I am using Ubuntu 10.04 LTS and total RAM is 4GB so I am not feeling any trouble without swap memory space) and some times using swap memory may slow down your computer performance.

Credit : Operating Systems…by William Stallings

Join the Conversation

27 Comments

  1. Let us take an example to understand better.
    Consider processes P1 and P2.
    If process P1 requests for an I/O operation, it becomes blocked and will not return to ready state for a relatively long period of time.The process manager places P1 in a blocked state. Hence the memory manager decides whether to swap the process from the main memory to the secondary memory. And the swaps out the process P1. Now the process P2, which was in the secondary memory, changes its state from blocked to ready. Hence the memory manager swaps in the process p2 from the secondary memory to the main memory, for execution.

  2. I still didn’t understand the conclusion , can you explain in detail ?

    So there is no need of swapping memory if you have RAM more then 2 GB ??

    How does swapping makes it SLOW ??

Leave a comment

Leave a Reply to Pathaksolu1995 Cancel reply

Your email address will not be published. Required fields are marked *