0% found this document useful (0 votes)
27 views31 pages

OS Unit 4 BCA-402

Uploaded by

28sushantkmr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views31 pages

OS Unit 4 BCA-402

Uploaded by

28sushantkmr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 31

OPERATING SYSTEM (BCA-402) UNIT 4

UNIT 4 : Device Management


*Device Function.
*Device Characteristic.
*Disk space Management.
*Allocation and Disk scheduling Methods.

4.1 Device Management Functions


➢ The management of I/O devices such as printers, card readers,
taps, disk and supporting devices such as control unit and
control channel.
➢ The basic function of I/O devices are:
1. Track status of all devices which are requires special mechanism.
2. Deciding the policy on determine which process gets a
device, for how long and where.
➢ There are three basic techniques for implementing a device
for policy. 1.Dedicated : A technique where a device is assign
to a single process. 2.Shared : A technique where a device
shared by many processes. 3.Virtual : A technique where one
physical device this simulated on another physical device. Its
Combination of dedicated devices that have been transformed
into shared devices.
3. Allocation : Physically ascending a device to process with
controlling unit and channel.
4. De-allocation : De-allocate the devices at 2 levels.
1. On job level : A device assign only for as long as the
job exits in the system.
2. On process level : A device assign only for as long as
the process needs it.

1
OPERATING SYSTEM (BCA-402) UNIT 4

4.2 Device characteristics


Devices can be categorizes into two groups.
1. Input/Output Device.
2. Storage devices.
1. Input/Output Devices :
➢ An input devices takes data from the outside world.
➢ An output device which produce data to the outside world.
➢ Example : Card reader (Input device) Printer (output Device)
2. Storage Device :
➢ It is a mechanism by which the computer may store the
information in such a way that information may be retrieve
at later time.
➢ There are following three types of storage devices.
1. Serial Access Devices.
2. Completely Direct Access.
3. Direct Access Storage device (DASD).
1. Serial Access Devices : It can be characterized as one that
dependence on physical sequential positioning and accessing
information.
➢ Example, Magnetic tap unit where information is stored as a
group of byte called records of any length.
➢ Each record can be identify by it physical position
on the tap Example, the first record is one second record

2
OPERATING SYSTEM (BCA-402) UNIT 4

is second and So on.


2. Completely direct access devices :


➢ A completely direct access devices is one in which the
access time is constant.
➢ It requires less time and less cost.
➢ Example, Magnetic code memory,
➢ semiconductor memory

➢ And read only wired memory


➢ In figure the 16 circles represent magnetic cores. All cores
are connected by wires, each core having two selection wires
through it.
➢ When hardware receives a read request for some address, the
address is decomposed into x and y position. The hardware
then selects the appropriate core.

3.Direct Access storage device (DASD) :


➢ A direct access device is one that is characterized by small
variances in the access time. These have been called direct
access storage devices.
3
OPERATING SYSTEM (BCA-402) UNIT 4

➢ Example :Magnetic drum and disk.


➢ In a magnetic drum can be viewed as several adjacent strips
of magnetic tape wrapped around a drum so that the ends of
each tape strip join. Each tape strip ,called track, and its
separate read/write head.
➢ The drum continuously revolves at high speed so that record
repeatedly pass under the read/write head. (e.g
record1,record2.., then record1 again,record2…etc). Each
individual record is identified by a track number and then a
record number.

Fixed head drum


Example: record (2,1) is
X’C4C9E2D2’ and record
(5,1) is X’D1D6C5D5’.
Each record is identified by track no and record number.

4.Direct Access storage device (DASD) :


➢ A direct access device is one that is characterized by small
variances in the access time. These have been called direct
access storage devices.
➢ Example :Magnetic drum and disk.
➢ In a magnetic drum can be viewed as several adjacent strips
of magnetic tape wrapped around a drum so that the ends of
each tape strip join. Each tape strip ,called track, and its
separate read/write head.
➢ The drum continuously revolves at high speed so that record
repeatedly pass under the read/write head. (e.g
record1,record2.., then record1 again,record2…etc). Each
individual record is identified by a track number and then a
record number.

Fixed head drum


Example: record (2,1) is

4
OPERATING SYSTEM (BCA-402) UNIT 4

X’C4C9E2D2’ and record


(5,1) is X’D1D6C5D5’.
Each record is identified by track no and record number.

4.2.1 Three Factors Contribute To Time Required To Access a File

