0% found this document useful (0 votes)
11 views

Unit 5

Unit 5 of the IT Operating System notes covers I/O systems, detailing the categories of I/O devices, their differences, and the hardware involved in I/O operations. It discusses various I/O techniques such as polling, interrupts, and Direct Memory Access (DMA), along with the kernel I/O subsystem's functions like scheduling and buffering. Additionally, it addresses the characteristics of I/O devices and the concept of stable storage for data integrity.

Uploaded by

nctitacademic
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)
11 views

Unit 5

Unit 5 of the IT Operating System notes covers I/O systems, detailing the categories of I/O devices, their differences, and the hardware involved in I/O operations. It discusses various I/O techniques such as polling, interrupts, and Direct Memory Access (DMA), along with the kernel I/O subsystem's functions like scheduling and buffering. Additionally, it addresses the characteristics of I/O devices and the concept of stable storage for data integrity.

Uploaded by

nctitacademic
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

T.

Krishnakumar Lecture/IT Operating System Notes Unit


1 5

Unit 5
I/O Systems:
Overview of I/O Systems:
Categories of I/O Devices are
 Storage Devices Or Machine Readable:
It is suitable for communicating with electronic equipment.Such as Disks and Tapes.
 Transmission Devices or Communication:
It is suitable with communicating with remote devices.Such as Network Card and
Modems.
 Human Interface Devices:
It is suitable with communicating with the computer user.Such as Screen, Keyboard
and Mouse.
Difference between I/O Devices:
 Data rate:There may be differences of several orders of size (Magnitude) between
the data transfer rates.
 Application:Different devices have different use in the system
 Complexity of control:A disk is much more complex whereas printer requires simple
control interfaces.
 Unit if transfer:Data may be transferred as a stream of bytes or characters or in
larger block
 Data representation:Different data encoding schemes are used for different devices.
 Error Conditions: The nature of errors differs widely from one device to another
device.
I/O Hardware:
A device is communicated along with a system by passing the signals through a cable or by
air, port or bus.
A connection point or port is used to communicate the device with the machine.
Example: Serial Port.
Given Below the Figure: Typical Structure of PCI bus:
Bus: If one or more devices use a common set of wires, the connection is called as bus.
PC Bus System: It is used to connect the processor memory subsystem to the fast
devices.Here an expansion bus is used to connect the slow devices like keyboard, serial and
parallel ports. With the SCSI bus, four disks are connected and this is plugged into the SCSI
controller.
T.Krishnakumar Lecture/IT Operating System Notes Unit
2 5

Controller: It is a collection of electronics that can operate a port, bus or a device.


Serial Port Controller: It is a simple device. This is a single chip in the computer that
controls the signals on the wires of the serial port.
SCSI Bus Controller:
This is not like the serial port controller.Because the SCSI protocol is difficult to proceed.
This SCSI bus controller is used as a separate circuit board which plugs into the system.
Memory Mapped I/O: It to control others
Device I/O Port Location on PCs:

The I/O port consists of four registers:


 Status Register: It has the bits which can be read by the host.
T.Krishnakumar Lecture/IT Operating System Notes Unit
3 5

 Control Register: This can be used by a host for starting a command or change the
device made.
 Data-in Register: It is read by the host to get input.
 Data-out Register: It is written by the host to send output.
1. Polling:
The processors inform the operating system of events such as program execution or changes
in devices.A processor can do so by repeatedly requesting the status of each device, a
technique called polling or also called as busy waiting.
Hand shaking:
The interaction between the host and the controller can be done using hand shaking concept.
This can be done the following steps. They are:
i. The busy bit is read by the host repeatedly until is cleared.
ii. The host sets the write bit in the command register and writes a byte into the data out
register.
iii. If the command bit ready is set sets the busy bit.
iv. The controller also reads the command register and it looks the write command.
It reads the data out register to have the byte and it does the I/O to the devices.
v. To represent the I/O is successfully completed, the controller
 Clears the command ready bit
 Clears the error bit in the status register
 Clears the busy bit
