Swapping in OS:
Swapping is a method to improve the main memory utilization.
For ex: the main memory consists of 10 processes. Assume that it is the maximum
capacity, and the CPU is currently executing the process number 9. In the
middle of the execution, the process number 9 needs an IO. Then, the CPU switch
to another job and process number 9 is moved to a disc and another process is
loaded in main memory in the place of process number 9. When the process number
9 completes its IO operation, then the process number 9 is moved into main
memory from disc. Switching a process from main
memory to disk is said to be “swap
out” and switching a process from disk
to main memory is said to be “swap
in”. This type of mechanism is said to be “swapping”. We can achieve efficient memory utilization with
swapping.
Consider the
following figure:
Swapping requires a ‘Backing
Store’. The backing store is commonly a fast disk. It must be large enough
to accommodate the copies of all process images for all users. When a process
is swapped out, its executable image is copied into backing store. When it is
swapped in, it is copied into the new block allocated by the Memory Manager.
No comments:
Post a Comment