➢ Seek time -- time required to position the read/write head


on the proper track.

5
OPERATING SYSTEM (BCA-402) UNIT 4

➢ Search time (rotational delay) -- time it takes to rotate


DASD until requested record is under read/write head.

➢ Transfer time -- when data is actually transferred from


secondary storage to main memory.

4.2.2 Four types of technology.

[1] CD-ROM Technology -- commonly used optical storage DASD.


➢ Stores very large databases, reference works, complex
games, large software packages, system documentation, and
user training material.

[2] CD-Recordable Technology (CD-R):


➢ CD-R drives record data on optical discs using a write-once technique.
➢ WORM (write once, read many).
➢ Only a finite amount of data can be recorded on each disc and,
once data is written, it can’t be erased or modified.

[3] CD-Rewritable Technology (CD-RW)


➢ CD-RW discs can be written and rewritten many times by
focusing a low- energy laser beam on surface.
➢ Useful for storing large quantities of data and for sound,
graphics, and multimedia applications.

[4] Digital Video Disc (DVD) Technology


➢ DVD uses infrared laser to read disc (holds equivalent of
13 CD-ROM discs).
➢ By using compression technologies, has more than enough
space to hold a 2-hour of movie with enhanced audio.
➢ Single layered DVDs can hold 4.7 GB
➢ Double-layered disc can hold 8.5 GB on each side
of the disc. DVDs are used to store music, movies,
and multimedia applications.
➢ DVD-RAM is a writable technology that uses a red laser to
6
OPERATING SYSTEM (BCA-402) UNIT 4

read, modify, and write data to DVD discs.

4.2.3 Direct Memory Access (DMA)


➢ It is an I/O technique that allows a control unit to access
main memory directly.
➢ Once reading or writing begins, remainder of data can be
transferred to and from memory without CPU intervention.
➢ To activate this process CPU sends enough info to control
unit to initiate transfer of data
➢ Then CPU goes to another task while control unit
completes transfer independently.

➢ Without DMA the CPU is responsible for moving or


transferring the data which is time consuming process.

4.2.4 Device Driver


➢ It is a software module that controls an I/O device and
handle its interrupts.
➢ Each device has its own device driver.
4.2.5 BIOS :
➢ BIOS is the position of a device manager that handles the
device driver software and is stored in both ROM and RAM.
➢ We can also write on your own device driver, if you have
know assembly languages and information about hardware.

7
OPERATING SYSTEM (BCA-402) UNIT 4

4.3 Disk Space Management


4.3.1 Boot block:
➢ To reboot or to start the computer, it must have bootstrap program.
Which initialize the system from CPU registers to device
controller and the contained of main memory and started
a operating system.
➢ Boot strap is stored in read only memory (RAM).
➢ It stored in the boot block at the fixed location on the disk.
➢ A disk that has boot partition is call boot disk.
➢ Hard disk is divided into one or more partitions and
a partition Identified as a boot partition that contains
operating system and device Drivers.

8
OPERATING SYSTEM (BCA-402) UNIT 4

➢ Operating system stored boot card in the first sector of


hard disk Which is called master boot records (MBR) and
this sector is known
As boot sector.

4.3.2 Bad block


➢ If one ore more sector of hard disk become defective that known
➢ as bad block.
➢ This block are handle in different ways.
1. Bad block are handle manually.
2. Sector sparing.
3. Sector slipping.

1. Bad block are handle manually : in this process disk is


scanned to find the bad blocks. After that a special value is
returned in to FAT( File allocation table) to allocation
routine not to that block.

2. Sector sparing :
➢ the device controller maintain a list of bad block on the disk.
➢ The list is initialized during low level formatting.
Low level Formatting also set spare sectors, which
replaces bad sector logically. This process is known as
sector sparing or forwading.

3. Sector slipping :
➢ Some controller can be instructed to replace a bad
block by sector slipping.
E.G suppose logical block no 17 becomes defective and
first available spare sector is 202. then sector slipping
technique ramps all the sector form 17 to 202. the
sector 202 is copied into another spare sectors. Then
201 to 202 and so on. Until the sector 18 is copied the
sector 19. In this way this technique frees Up the space
9
OPERATING SYSTEM (BCA-402) UNIT 4

of sector 18 so, sector 17 can we mapped into it.