This loop is repeated for each byte.
2. Interrupts:
The CPU hardware has a wire called the interrupt request line which is sensed by the CPU at
the end of the execution of every instruction.
When the CPU detects that controller has open a signal on the interrupt request wire, the CPU
saves the current state and jumps to the interrupt- handler routine at a fixed addresses in
memory.
The interrupt handler defines the reason of the interrupt, performs the necessary processing
and execution a return from interrupt instruction to return the CPU to the execution earlier to
the interrupt.
T.Krishnakumar Lecture/IT Operating System Notes Unit
4 5

CPU has two interrupt request causes:


 Non maskable interrupt:
Which is reserved for events such as unrecoverable memory errors.
 Maskable Interrupt:
It can be turned off by the CPU before the execution of critical instruction sequences
that must not be interrupted.
Interrupt Vector:
It contains the memory addresses of specialized interrupt handles.
The purpose of the vectored interrupt mechanism is to reduce the need for a single interrupt
handler to search all possible sources of interrupts to determine which one needs service.
The events 0 – 31 are non-maskable
32 – 255 are maskable
The interrupt mechanism is also used to handle wide variety of exceptions, such as dividing
by zero, accessing a protected or non-existent memory address or attempting to execute
confidential instruction from user mode.
In an given below, the following table shows the interrupt vector for Intel Pentium Processor
T.Krishnakumar Lecture/IT Operating System Notes Unit
5 5

3. DMA (Direct Memory Access):


Most I/O operations transfer data between main memory and I/O device.
In the early computers, this was done by using programmed I/O.
Programmed I/O (PIO):
It specifies a byte or word to be transferred between main memory and I/O device then waits
slowly for the operation to complete.
This focused to wasting a major number of processor cycles while waiting for PIO operations
to complete.
So many systems avoid burdening the main CPU with PIO by dropping some of this work to
a special purpose processor known as direct memory access controller.
DMA Mode of data transfer:
This is mode of data transfer in which IO is performed in large data blocks.
The direct memory access confirmed access to main memory without processor interruption
or support.
Such independence from processor makes this mode of transfer extremely efficient.
DMS Transfer:
The host writes a DMA command block into memory inorder to start the DMA transfer
Actually this block is consisting of
A pointer to the source of transfer
A pointer to the destination
T.Krishnakumar Lecture/IT Operating System Notes Unit
6 5

Number of bytes to be transmitted


The CPU writes this command block address to the DMA controller.
The DMA controller keeps the addresses on the bus to do data transfer without getting any
help form the main CPU.
DMA Controller:
It is a standard component in the system and bus mastering I/O boards for the system which
has their own high speed DMA hardware.
Six Step Process to Perform DMA Transfer

Figure: DMA data transfer Steps


DMA Request and Acknowledge:
These two are the pair of wires which are used in the handshaking between the DMA
controller and the device controller.
When a word of data is there for data transfer, the device controller keeps a signal on the
DMA request wire.
It makes the DMA controller to seize the memory bus inorder to keep the required address on
the memory address wires.
This is also for placing a signal on the DMA acknowledges wire.
At the time of getting the DMA acknowledge signal by a device controller, it transfers the
CPU, the word of data to memory.
The DMA request signal is also removed.
T.Krishnakumar Lecture/IT Operating System Notes Unit
7 5

If the data transfer is wholly completed then the DMA controller interrupts the CPU.
The system performance can be achieved by unloading the data transfer work to a DMA
controller.
Direct Virtual Memory Access (DVMA):
It uses virtual addresses which perform virtual to physical memory address translation.
The data transfer is done in-between the two memory mapped devices by the DVMA without
getting any help from the CPU or main memory.
___________________________________________________________________________
Application I/O Interface:

I/O management requires that a proper setup is created by an application on a computer


system with an IO device.
An IO operation is a combination of hardware and software instructions.
After the IO command is given in a process, the operating system kernel resolves it and then
communicates with the concerned device driver.
Devices vary in many dimensions
 Character-stream or block:
A character stream device transfers bytes one by one, whereas a block device transfers
a block of bytes as a unit.
T.Krishnakumar Lecture/IT Operating System Notes Unit
8 5

 Sequential or random-access:
A sequential device transfer data in a fixed order determined by the device, whereas
the user of a random access device can instruct the device to search for to any of the
available data storage locations.
 Synchronous or Asynchronous:
