Assignment of Swap Space Management
Assignment of Swap Space Management
COLLEGES OKARA
CAMPUS
Class:
ADP(cs) 4
Subject:
Operating System
Assignment:
Swap Space Management
Submitted by:
Ifrah Mazhar
Roll No. 04
Submitted to:
Prof. Sana Rehmat
Swap-Space Management
Swapping is a memory management technique used in multi-programming to
increase the number of process sharing the CPU. It is a technique of removing a
process from main memory and storing it into secondary memory, and then
bringing it back into main memory for continued execution. This action of moving
a process out from main memory to secondary memory is called Swap Out and the
action of moving a process out from secondary memory to main memory is
called Swap In.
Swap-Space :
The area on the disk where the swapped out processes are stored is called
swap space.
Swap-Space Management :
Swap-Swap management is another low-level task pf the operating system.
Disk space is used as an extension of main memory by the virtual memory. As we
know the fact that disk access is much slower than memory access, In the swap-
space management we are using disk space, so it will significantly decrease system
performance. Basically, in all our systems we require the best throughput, so the
goal of this swap-space implementation is to provide the virtual memory the best
throughput. In these article, we are going to discuss how swap space is used, where
swap space is located on disk, and how swap space is managed.
Swap-Space Use :
Swap-space is used by the different operating-system in various ways. The
systems which are implementing swapping may use swap space to hold the entire
process which may include image, code and data segments. Paging systems may
simply store pages that have been pushed out of the main memory. The need of
swap space on a system can vary from a megabyte to gigabytes but it also depends
on the amount of physical memory, the virtual memory it is backing and the way in
which it is using the virtual memory.
It is safer to overestimate than to underestimate the amount of swap space required,
because if a system runs out of swap space it may be forced to abort the processes
or may crash entirely. Overestimation wastes disk space that could otherwise be
used for files, but it does not harm other.
Following table shows different system using amount of swap space:
System Swap-Space
1) Solaris Equal Amount of physical memory
2) Linux Double the Amount of physical memory
Swap-Space resides in
Separate Disk
Normal File System
Partition
Swap-Area
Page
Slot
Swap Partition or
Swap File
Swap Map 1 0 3 0 1
Each swap area consists of 4-KB page slots, which are used to hold the swapped
pages. Associated with each swap area is a swap-map- an array of integers
counters, each corresponding to a page slot in the swap area. If the value of the
counter is 0 it means page slot is occupied by swapped page. The value of counter
indicates the number of mappings to the swapped page. For example, a value 3
indicates that the swapped page is mapped to the 3 different processes