4.3.3 Buffering :
➢ A buffer is a memory area that stores data being transferred
between two devices or between a device and application.
4.3.4 Spooling :
➢ Spooling is a buffer that holds output for a device,such as
printer. Each application output is spooled to a separate disk
file. When the application finished and printing the spooling
system queues the corresponding spool file for output to
printer.

➢ The spooling system copied the queues spool files to the


printer on at a time.
➢ Device Manager divides task into 3 parts, with each handled
by specific software component of I/O subsystem.

[4.3.5] Management of I/O Requests

➢ I/O traffic controller watches status of all devices, control


units, and channels.
➢ I/O scheduler implements policies that use to allocate
devices, control units, and channels. Access I/O request
from jobs.
➢ I/O device handler processes the I/O interrupts, handles
error conditions, and provides detailed scheduling
algorithms, which are extremely device dependent.

10
OPERATING SYSTEM (BCA-402) UNIT 4

4.4 Disk Scheduling.


➢ The operating system is responsible for using hardware
efficiently — for the disk drives, this means having a fast
access time and disk bandwidth.
➢ Access time has two major components
o Seek time is the time for the disk are to move the
heads to the cylinder containing the desired sector.
o Rotational latency is the additional time waiting for
the disk to rotate the desired sector to the disk head.
➢ Minimize seek time
➢ Seek time  seek distance
➢ Disk bandwidth is the total number of bytes transferred,
divided by the total time between the first request for service
and the completion of the last transfer.

4.4.1 FCFS : FIRST COME FIRST SERVES.

➢ First-come first served scheduling follow first in first out method.


➢ It serves the request in the same order as they are received
➢ The average waiting time for FCFS is often quite
long. It is non- preemptive.
➢ In the below example the disk head is initially at cylinder 53,
it will first move 53 to 98 then to 183,37,122,14,124,65 and
finally to 67 for a total head movement of 640 cylinders.

11
OPERATING SYSTEM (BCA-402) UNIT 4

ex – 98-53 = 45
Total head movement = 45+85+146+85+108+110+59+2
= 640

➢ Advantages :
➢ Simple ,fair to all request.
➢ No starvation.

➢ Disadvantages :
➢ Not efficient because the average seek time is high.

12
OPERATING SYSTEM (BCA-402) UNIT 4

SSTF : SHORTEST SEEKTIME FIRST SCHEDULING


➢ Selects the request with the minimum seek time from the
current head position.
➢ SSTF scheduling is a form of SJF scheduling; may cause
starvation of some requests.
➢ Illustration shows total head movement of 236 cylinders.

Total head movement = 12+2+30+23+84+24+2+59


= 236

➢ Advantages :
More efficient than FCFS.

➢ Disadvantags: Starvation is possible for request involving longer seek-

13
OPERATING SYSTEM (BCA-402) UNIT 4

time.

14
OPERATING SYSTEM (BCA-402) UNIT 4

SCAN SCHEDULING

➢ The disk arm starts at one end of the disk, and moves toward
the other end, servicing requests until it gets to the other end of
the disk, where the head movement is reversed and servicing
continues.
➢ Sometimes called the elevator algorithm.
➢ The head starts at the one end of the disk and moves
toward on the another end. it serves all the request
coming in the way.
➢ After reaching another end the direction of head movement is reverse.
➢ Illustration shows total head movement of 236 cylinders.

Total head movement =


16+23+14+65+2+31+24+2+59
= 236
➢ Advantages :
➢ More efficient than FCFS.
➢ No starvation for any request.

15
OPERATING SYSTEM (BCA-402) UNIT 4

➢ Disadvantages :Not so fair, because cylinder which are just


behind the head will wait longer.
➢ Requires extra head movement between two
extreme points.
➢ For example, after serving 5th cylinder,
there is no need to visit 0th cylinder.

C-SCAN [Circular SCAN] SCHEDULING


➢ The circular SCAN algorithm improves upon SCAN b treating
all the request in a circular queue fashion.- once the head
reaches the end of the disk, it returns to the other end without
processing any request, and then starts again from the
beginning of the disk.
➢ The head moves from one end of the disk to the other.
servicing requests as it goes. When it reaches the other end,
however, it immediately returns to the beginning of the disk,
without servicing any requests on the return trip.
➢ Treats the cylinders as a circular list that wraps around
from the last cylinder to the first one.
➢ Illustration shows total head movement of 382 cylinders,
plus return time.
➢ Provides a more uniform wait time than SCAN