A synchronous device is one that performs data transfer with predictable response
times.An asynchronous device exhibits irregular or unpredictable response time.
 Sharable or dedicated;
A sharable device can be used concurrently by several processes or threads; a
dedicated device cannot.
 Speed of operation:
Device speeds range from a few bytes per second to a few gigabytes per second.
 read-write, read only, or write only:
Some devices perform both input and output, but others support only one data
direction.
Charactertics of IO devices:

1. Block and Character Devices:


Block devices include disk drives
 Commands include read, write, seek
 Raw I/O or file-system access
 Memory-mapped file access possible
T.Krishnakumar Lecture/IT Operating System Notes Unit
9 5

Character devices include keyboards, mice, serial ports


 Commands include get, put
 Libraries layered on top allow line editing
2. Network Devices:
Varying enough from block and character to have own interface
UNIX and Windows NT/9x/2000 include socket interface
 Separates network protocol from network operation
 Includes select functionality
Approaches vary widely (pipes, FIFOs, streams, queues, mailboxes)
3. Clocks and Timers:
 Provide current time, elapsed time, timer
 Programmable interval timer used for timings, periodic interrupts
 ioctl (on UNIX) covers odd aspects of I/O such as clocks and timers
4. Blocking and Non-Blocking I/O:
Blocking - process suspended until I/O completed
 Easy to use and understand
 Insufficient for some needs
Non-blocking - I/O call returns as much as available
 User interface, data copy (buffered I/O)
 Implemented via multi-threading
 Returns quickly with count of bytes read or written
Asynchronous - process runs while I/O executes
 Difficult to use
 I/O subsystem signals process when I/O completed

__________________________________________________________________________

Kernel I/O Subsystem:


T.Krishnakumar Lecture/IT Operating System Notes Unit
10 5

This is the innermost layer of the operating system close to the hardware and controlling the
actual hardware.
It is the heart of the operating system.
Kernel I/O subsystem provides following services:
 Scheduling
 Buffering
 Caching
 Spooling andDevice reservation
 Error Handling
I/O Scheduling:
It is a process in which a good order is found to execute the set of I/O requests.
Generally scheduling
Can increases the overall system performance
Can share the device access fairly below the operation.
May minimize the average waiting time for I/O to complete.
Operating system developers implement scheduling by maintaining a queue of request for
each device.
When an application issues a blocking I/O system call, the request is placed on the queue for
that device.
The I/O scheduler rearranges the order of the queue to improve the overall efficiency and the
average response time.
Buffering:
It is a technique by which the device manager can keep slower I/O devices busy during times
when a process is not demanding I/O operations.
Reasons for Buffering:
1. Speed mismatch in between the producer and consumer of a data stream.
Example:
A file has to be obtained through a modem for storage on the hard disk.
But the modem is 100 times slower than hard disk.
i.e... Why a buffer is introduces to have the bytes which come from the modem.

Process
T.Krishnakumar Lecture/IT Operating System Notes Unit
11 5

Double Buffering:
There are two buffers in the system.
One buffer is for the driver or controller to store data while waiting for it to be
retrieved by higher level of the hierarchy.
Other buffer is to store data from the lower level module
It is also called as buffer swapping

Process

A B

A B

Device
2. The second reason for buffering is to adapt between the devices which holds different
data transfer size.
T.Krishnakumar Lecture/IT Operating System Notes Unit
12 5

This is mostly used in case of computer networking for the purpose of fragmentation
and reassembly of messages.
So a large message splitted into smaller fragments at the sender side.
Then these are passed through the communication network.
3. Buffering is needed for supporting the copy semantics for application I/O.
A simple strategy for copy semantics is for the write ( ) system call inorder to copy
the application data within the kernel buffer before returning the control to
application.
Caching:
To improve the performance, most systems perform caching by placing copies of information
that processes location in faster storage.
Due to the high cost of fast storage, caches can contain only a small portion of the
information contained in slower storage.
Caches can contain only a small portion of the information contained in slower storage.
Spooling and Device reservation:
It is a technique in which an intermediate device like a disk, it is cut in between a process and
a low speed or buffer limited I/O device.
Error Handling:
Generally the device and I/O transfers may fair in many ways.
They are
 Transmit reasons: Example: Network becoming overloaded
 Permanent reasons: Example: a disk controller becoming effective.
