OS Unit 4 BCA-402
OS Unit 4 BCA-402
1
OPERATING SYSTEM (BCA-402) UNIT 4
2
OPERATING SYSTEM (BCA-402) UNIT 4
4
OPERATING SYSTEM (BCA-402) UNIT 4
5
OPERATING SYSTEM (BCA-402) UNIT 4
7
OPERATING SYSTEM (BCA-402) UNIT 4
8
OPERATING SYSTEM (BCA-402) UNIT 4
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
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.
10
OPERATING SYSTEM (BCA-402) UNIT 4
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
➢ Advantages :
More efficient than FCFS.
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.
15
OPERATING SYSTEM (BCA-402) UNIT 4
16
OPERATING SYSTEM (BCA-402) UNIT 4
➢ 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
18
OPERATING SYSTEM (BCA-402) UNIT 4
➢ 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
➢ 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
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).
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:
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.
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.
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
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
= Total number of surfaces x Number of tracks per surface x Number of sectors per
track x Number of bytes per sector
= 228 bytes
= 256 MB
28
OPERATING SYSTEM (BCA-402) UNIT 4
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:
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.
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.
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.
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.
31