16
OPERATING SYSTEM (BCA-402) UNIT 4

Total head movement = 12+2+31+24+2+59+16+199+14+23


= 382
LOOK

➢ it is same like SCAN scheduling but the difference that end


points are not visited unnecessary.
➢ Arm only goes as far as the last request in each direction,
then reverses direction immediately, without first going all
the way to the end of the disk.
➢ Advantages :
➢ More efficient than FCFS.
➢ No starvation for any request.
➢ No extra head movement.

➢ Disadvantages :
➢ Not so fair, because cylinder behind the head with longer.
C-LOOK [ circular – LOOK]
Version of C-SCAN
➢ Arm only goes as far as the last request in each direction,
then reverses direction immediately, without first going all
the way to the end of the disk.

17
OPERATING SYSTEM (BCA-402) UNIT 4

Selecting a Disk-Scheduling Algorithm

• SSTF is common and has a natural appeal


• SCAN and C-SCAN perform better for systems that place a
heavy load on the disk.
• Performance depends on the number and types of requests.
• Requests for disk service can be influenced by the file-allocation
method.
• The disk-scheduling algorithm should be written as a separate
module of the operating system, allowing it to be replaced with
a different algorithm if necessary.
• Either SSTF or LOOK is a reasonable choice for the default
algorithm.

• Newer disks have


• Lower seek time relative to latency
• Built in scheduling - send requests in batches

18
OPERATING SYSTEM (BCA-402) UNIT 4

• OS level scheduling is important at a coarser grain level, for


important disk activity, e.g., VM

4.5 Allocation Methods


➢ An allocation method refers to how disk blocks are allocated for files:

➢ Contiguous allocation
➢ Linked allocation
➢ Indexed allocation

1. Contiguous allocation :
➢ Each file occupies a set of contiguous blocks on disk.
➢ When file is created, a disk is search to find free memory
having enough size to store a file, once the free memory found
then memories allocated.
➢ Each directory entry contains.
➢ File name
➢ Starting address of the first block.
➢ Length in block.

19
OPERATING SYSTEM (BCA-402) UNIT 4

Example of Contiguous Allocation Methods

➢ Advantages :
➢ It supports fast sequential and direct access.
➢ It provides a good performance.
➢ The number of disk seek required is minimal.
➢ Simple to implement, there are two things required.
1. starting block number
2. length of the file.

➢ Disadvantages :
➢ Find free spaces for new file, its time consuming.
➢ If size of the existing file increase that it may not be
possible to accommodate such a data.
➢ External fragmentation is possible.
20
OPERATING SYSTEM (BCA-402) UNIT 4

2. Linked Allocation Methods


➢ In this method, each file is linked list of disk blocks , each
block contain pointer to next block.
➢ Each directory entry contains.
➢ File name
➢ Starting block no.
➢ Ending block no.

➢ When new file is created a new directory entry is created an


initially it contain null Value.
➢ A write operation to the required free blocks to be added to the
file at the end of link list.
➢ To read a file all blocks are read by the pointer from 1 block to
another.
21
OPERATING SYSTEM (BCA-402) UNIT 4

➢ A view of the linked list.


➢ --€9 €16 €1 €10 €25
➢ Advantages :
➢ It does not suffer from external fragmentation.

22
OPERATING SYSTEM (BCA-402) UNIT 4

Disadvantages :
➢ File access is time consuming because it required to
search link list to reach at same block.
➢ Direct access is not supported.
➢ Memory space required for the pointers.
➢ Reliability is compromised if the pointers are lost or damaged.

23
OPERATING SYSTEM (BCA-402) UNIT 4

3. Index allocation
➢ link allocation method can not support direct access to
solved this problem index allocation is used.
➢ It store all pointer together in the index table.
➢ It bring all the pointer together in to one location called the index
block.
➢ Each file contain its own index block, the entry in the index
block points to block no of the file
➢ Directory entry contains.
➢ File name
➢ Index block
➢ When the first block is return a free block is allocated and
its address shown in the entry in the index block.

24
OPERATING SYSTEM (BCA-402) UNIT 4

Advantages :
_ No external fragmentation.
_ Support Direct access.
_ Support sequential access
_ Number of disk seeks is minimal.

Disadvantages :
_ It suffer from wastage spaces.
_ Maximum allowable file size depends on size of an index block.