Operating system can frequently compensate effectively for temporary failure.

Stream:
T.Krishnakumar Lecture/IT Operating System Notes Unit
13 5

It is a full-duplex communication channel between a user-level process and a device in Unix


System V and beyond
A Steam consists of:
 Stream head interfaces with the user process
 Driver end interfaces with the device
 Zero or more stream modules between them

Each module contains a read and a write queue.


Message passing is used to communicate between queues.
The stream structure is showing above:
Modules provide the functionality of streams processing and they are pushed onto a stream
using the ioctl ( ) system call.
For example: A process can open a serial port device via stream, and can push on a module to
handle input editing.
Because messages are exchanged between queues in adjacent modules, a queue in one
module may overflow and adjacent queue.
A queue supporting flow control buffers messages and does not accept messages without
sufficient buffer space.
Flow control is supported by exchanging control messages between queues in adjacent
modules.
The write () or putmsg (): This is used to writes data to a device by a user process.
T.Krishnakumar Lecture/IT Operating System Notes Unit
14 5

Write ( ): It writes raw data to the stream


Putmsg ( ): It permits the user process to represent a message.
Read ( ) or getmsg ( ): These are used to read the data from stream head.
Read ( ): From the adjacent queue, the stream head have a message and the ordinary data is
required to the process.
getmsg ( ): The message is returned to the process.
When the user process communicates with the stream head, the stream I/O is asynchronous
with the execution.
Use of Stream:
It gives a framework to a modular and incremental approach to write the device drivers and
network protocols.
___________________________________________________________________________
Stable-Storage:
Stable storage device never lost the information.
To implement stable storage:
Replicate information on more than one storage devices with independent failure modes
A disk writes resulting one of three outcomes.
Successful completion: The data were written correctly on disk.
Partial Failure: Here some of the sectors are provided with new data but the sector
which was written when failure occurred, have been corrupted.
Total Failure: The failure occurred before the disk write started, so the previous data
values on the disk remain intact.
Whenever a failure occurs during writing of a block, the system detects it and invokes a
recovery procedure to restore the block a consistent state.
The system must maintain two physical blocks for each logical block.
An output operation is executed as follows:
1. Write information onto the first physical block.
2. When the first write completes successfully, write the same information onto the
second physical block.
3. Declare the operation complete only after the second write completes successfully.
During recovery from a failure, each pair of physical block is examined.
___________________________________________________________________________

Tertiary Storage Devices:


T.Krishnakumar Lecture/IT Operating System Notes Unit
15 5

Low cost is the defining characteristic of tertiary storage. Generally, tertiary storage is built
using removable media. Common examples of removable media are floppy disks and CD-
ROMs; other types are available.
1. Removable Disks
Floppy disk — thin flexible disk coated with magnetic material, enclosed in a
protective plastic case.
Most floppies hold about 1 MB; similar technology is used for removable disks that
hold more than 1 GB.
Removable magnetic disks can be nearly as fast as hard disks, but they are at a greater
risk of damage from exposure.
A magneto-optic disk records data on a rigid platter coated with magnetic material.
 Laser heat is used to amplify a large, weak magnetic field to record a bit.
 Laser light is also used to read data (Kerr effect).
 The magneto-optic head flies much farther from the disk surface than a
magnetic disk head, and the magnetic material is covered with a protective
layer of plastic or glass; resistant to head crashes.
Optical disks do not use magnetism; they employ special materials that are altered by
laser light.
2. WORM Disks
The data on read-write disks can be modified over and over.
WORM (“Write Once, Read Many Times”) disks can be written only once.
Thin aluminum film sandwiched between two glass or plastic platters.
To write a bit, the drive uses a laser light to burn a small hole through the aluminum;
information can be destroyed by not altered.
Very durable and reliable.
Read only disks, such as CD-ROM and DVD, com from the factory with the data pre-
recorded.
3. Tapes
Compared to a disk, a tape is less expensive and holds more data, but random access
is much slower.
Tape is an economical medium for purposes that do not require fast random access,
e.g., backup copies of disk data, holding huge volumes of data.
Large tape installations typically use robotic tape changers that move tapes between
tape drives and storage slots in a tape library.
T.Krishnakumar Lecture/IT Operating System Notes Unit
16 5