DISK RELIABILITY
It is important to understand the terms reliability and performance as they pertain to
disks. Reliability is the ability of the disk system to accommodate a single- or multi-
disk failure and still remain available to the users. Performance is the ability of the
disks to efficiently provide information to the users.

Adding redundancy almost always increases the reliability of the disk system. The
most common way to add redundancy is to implement a Redundant Array of
Inexpensive Disks (RAID).

There are two types of RAID:

 Hardware — The most commonly used hardware RAID levels are: RAID 0,
RAID 1, RAID 5, and RAID 10. The main differences between these RAID
levels focus on reliability and performance as previously defined.
 Software — Software RAID can be less expensive. However, it is almost
always much slower than hardware RAID, because it places a burden on the
main system CPU to manage the extra disk I/O.

The different hardware RAID types are as follows:

 RAID 0 (Striping) — RAID 0 has the following characteristics:


 High performance — Performance benefit for randomized reads
and writes
 Low reliability — No failure protection
 Increased risk — If one disk fails, the entire set fails

25
OPERATING SYSTEM (BCA-402) UNIT 4

The disks work together to send information to the user. While this
arrangement does help performance, it can cause a potential problem. If one
disk fails, the entire file system is corrupted.

 RAID 1 (Mirroring) — RAID 1 has the following characteristics:


 Medium performance — Superior to conventional disks due to
"optimistic read"
 Expensive — Requires twice as many disks to achieve the same
storage, and also requires twice as many controllers if you want
redundancy at that level
 High reliability — Loses a disk without an outage
 Good for sequential reads and writes — The layout of the disk
and the layout of the data are sequential, promoting a performance
benefit, provided you can isolate a sequential file to a mirror pair
In a two disk RAID 1 system, the first disk is the primary disk and the second
disk acts as the parity, or mirror disk. The role of the parity disk is to keep an
exact synchronous copy of all the information stored on the primary disk. If
the primary disk fails, the information can be retrieved from the parity disk.

Be sure that your disks are able to be hot swapped so repairs can be made
without bringing down the system. Remember that there is a performance
penalty during the resynchronization period of the disks.

On a read, the disk that has its read/write heads positioned closer to the data
will retrieve information. This data retrieval technique is known as an
optimistic read. An optimistic read can provide a maximum of 15 percent
improvement in performance over a conventional disk. When setting up
mirrors, it is important to consider which physical disks are being used for
primary and parity information, and to balance the I/O across physical disks
rather than logical disks.

 RAID 10 or 1+0 — RAID 10 has the following characteristics:


 High reliability — Provides mirroring and striping
 High performance — Good for randomized reads and writes.
 Low cost — No more expensive than RAID 1 mirroring
RAID 10 resolves the reliability problem of striping by adding mirroring to the
equation.

 RAID 5 — RAID 5 has the following characteristics:


26
OPERATING SYSTEM (BCA-402) UNIT 4

 High reliability — Provides good failure protection


 Low performance — Performance is poor for writes due to the
parity's construction
 Absorbed state — Running in an absorbed state provides
diminished performance throughout the application because the
information must be reconstructed from parity.

Disk Structure in Operating System? with diagram?


Ans. Disk Structure in Operating System: The actual physical details of a modern
hard disk may be quite complicated. Simply, there are one or more surfaces, each of
which contains several tracks, each of which is divided into sectors.

There is one read/write head for every surface of the disk. Also, the same track on all
surfaces is known as a cylinder, When talking about movement of the read/write
head, the cylinder is a useful concept, because all the heads (one for each surface),
move in and out of the disk together.

We say that the “read/write head is at cylinder #2", when we mean that the top
read/write head is at track #2 of the top surface, the next head is at track #2 of the
next surface, the third head is at track #2 of the third surface, etc.

The unit of information transfer is the sector (though often whole tracks may be read
and written, depending on the hardware). As far as most file-systems are concerned,
though, the sectors are what matter. In fact, we usually talk about a 'block device'. A
block often corresponds to a sector, though it need not do, several sectors may be
aggregated to form a single logical block.

Disk capacity
27
OPERATING SYSTEM (BCA-402) UNIT 4

Alternatively referred to as disk space, disk storage, or storage capacity, disk


capacity is the maximum amount of data a disc, disk, or drive is capable holding.
Disk capacity is displayed in MB (megabytes), GB (gigabytes), or TB (terabytes).
All types of media capable of storing information have a disk capacity, including a
CD, DVD, floppy disk, hard drive, memory stick/card, and USB thumb drive.