Stacker – library that holds a few tapes


Silo – library that holds thousands of tapes
A disk-resident file can be archived to tape for low cost storage; the computer can
stage it back into disk storage for active use.
___________________________________________________________________________
Disk Attachment:
Computer access disk storage in two ways:
 Host attached storage
 Network attached storage
1. Host attached storage
It is accessed via local I/O ports.
1. These ports are available in several technologies
The desktop PC uses an I/O bus architecture called IDE or ATA.
The architecture supports maximum of the two drives per I/O bus.
Normally two I/O architectures used such as SCSI and Fibre channel (FC).
SCSI: It is bus architecture. Its physical medium is usually a ribbon cable having a
large number of conductors.
The SCSI protocol supports a maximum of 16 devices on the bus.
Fiber Channel: It is high speed serial architecture.
This architecture can operate over optical fiber or over a 4 – conductor copper cable.
It has two variants:
Storage area networks and arbitrated loop
A wide variety of storage devices are suitable for use as host attached storage.
Among these are hard disk drives, RAID arrays, and CD, DVD and tape drivers.
The I/O commands that initiate data transfers to a host attached storage device are
reads and writes of logical data blocks, directed to specifically identified storage units.
2. Network attached storage:
Network-attached storage (NAS) is storage made available over a network rather than
over a local connection (such as a bus)
T.Krishnakumar Lecture/IT Operating System Notes Unit
17 5

By using a remote procedure call interfaces like NFS and UNIX systems, the clients
gets the access of network attached storage.
But, the remote procedure calls are used through a TCP or UDP across the IP
network.
The network attached storage is implemented as a RAID array with the software
which implements the RPC interface.
Advantages:
 It is easy to share a pool of storage.
Disadvantages:
 Less efficient
 Lower performance
 Increased possible of communication. Because it consume bandwidth on the
data network.
3. Storage Area Network:
It is a private network in between the servers and storage units.
Also this is separate from the LAN or WAN
More number of hosts and storage arrays can be connected with a same SAN.
Also the storage is allocated dynamically to hosts.
Example: when a host is running low on disk space, in order to provide more storage to that
host, the storage area N/W can be arranged.

___________________________________________________________________________
T.Krishnakumar Lecture/IT Operating System Notes Unit
18 5

Disk Management:
Operating system is responsible for disk management.
Following are some activities discussed.
Disk Formatting:
1. Low-level formatting, or physical formatting:
Disk must be formatted before storing a disk.
Dividing a disk into sectors that the disk controller can read and write
Low level formatting files the disk with a special data structure for each sector.
Data structures consist of three fields:
 Header
 Data Area
 Trailer
Header and trailer contain information used by the disk controller.
Sector number and Error Correcting Codes (ECC) contained in the Header and Trailer
For writing data to the sector – ECC is updated.
For reading data from the sector – ECC is recalculated
If there is mismatch in stored and calculated value then data area is corrupted.
Low level formatting is done at factory.
2. Logical formatting or “making a file system”.
After disk is partitioned, logical formatting used
Operating system stores the initial file system data structures onto the disk.
Boot Block:
The system requires an initial program to begin its running.
Example: when the computer system is powered up or rebooted, it needs a program
This program should be very simple.
Problem-solving check is done first
Stage 0 boot program is executed
Boot program reads the first sector form the boot device into main memory.
Boot sector is the first sector of the boot device and contains stage 1 boot program.
May be boot sector will not contain a boot program.
PC booting from hard disk, the boot sector also contains a partition table
The code in the boor ROM instructs the disk controller to read the boot blocks into memory
and then starts executing that code.
Full boot strap program is more sophisticated than the bootstrap loader in the boot ROM.
T.Krishnakumar Lecture/IT Operating System Notes Unit
19 5

Bad blocks:
Data that resided on the bad blocks usually are lost.
The controller maintains a list of bad blocks on the disk.
The list is initialized during the low level format at the factory, and is updated over the life of
the disk.
Low level formatting also sets aside spare sectors not visible to the operating system.
The controller can be told to replace each bad sector logically with one of the spare sectors.
This scheme is known as sector sparing or forwarding
A typical bad sector transaction might be as follows;
The OS tries to read logical block 90
The controller calculates the ECC and finds that the sector is bad. It reports this finding to the
OS
The next time that the system is rebooted, a special command is run to tell the SCSI
controller to replace the bad sector with a spare
After that whether the system requests the logical block 90, the request is translated into the
replacement sectors address by the controller.
___________________________________________________________________________

Swap-Space Management:
T.Krishnakumar Lecture/IT Operating System Notes Unit
20 5

It is the low level task of the operating system.


The main goal for the design and implementation of swap space is to provide the best
throughput for the virtual memory system.
Swap Space use:
The OS needs to release sufficient main memory to bring in a process that is ready to execute.
OS uses this swap space in various ways
Paging system may simply store pages that have been pushed out of main memory.
UNIX OS allows the use of multiple swap spaces.
These swap space are usually put on separate disks, so the load placed on the I/O system by
paging and swapping can be spread over the systems I/O devices
Swap Space Location:
Swap space can reside in two places
1. Separate disk partition
2. Normal file system
If the swap space is simply a large file within the file system, normal file system routines can
be used to create it, name it and allocate its space. This is easy to implement but also
inefficient. External fragmentation can greatly increases swapping times. Catching is used to
improve the system performance. Block of information is cached in the physical memory,
and by using special tools to allocate physically contiguous blocks for the swap file.

Swap space can be created in a separate disk partition. No file system or directory structure is
placed on this space. A separate swap space storage manager is used to allocate and
deallocate the blocks. This manager uses algorithms optimized for speed.
Internal fragmentation may increase. Some OS are flexible and can swap both in raw
partition and in file system space. Solaris 2 is an example

Swap-space management
1. 4.3BSD allocates swap space when process starts; holds text segment (the
program) and data segment.
2. Kernel uses swap maps to track swap-space use.
3. Solaris 2 allocates swap space only when a page is forced out of physical memory,
not when the virtual memory page is first created.

4.3 BSD Text-Segment Swap Map 3


T.Krishnakumar Lecture/IT Operating System Notes Unit
21 5

4.3 BSD Data-Segment Swap Map

__
________________________________________________________________________
T.Krishnakumar Lecture/IT Operating System Notes Unit
22 5

RAID:
Redundant Array of Inexpensive (or "Independent") Disks is a series (RAID0 to
RAID5) of increasing reliable and expensive ways of organising multiple physical hard disks
into groups ("arrays") that work as a single logical disk.
Each logical drive appears to the operating system as a single physical drive, thanks to the
efforts of the RAID controller.
There are hardware and software RAID controllers, but the software version adds pressure to
the CPU and is slower than a hardware controller.

RAID comes in several flavors, levels zero through five (if you want to get particular, there
are others: 0, 1, 2, 3, 4, 5)
Different flavours let you choose between performance, protection, and storage capacity.

A hot-spare drive is a hard disk drive in a server that is defined for automatic use in the
event of a drive failure.
If a drive fails, the system can automatically switch to the hot-spare drive, and the data from
the dead drive is reconstructed on the hot-spare drive.

Each level is optimized for various capabilities, including improved performance of read or
writeoperations, and improved data availability through redundant copies or parity
(consistency) checking.
Features of different RAID levels can be combined to get the benefits of both.

"Parity", mentioned below, is an error-checking feature:


When the data is saved, a special calculation based on the contents of the data is made and
saved with the data.
When data is later loaded, the calculation is made again and compared to the saved result.
If they are different, it is anindication that the data has become corrupted and recovery
methods can be taken.
RAID-0:
It is a high-performance/low-availability level.
It provides basic disk striping without parity protection to catch errors, so while throughput is
high, no redundancy is provided.
It is relatively inexpensive.
T.Krishnakumar Lecture/IT Operating System Notes Unit
23 5

If one disk in the array happens to fail, all data in the array is unavailable.
Striping spreads data across each disk in the array for improved performance.