EXAMPLE TO CALCULATE DISK CAPACITY


Problem-01:
Consider a disk pack with the following specifications- 16 surfaces, 128 tracks per
surface, 256 sectors per track and 512 bytes per sector. What is the capacity of disk
pack?

Solution-
Given-

 Number of surfaces = 16
 Number of tracks per surface = 128
 Number of sectors per track = 256
 Number of bytes per sector = 512 bytes

Capacity of disk pack

= Total number of surfaces x Number of tracks per surface x Number of sectors per
track x Number of bytes per sector

= 16 x 128 x 256 x 512 bytes

= 228 bytes

= 256 MB

28
OPERATING SYSTEM (BCA-402) UNIT 4

Swap-Space Management in Operating System


A computer has a sufficient amount of physical memory, but we need more, so we
swap some memory on disk most of the time. Swap space is a space on a hard disk
that is a substitute for physical memory. It is used as virtual memory, which contains
process memory images. Whenever our computer runs short of physical memory, it
uses its virtual memory and stores information in memory on a disk.

This interchange of data between virtual memory and real memory is called
swapping and space on disk as swap space. Swap space helps the computer's
operating system pretend that it has more RAM than it actually has. It is also called a
swap file.

Virtual memory is a combination of RAM and disk space that running processes can
use. Swap space is the portion of virtual memory on the hard disk, used when
RAM is full. Swap space can be useful to computers in the following various ways,
such as:

 It can be used as a single contiguous memory which reduces I/O operations to


read or write a file.
 Applications that are not used or less used can be kept in a swap file.
 Having sufficient swap files helps the system keep some physical memory free
all the time.
 The space in physical memory that has been freed due to swap space can be
used by OS for other important tasks.

Operating systems such as Windows, Linux, etc. systems provide a certain amount of
swap space by default which users can change according to their needs. If you don't
want to use virtual memory, you can easily disable it together. Still, if you run out of
memory, then the kernel will kill some of the processes to create a sufficient amount
of space in physical memory so that it totally depends upon the user whether he
wants to use swap space or not.

What is Swap-Space Management?

Swap-space management is another low-level task of the operating system. Virtual


memory uses disk space as an extension of main memory. Since disk access is much
slower than memory access, using swap space significantly decreases system

29
OPERATING SYSTEM (BCA-402) UNIT 4

performance. The main goal for the design and implementation of swap space is to
provide the best throughput for the virtual memory system.

Swap space is used in various ways by different operating systems, depending on the
memory-management algorithms in use. For example, systems that implement
swapping may use swap space to hold an entire process image, including the code
and data segments. Paging systems may simply store pages that have been pushed
out of the main memory. The amount of swap space needed on a system can vary
depending on the amount of physical memory, the amount of virtual memory it is
backing, and how it is used. It can range from a few megabytes of disk space to
gigabytes.

Note that it may be 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
processes or may crash entirely. Overestimation wastes disk space that could
otherwise be used for files, but it does no other harm. Some systems recommend the
amount to be set aside for swap space. Solaris, for example, suggests setting swap
space equal to the amount by which virtual memory exceeds page-able physical
memory. Previously, Linux suggested setting swap space to double the amount of
physical memory, although most Linux systems now use considerably less swap
space. There is currently much debate in the Linux community about whether to set
aside swap space at all.

Some operating systems, including Linux, allow multiple swap spaces. These swap
spaces are usually put on separate disks so the load placed on the I/O system by
paging and swapping can be spread over the system's I/O devices.

Uses of Swap Space

The different operating system uses Swap-space in various ways. The systems that
are implementing swapping may use swap space to hold the entire process, including
image, code, and data segments.

 Swapping is a memory management technique used in multi-programming to


increase the number of processes sharing the CPU. It is a technique of
removing a process from the main memory, storing it into secondary memory,
and then bringing it back into the main memory for continued execution. This
action of moving a process out from main memory to secondary memory is

30
OPERATING SYSTEM (BCA-402) UNIT 4

called Swap Out. The action of moving a process out from secondary memory
to main memory is called Swap In.
 Paging systems may simply store pages that have been pushed out of the main
memory. The need for swap space on a system can vary from megabytes to
gigabytes. Still, it also depends on the amount of physical memory, the virtual
memory it is backing, and how it uses 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 be used for files, but
it does not harm others.

31

You might also like