STRIPING
Striping is the practice of spreading data over multiple disk drives.
It allows greater performance because drives can find and deliver data simultaneously, rather
than one drive having to do all the work by itself.

Stripe 00 Stripe 01 Stripe 02 Stripe 03


Stripe 04 Stripe 05 Stripe 06 Stripe 07
Stripe 08 Stripe 09 Stripe 10 Stripe 11

RAID-0 REPORT CARD

There are significant performance advantages over a single disk. -


Multiple reads or writes are done simultaneously with multiple disks,
Performance best
rather than a read or write to a single disk. Reads/writes are
overlapped across all disks.

If one disk fails, all data is lost, and all disks must be reformatted.
Protection Poor Data could be restored across the array from a tape or diskette backup,
if available.

Where N is the number of disks, the capacity is N. RAID 0 writes


Capacity N blocks of data to each drive in the array. It cannot be extended once it
is full.

RAID-1:
It is a disk-mirroring strategy for high performance.
All data is written twice to separate drives. The cost per megabyte of storage is higher, of
course, but if one drive fails, normal operations can continue with the duplicate data.
If the RAID device permits hot-swapping of drives, the bad drive can be replaced without
interruption.
T.Krishnakumar Lecture/IT Operating System Notes Unit
24 5

Mirroring and Duplexing: Disk mirroring duplicates the data from one disk onto a second
disk using a single disk controller. Disk duplexing is the same as mirroring, except that the
disks are attached to separate disk controllers, such as two SCSI adapters.

Stripe 00 Stripe 01 Stripe 02 Stripe 03


Stripe 04 Stripe 05 Stripe 06 Stripe 07
Stripe 08 Stripe 09 Stripe 10 Stripe 11

Stripe 00 Stripe 01 Stripe 02 Stripe 03


Stripe 04 Stripe 05 Stripe 06 Stripe 07
Stripe 08 Stripe 09 Stripe 10 Stripe 11

RAID-1 REPORT CARD

Write performance is somewhat reduced, because both drives in


the mirrored pair must complete the write operation. A read
Performance good request can be handled by either disk. The drive in the pair that is
less busy is issued the read command, leaving the other drive to
perform another read operation.

If either disk fails, a copy of the data is still available on the other
Protection good disk. - If a disk controller fails while duplexing, the data can still
be accessed through the other controller and disk.

Capacity N/2 Where N is the number of disks, the capacity is N divided by 2.


RAID-2:
It performs disk striping at the bit level and uses one or more disks to store parity
information. RAID-2 is not used very often because it is considered to be slow and
expensive.
Bit interleaves data striping with hamming code.
Fast for sequential applications such as graphics modeling.
Almost never used with PC-based systems
T.Krishnakumar Lecture/IT Operating System Notes Unit
25 5

Disk 1 Disk 2 Disk 3 Disk 4 Parity 1 Parity 2 Parity 3

Data Disks- stores data strips Parity Disk- stores parity strips
RAID-3:
It uses data striping, generally at the byte level and uses one disk to store parity information.
Striping improves the throughput of the system, and using only one disk per set for parity
information reduces the cost per megabyte of storage.
Striping data in small chunks provides excellent performance when transferring large
amounts of data, because all disks operate in parallel.
Two disks must fail within a set before data would become unavailable.
Bit interleave data striping with parity - Access to all drives to retrieve on record - Best for
large sequential reads - Poor for random transactions - Faster than a single disk but
significantly slower than RAID 0 or RAID 1 in random environments

Disk 1 Disk 2 Disk 3 Disk 4 Parity 1

RAID-4:
Itstripes data in larger chunks, which provides better performance than RAID-3 when
transferring small amounts of data. Block interleave data striping with one parity disk - Best
for large sequential I/O, but poor write performance-Faster than a single drive but
significantly slower than RAID 0 or RAID 1.

Stripe 00 Stripe 01 Stripe 02 Stripe 03 Stripe 00-03


Stripe 04 Stripe 05 Stripe 06 Stripe 07 Stripe 04-07
Stripe 08 Stripe 09 Stripe 10 Stripe 11 Stripe 08-11
T.Krishnakumar Lecture/IT Operating System Notes Unit
26 5

RAID-5:
Itstripes data in blocks sequentially across all disks in an array and writes parity data on all
disks as well.
By distributing parity information across all disks, RAID-5 eliminates the bottleneck
sometimes created by a single parity disk.
RAID-5 is increasingly popular and is well suited to transaction environments.

stripe 00 stripe 01 stripe 02 stripe 03 parity 0-3


stripe 04 Stripe 05 stripe 06 parity 4-7 stripe07
stripe 08 Stripe 09 parity8-11 stripe 10 stripe11
stripe 12 parit12-15 stripe 13 stripe 14 stripe15
RAID-5 REPORT CARD

RAID 5 is preferred for smaller block transfers. Typically


Performance good
smaller block transfers are used in network files.

If any disk fails, the data can be recovered by using the data
Protection Good
from the other disks along with the parity information.

Capacity N-1 Where N is the number of disks, the capacity is N minus 1.


RAID can be high-speed because the separate hard disks can all work at once: e.g. instead of
a single hard disk sending 5 chunks one at a time, all 5 hard disks could send one chunk
simultaneously, making data retrieval far faster.
RAID 5 combines striping with RAID1's mirroring so the array of hard disks not only has the
data sprinkled across them, but there are matching disks maintaining an exact copy of the first
disks.
RAID 5 yields the lowest I/O throughout of the three RAID strategies because of the
additional checksum calculation and write operations required.
In general, I/O throughput with RAID 5 is 30 to 50 percent lower than with RAID 1.
Also RAID 5, with its controller, usually costs more to implement than Hybrid RAID1.
RAID5 requires one parity unit per stripe.
RAID 5 stripes data across all disks at the same time.
T.Krishnakumar Lecture/IT Operating System Notes Unit
27 5

Parity is interleaved with data information rather than stored on a dedicated drive
RAID 5E:
It uses a distributed hot spare disk, so it works with a minimum of four disks. Protection: very
good.
Capacity: N-2.
Where N is the number of disks, the capacity is N-2 (one for parity and one for spare).
Spanned Arrays (RAID x0):
Spanned arrays (or composite RAID levels) are RAID arrays that are joined together to form
larger RAID arrays.
T.Krishnakumar Lecture/IT Operating System Notes Unit
28 5

Disk Scheduling
1. The operating system is responsible for using hardware efficiently — for the disk
drives, this means having a fast access time and disk bandwidth.
2. Access time has two major components
 Seek time is the time for the disk are to move the heads to the cylinder containing
the desired sector.
 Rotational latency is the additional time waiting for the disk to rotate the desired
sector to the disk head.
3. Minimize seek time
4. Seek time seek distance
5. 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.
6. Several algorithms exist to schedule the servicing of disk I/O requests.
7. We illustrate them with a request queue (0-199).
Example: 98, 183, 37, 122, 14, 124, 65, 67. Head pointer 53
FCFS
Illustration shows total head movement of 640 cylinders.

SSTF
1. Selects the request with the minimum seek time from the current head position.
2. SSTF scheduling is a form of SJF scheduling; may cause starvation of some requests.
3. Illustration shows total head movement of 236 cylinders.
T.Krishnakumar Lecture/IT Operating System Notes Unit
29 5

SCAN
1. 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.
2. Sometimes called the elevator algorithm.
3. Illustration shows total head movement of 208 cylinders.
T.Krishnakumar Lecture/IT Operating System Notes Unit
30 5

C-SCAN
1. Provides a more uniform wait time than SCAN.
2. 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.
3. Treats the cylinders as a circular list that wraps around from the last cylinder to the first
one.

C-LOOK
1. Version of C-SCAN
2. 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.
T.Krishnakumar Lecture/IT Operating System Notes Unit
31 5

Selecting a Disk-Scheduling Algorithm


1. SSTF is common and has a natural appeal
2. SCAN and C-SCAN perform better for systems that place a heavy load on the disk.
3. Performance depends on the number and types of requests.
4. Requests for disk service can be influenced by the file-allocation method.
5. 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.
6. Either SSTF or LOOK is a reasonable choice for the default algorithm.
___________________________________________________________________________

You might also like