SlideShare uma empresa Scribd logo
1 de 195
Baixar para ler offline
Review of computer hardware
Principles of i/o hardware
Principles of i/o software
i/o software layers
Disks, clocks
Graphical user interfaceGraphical user interface
Network terminal
Power management
Files,directories,file system implementation
File system layout, implementing files
Implementing directories, shared files,
Disc space management ,examples of file system
CDROM,MSDODS,Win98,UNIX.
The control of devices connected to the computer is a
major aspect of operating system.
There is a wide variety I/O devices
These devices are vary in their function and speed.
It is difficult for any operating system to develop aIt is difficult for any operating system to develop a
general ,consistent solution for these I/O devices.
There is no single method to control these i/o devices.
Every operating system separates methods of dealing
with i/o devices from the rest of OS
Devices drives are becoming popular
Devices drivers provide standard interface between i/oDevices drivers provide standard interface between i/o
devices and OS.
A computer uses many kind of devices .These devices
can be put in three categories
1.Storage devices such as Disks ,tapes.
2.Transmission devices, such as modem ,network cards.2.Transmission devices, such as modem ,network cards.
3. Human interface devices such as screen, mouse,
keyboard, etc
I/o devices communicate with a computer system
through a port.
Devices are connected through a bus . A bus is set of
wires. Interaction through a bus is through a set of
messages.messages.
A controller is a collection of electronics circuit
That can operate a port ,a bus or a device.
I/o devices can be put in two categories
1.Block Devices
2.Character devices
Block devices:-
Blocks device stores information in fixed size blocks.
Each blocks has unique address .each blocks can be
accessed independently.eg disks ,tape ,CD
Character devices:-
A character devices accepts or delivers a stream of
character. There is no concept of blocking in a character
devices. Terminals ,printers, network interface, keyboards
etc,are character devices.etc,are character devices.
Some devices like clocks do not fit into any of the above
two categories .
Clocks simply generate interrupts at well defined intervals .
A device controller consists of electronic components.
It interact both with the device and the system bus.
Disk Printer
DiskDisk Printer
Other
controller
CPU
Disk
controller
Printer
controller
controller
Memory
bus
An OS interact with the controller and it does not
interact with the devices.
A controller has several registers for data and control
signals. The processor communicate with the controller
by reading and writing data in these registers.by reading and writing data in these registers.
Device control registers can be memory mapped or I/o
mapped.
Controller has four registers
1.Data in register
2. Data out register
3.Status Register Busy and Ready
4.Error condition.
The OS perform I/O by writing commands into theThe OS perform I/O by writing commands into the
control register
In most of the data processing activities, a program has
to accept input from the keyboards or from a
secondary storage device.
i/o operation refers to a data transfer between an i/o
device and main memory or between an i/o device anddevice and main memory or between an i/o device and
CPU.
User program never interact directly with i/o devices.
All i/o operations are performed with the help of
system calls.
Whenever a system call is made, CPU executes a small
memory resident program known as device driver or
interrupt service routine. These specialized routinesinterrupt service routine. These specialized routines
interact with an i/o device with the help of i/o
commands .
There are four types of i/o commands
1.control 2.Test status 3.Read 4.Write
A CPU is general purpose processor. it is capable of
addressing all needs of an i/o device. CPU executes a
program that intiates,directs,and terminates the i/o
operation ,the computer is said to be using programmed
i/o.i/o.
i/o device is very slow,CPU will be wasting a lot of its
time in trivial i/o operations.
Another technique, that can considerably improve CPU
performance is known as Interrupt driven Input/output.
In both programmed and interrupt driven i/o CPU is
responsible for either sending and receiving of data .
A slight increase in hardware enables an i/o device toA slight increase in hardware enables an i/o device to
transfer a block of data to and from memory without
intervention of CPU . This mode of interaction is
known as DMA(Direct Memory Access)
Thus there are three commonly used I/o techniques (data
transfer mode).
1.Programmed Input/output1.Programmed Input/output
2.Interrupt Driven input/output
3. Direct Memory Access.
Programmed i/o is useful method for computers where
hardware costs need to be minimized.
Entire i/o is handled by CPU with the help of small
software without any additional hardware.
CPU perform the following steps.CPU perform the following steps.
1. Read the i/o device’s status bit.
2.Test the status bit to determine if the device is ready
to begin data transfer operation.
3.If the device is not ready, return to step1,;otherwise
proceed with the data transfer. During the interval
,device is not ready ,CPU simply wastes its time until
the devices become ready.
When the processor, main memory, i/o share a common bus, two
modes of addressing are possible
memory –mapped i/o
i/o mapped i/o
Data bus
Address bus
Write line
Read line
Main
memory
CPU
I/o
module-1
i/o modules-2
Write line
i/o device i/o device
•Read command is for input of data
•Write command is for output of data
•I/o modules is used for interfacing of a Device with the system bus
With memory mapped i/o, there is a single address
space for memory location and i/o devices.
Processor treats status and data registers as separates
memory location.
Processor uses same memory instruction to access bothProcessor uses same memory instruction to access both
memory and i/o device
With memory mapped i/o single read line and single
write line are needed on the bus
READ: line is activated during transfer of data from
memory to CPU.
e.g.: MOV Ax [AX x] in 8086 transfer a word of data from
memory location x into CPU Register AX.
Write : line is activated during transfer of data from CPU to
memory .memory .
e.g: MOV x ,AX[x AX]
With memory mapped i/o, no special commands (like
IN,OUT )are needed for i/o operations.
A large set of instruction can be used for i/o
Interfacing circuit for memory mapped i/o is complex.
Data bus
Address bus
i/o Read
Memory
read
Memory write
Main
memory
CPU
I/o
module-
1
i/o
modules-
2
i/o Write
i/o device i/o device
There are separate control lines for memory and i/o devices.
A memory reference instruction does not effect an i/o device.
A memory reference instruction for memory read will cause
generation of ‘memory read’ control signal.
MOV AX,x [Ax x]
A memory reference instruction for memory write will cause
generation of ‘memory write’ control signal.generation of ‘memory write’ control signal.
MOV x ,AX [x AX ]
A i/o reference instruction for i/o read will cause generation of
‘i/o read’ control signal.
IN AL ,300H [AL 300H ]
A i/o reference instruction for i/o write will cause generation of
‘i/o write’ control signal.
OUT 300H,AL
Major drawback of programmed i/o is busy waiting .
CPU Switches to some other program without waiting
for the i/o device to complete or to become free. when
device become ,it inform back the CPU through adevice become ,it inform back the CPU through a
mechanism known as interrupt.
Unit 6
Types of interrupts
Program Interrupt(s/w interrupt )
Timer interrupts
i/o interrupts
Hardware failureHardware failure
Program interrupt: are generated by some condition that
occurs as a result of an instruction execution,
Arithmetic overflow
Division by zero
Execution of an illegal machine instruction
Segment limit violationSegment limit violation
Execution of privileged instruction
Timer interrupt: are generated within processor
i/o interrupt are generated due to initiation or completion of
operation.
Hardware failure interrupt are generated by a failure,such as
power failure or memory parity error.
Both interrupt driven and programmed i/o required involvement of CPU for
data transfer.
CPU can be better utilized for program execution.
i/o activities are slow and involvement of CPU will not have a desired effect on
system performance .
When CPU was involved in data transfer, it uses the system bus twice.
During memory to CPU transfer & CPU to i/o transfer.
DMA increase the speed of i/o transfer by eliminating the role played by CPU
in such operation.
When i/o is requested , the CPU instruct the DMA module about the operation.
Operation of a DMA transfer
29
DAM
DMA Data transfer
mode
1.DMA Block
Data
count
Data lines
1.DMA Block
Transfer
2. Cycle Stealing
mode
3.Transparents
DMA
Data
register
Address
register
Control
unit
Address lines
Read
Write
How interrupts happens. Connections between devices and
interrupt controller actually use interrupt lines on the bus
rather than dedicated wires
31
Device independence
◦ Programs can access any I/O device
◦ without specifying device in advance
· (floppy, hard drive, or CD-ROM)
· For examples :-A program that reads a file as input should be able to read a file on
a floppy, disk, on a hard disk or on a CD-ROM, without having to modify the
program for each different device.
Uniform namingUniform naming
◦ name of a file or device a string or an integer
◦ not depending on which machine
◦ The name of file or device should simply be a string or an integer and not
depend on the device in any way.
◦ In UNIX ,all disks can be integrated in the file system hierarchy in arbitrary
ways so the user need not be aware of which name corresponds to which
device.
32
Error handling
Errors should be handled as close to the hardware as possible .
If controller discovers a read error , it should try to correct the error it
self if it can. If it cannot ,then the device driver handled it, perhaps by
just trying to reads the block again.
Synchronous vs. asynchronous transfersSynchronous vs. asynchronous transfers
◦ blocked transfers vs. interrupt-driven
◦ Most physical i/o is asynchronous the CPU starts the transfer
and goes off to do something else until the interrupt arrives .
◦ User program are much easier to write if the i/o operations are
blocking –after a read system call the program is automatically
suspended until the data are available in the buffer.
33
Buffering
◦ data coming off a device cannot be stored in final destination
◦ For E.g when a packet comes in off the networks the operating
system does not know where to put it until it has stored the packet
somewhere and examined it.
◦ Also some devices have severe() real time constraints ,(e,g digital◦ Also some devices have severe() real time constraints ,(e,g digital
audio devices)so the data must be put into an output buffer in
advance to decoupled the rate at which the buffer is filled from the
rate at which it is emptied ,in order to avoid buffer under runs.
Sharable vs. dedicated devices
◦ disks are sharable
◦ tape drives would not be
Steps in printing a string
35
Writing a string to the printer using
programmed I/O
36
Writing a string to the printer using interrupt-driven I/O
◦ Code executed when print system call is made
◦ Interrupt service procedure
37
Printing a string using DMA
◦ code executed when the print system call is made
◦ interrupt service procedure
38
Layers of the I/O Software System
39
i/o software is typically organized in four layers .
Each layer has a well defined function to perform and
well defined interface to the adjacent layers.
Lowermost layer interacts with the hardware .
Uppermost layer provides a nice and friendly interface
to users
Interrupt handlers are best hidden
◦ have driver starting an I/O operation block until interrupt
notifies of completion
Interrupt procedure does its taskInterrupt procedure does its task
◦ then unblocks driver that started it
41
Steps must be performed in software after interrupt completed
Save regs not already saved by interrupt hardware
Set up context for interrupt service procedure. Doing this may involve setting up the
TLB,MMU and Page table .
Set up stack for interrupt service procedure
Ack interrupt controller, reenable interrupts
Copy registers from where saved Run service procedure
Set up MMU context for process to run next
Load new process' registers
Start running the new process
42
Logical position of device drivers is shown here
Communications between drivers and device controllers goes over the bus
43
A device driver is piece of i/o software that handles all
device independent tasks.
A device driver accepts abstract request from the
device-independent software above it, and converts itdevice-independent software above it, and converts it
into device dependent commands.
A device drivers essentially converts the generals
commands from the device-independent software to
messages that the device type can understand.
Each controller has some device register used to give it command
or some device register used to readout its status or both.
e.gMouse driver accept the information from the mouse telling
how far it has moved and which button are currently depressed.
In contrast, a disk driver has to know about sector, tracks,
cylinders, heads, arm motion, motor drives ,head setting time and
all other mechanism of making the disks work properly.
Each i/o device attached to a computer needs some device-
specific code for controlling it. This is called the device Driver
Device independent i/o software refers to that set of
program which provide a device independent interface
to the user.
The basic function of the device independent software
is to perform functions common to all devices. It
provides a uniform interface to the user level software.
The basic function of the device inedpendent software
are as follows:
Uniform interfacing for device drivers
Buffering
Error reporting
Functions of the device-independent I/O software
47
Error reporting
Allocating and releasing dedicate devices
Providing a device-independent block
size
(a) Without a standard driver interface
(b) With a standard driver interface
48
(a) Unbuffered input
(b) Buffering in user space
(c) Buffering in the kernel followed by copying to user space
(d) Double buffering in the kernel
49
Consider a process that wants to read data from a modem.
One possible strategy for dealing with the incoming character
is to have arriving character cause an interrupt .The interrupt
service procedure hands the character to the user process andservice procedure hands the character to the user process and
unblocks it. After putting the character somewhere ,the process
reads another character and blocks again.
The trouble with this way of doing business is that the user
process has to be started up for every incoming character.
Allowing a process to run many times for short run is
inefficient , so this design is not a good one
Networking may involve many copies
51
Layers of the I/O system and the main functions of each layer
52
Spooling is way of dealing with dedicated i/o device in
a multiprogramming system.
Disks come in variety of types
1.Magnetic disks (hard disks and floppy disks)
2. Arrays of disks
3.Optical disks (CD-ROMs ,CD-recordables, CD-Rewritables, DVD)
A magnetic disk is a circular platter of plastic that is coated with magnetized material.A magnetic disk is a circular platter of plastic that is coated with magnetized material.
The disks are mounted on a rotary drive so that the magnetized surface move in close
proximity to read/write head. The disks rotate at uniform speed.
Sides : The magnetic coating if applied to both sides of the platter is called as double sided
disks.
A disks has multiple platter that are stacked vertically . This is known as disk pack. A cylinder
is defined which is the ring of all Co-centric tracks.
Data is stored in co-centric rings know as a tracks. The width of the tracks
is equal to the width of the head. These track are separated by inter tracks
gaps. Tracks are divided into sector.
Two adjacent sector are separated by intra tracks gaps. In a typical hard
disk, a sector of 600 bytes can contain, only 512 bytes of data anddisk, a sector of 600 bytes can contain, only 512 bytes of data and
remaining is control information.
Both data and identification field start with synchronization byte and have
2 byte of error-detecting code.
The identification field contains the basic information such as the tracks
number ,sector number and head number which are needed to identify a
sector.
Gap
17
Identification
fields
GapGapGapGap
41414141
Data field
512
Gap
2017
fields
07 41414141 512 20
Length in byte 600
The most common ones are the magnetic disks(hard disks and
floppy disks) .They are characterized by the fact that reads and
write are equally fast, which makes them ideal as secondary
memory..
Magnetics Disks are organized into cylinders, each one
containing as many tracks as there are heads stacked vertically.
The tracks are divided into sectors ,with the number of sector
around the circumference typically being 8 to 32 on floppy
disks, and up to several hundred in hard disks.
CPU performance has been increasing exponentially over the past decade.
In the 1970s, average seek times on minicomputers disks were 50 to
100msec.Now seek times are slightly under 10msec.
In 1988 paper ,Patterson suggested six specific disk organizations that could be
used to improve disks performance, reliability or both.
These ideas were quickly adopted by industry and have led to a new class of i/o
device called a RAID.
RAID as Redundant array of Inexpensive Disks ,but industry redefined the I to
be independent rather than Inexpensive
RAID: Redundant array of Independent Disks.
In a RAID system, a single large file is stored in several
separate disks units by breaking the file up into a number of
small pieces and storing these pieces on different disks.
When a file is accessed for a read, all disks deliver their dataWhen a file is accessed for a read, all disks deliver their data
in parallel.
RAID may be implemented in hardware or in the operating
system.
RAID Level 0
It creates one large virtual disks from a number of smaller disks.
Storage is grouped into logical unit called strips.
The strips are mapped round –robin to consecutive array member.
RAID level 0 architecture achieves the parallism but it does not
include redundancy to improve reliability.include redundancy to improve reliability.
Benefit:- Create a large disks.
Limitation:- Files tend to get scattered over number of disks, even
after a disks failure , some file data may be retrievable.
In n disk array , the first n logical strips are physically stored as the
first strip on each of the n disks, the second n strips are disturbed
as second strips on each disks and so on.
RAID Level-1
Redundancy is achieved by Just duplicating all the data.
The data stripping is used, same as RAID Level 0.
RAID level 1 stores duplicates copies of each strip, with each
copy on a different disk.
RAID Level-2
Single copies of each strip are maintained.
Error correcting code such as hamming code is calculated for
the corresponding bits on each data disks.
The bits of code are stored in the corresponding bit position on
multiple parity disks.
The strips are very small, so when a block is read, all disks are
accessed in parallel
RAID Level-3
In RAID level 3,single parity bit is used instead of an error
correcting code.
It required just one extra disks.It required just one extra disks.
The data stripping is used , similar to the other RAID Levels.
If any disk in the array fails ,its data can be determined from
the data on the remaining disks.
RAID Level-4
RAID level 4 is similar to RAID level 3 , Except strips are larger.
Operations to read a block involves only s single disk.
Parity bit are stored in the Corresponding strips on the parity disk.
A bit by bit parity strip is calculated across corresponding data blocks on
each data disk.
Write operation requires parity information to be calculated.
Write must be performed on both the data and parity disks.
For each read and write operation parity bits are checked for data
reliability.
RAID level-5
It eliminates the potential bottleneck found in RAID-4.
RAID-5 distributes the parity strips across all disks.
Disk parameters for the original IBM PC floppy disk
and a Western Digital WD 18300 hard disk
Physical geometry of a disk with two zones
A possible virtual geometry for this disk
67
Raid levels 0 through 2
Backup and parity drives are shaded
68
Raid levels 3 through 5
Backup and parity drives are shaded
69
Optical disks have much higher recording densities than conventional Magnetic disks.
Optical disks were originally developed for the recording television Program.
First – generation optical disks were invented by the Dutch electronics conglomerate
Philips for holding movies .
In 1980,Philips , together with Sony developed the CD( Compact Disc)In 1980,Philips , together with Sony developed the CD( Compact Disc)
A CD-ROM (Compact Disk read only memory) disk is an optical Laser disk which
stores digital data by using laser beams.
This laser technology provides very large storages
capacities, and a CD-ROM disk is able to store up to 600 MB of data
All technical details given in RED book.
A CD is prepared by using a high power infrared laser to
burn 0.8 micron diameter holes in a coated glass master
disk. From this master, a mold is made, with bumps
where the laser holes were.
Into this mold, molten Polycarbonate resin is injected toInto this mold, molten Polycarbonate resin is injected to
form a CD with the same pattern of holes as the glass
master. Then very thin layer of reflective aluminum is
deposited on the polycarbonate, topped by a protective
lacquer and finally a label. The depressions in the
polycarbonate substrate are called Pits. The unburned
areas between the pits are called lands.
Recording structure of a CD or CD-ROM
72
In 1984 Philips and Sony launched new version of CD. All
details in Yellow book.
The basic format of a CD-ROM consist of encoding every
byte in a 14 Bit symbol.byte in a 14 Bit symbol.
A group of 42 consecutive symbol forms a 588 bit frame.
Each frame holds 192 data bits (24 bytes) remaining 396 bit
bits are used for error correction and control.
Logical data layout on a CD-ROM
74
Mode1: 2048 data+16 bytes Preamble+ 288 ECCMode1: 2048 data+16 bytes Preamble+ 288 ECCMode1: 2048 data+16 bytes Preamble+ 288 ECCMode1: 2048 data+16 bytes Preamble+ 288 ECC
Mode2: 2336 data+ Mode2 combine data &ECCMode2: 2336 data+ Mode2 combine data &ECCMode2: 2336 data+ Mode2 combine data &ECCMode2: 2336 data+ Mode2 combine data &ECC
Cross section of a CD-R disk and laser
◦ not to scale
Silver CD-ROM has similar structure
◦ without dye layer
◦ with pitted aluminum layer instead of gold
75
Although people are used to other write once media
such as paper and photographic film , there is a demand
for a rewritable CD-ROM.
CD-RW uses an alloy of silver , indium ,antimony and
tellurium for the recording layer.tellurium for the recording layer.
CD-RW drives use laser with three different powers.
At high power
At medium power
At low power
DVD(Digitally Video Disk) but now
(Digital versatile Disk)
Hollywood would like to put multiple movies on the same disk so
four format have been defined
1. Single sided, single layer(4.7 GB).1. Single sided, single layer(4.7 GB).
2. Single sided, dual layer(8.5 GB).
3. Double sided, single layer(9.4 GB).
4. Double sided ,double layer(17 GB).
A double sided, dual layer DVD disk
78
A disk sector
79
80
An illustration of cylinder skew
A hard disks consists of a stack of aluminum ,alloy or
glass platters 5.25 inch or 3.5 inch in diameter. On each
Platter is deposited a thin magnetizable metal oxide.
After manufacturing there is no information whatsoever
on disk.on disk.
Before the disk can be used, each platter must receive a
low level format done by software .
Preamble:- it start with a certain bit pattern that allows the hardware to
recognize the start of sector. It also contains the cylinder and sector number
and some other information.
Data:-The size of the data portion is determined by the low level formatting
program. Most disks use 512 byte sector.
ECC:- This field contains redundant information that can be used toECC:- This field contains redundant information that can be used to
recover from read errors. The size and content of this field varies from
manufacturer to manufacturer.
Disks formatting is of two types
1. Physical formatting or Low level formatting .
2. Logical Formatting .
Physical Formatting :-
Disk must be formatted before storing a data.
Disk must be divided into sector that the disk controller can read/write.
Low level formatting fills the disk with a special data structure for each sector.
Data structure consist of three fields: Header, data area and trailer.
Sector number and error correcting codes (ECC) contained in the header and trailer.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.
Logical Formatting:-
After disk is partitioned , logical formatting used.
Operating system stored the initial file system data
structures onto the disk.structures onto the disk.
No interleaving
Single interleaving
Double interleaving
85
Time required to read or write a disk block determined by 3
factors
Seek time
Rotational delay
Actual transfer time
Seek time : Seek time is the time required to move the disk
arm to the required track . It consist of two key components
: initial startup time and rate at which read/write head can
arm to the required track . It consist of two key components
: initial startup time and rate at which read/write head can
be moved.
Ts= m x n + s
Where Ts= seek time,
m = constants that depends on the disk drive,
n = Number of track traversed.
s = startup time.
86
Rotational delay:- Disks , other than floppy disks, typically
rotate at 3600 rpm, which is one revolution per 16.7 msec.
Rotational Latency:-it is the time spent waiting for the
target sector to appear under the read and write heads.
Transfer time:- The transfer time to or form the disk from
the disk depends on the rotation speed of the disk in the
following fashion.
By reducing the mean seek time,the system performance
can be improved substantially.
There are several scheduling algorithms.
1. First-Come First served (FCFS).
2. Shortest –seek –time-first (SSTF).2. Shortest –seek –time-first (SSTF).
3. Scan Scheduling
4. Circular Scan.
◦ In this scheduling, request are serviced in the sequence they arrive.
◦ FCFS is easy to program.
◦ Consider the examples of disk queue with requests involving tracks to
read
◦ Consider an examples◦ Consider an examples
◦ 98,183,37,122,14,124,65,67
◦ The SSTF Scheduling select the disk i/o request that required
the least movement of disk head from its current position.
◦ Consider an examples
◦◦ 98,183,37,122,14,124,65,67
◦ Scan scheduling algorithm is also called as the elevator
algorithm. This algorithm developed for the two reasons
1.To preserve advantages of both
FCFS & SSTF.
2. To eliminate shortcoming of2. To eliminate shortcoming of
both FCFS & SSTF.
In c-scan algorithm .
Scanning and servicing is restricted to one direction only. Thus
when the last track is serviced in one direction , the disk head is
returned to the opposite end of the disk and the scan begin again.
Initial
position
Pending
requests
Which algorithm is this?
93
Which algorithm is this? e
94
A disk track with a bad sector
Substituting a spare for the bad sector
Shifting all the sectors to bypass the bad one
95
As we have seen,disks sometimes make errors.
Good sector can suddenly become bad sectors. Whole drives can die unexpectedly.
RAIDs Protect against a few sector going bad or even a drive falling out.
For some applications, it is essential that never be lost or corrupted, even in the face
of disk and CPU errors. Ideally, a disk should simply work all the time with no
errors. Unfortunately , that is not achievable .errors. Unfortunately , that is not achievable .
What is achievable that has following property
When a write is issued to it, the disk either correctly writes the data or it does
nothing, leaving the existing data intact .Such as system is called Stable storage.
Stable devices never lost the information .
Analysis of the influence of crashes on stable writes
97
1.Stable write 2. Stable reads 3.Crash Recovery
Hardware clocks (also called timers)
• give the current time
• give the elapsed time
• set a timer to trigger operation X at time T
• Programmable interval timer - hardware to measure
elapsed time and trigger operations
• This mechanism is used by the scheduler, disk I/O
subsystem, network subsystem
• Older/simpler clocks
• Tied to the 110 or 220 volt power line and cause interrupt on every
voltage cycle at 50-60 Hz.
• Current clocks consist of three components:
• a crystal oscillator
• a counter• a counter
• a holding register.
• Feature:
• Quartz crystal generates very accurate periodic signal
• This signal is fed into the counter which counts down
to zero.
• When the counter is zero, it causes CPU interrupt.
The holding register is used to load the counter
Modes of programmable clocks:
• one-shot mode:
• Software starts the clock
• Copies the register value into the counter
• Decrements the counter (interrupt when 0)
• Stops
• square-wave mode:• square-wave mode:
• Clock starts
• Copies the register value into the counter
• Decrements the counter (interrupt when 0)
• Holding register value is copied into the counter
• Whole process repeats (i.e., there is no explicit start of the clock by the
software)
The periodic interrupts are called clock ticks.
Programmable clock chips usually contain two or three independently programmable clocks.
A programmable clock
10
1
Clock hardware generates interrupts at known intervals.
The clock hardware is served by the clock driver software.
Functions of the clock driver:
– Maintaining the time of day– Maintaining the time of day
– Preventing processes from running longer than they are allowed
to
– Accounting for CPU usage
– Handling alarm system call made by the user process
– Providing watchdog timers for parts of the system itself
– Doing profiling, monitoring and statistics gathering
Three ways to maintain the time of day
10
3
Simulating multiple timers with a single clock
10
4
• Software-based timer, called soft timer, is a timer which
• sets to the requested frequency as needed
• is checked by the kernel when entries are made for other reasons
such as system calls, TLB misses, page faults, I/O interrupts,
CPU going idle.
• If the soft timer has expired, the scheduled event is performed• If the soft timer has expired, the scheduled event is performed
(e.g., packet transmission) with no need to switch to kernel mode.
• The kernel resets the soft timer again to go off. The kernel copies
the current clock value to the timer and adds the timeout interval
to it.
• Soft timer can avoid interrupts
• the frequency of kernel entries is so high that the kernel can
check on the soft timer and schedule the events without sending
an interrupt.
Network terminals
are used to connect a remote user to computer over a network either
local area network or wide area network
The X Window system:
◦ The x windows system is a windowing graphical user interface.
◦ The program inside the x terminals that collects input from the keyboard
or mouse and accepts commands from a remote computer is called the X
server.server.
◦ One layer is Xlib , which is a set of library procedure for accessing the X
functionality.
◦ To make programming with X easier, a toolkit consisting of the intrinsic
is supplied as part of X. This layer manages buttons ,scroll bars and
other GUI elements called widgets.
The x window server
◦ Managing the i/o
The x window Client
◦ runs the programs that use the x window server.
After connection is establish , the client and serverAfter connection is establish , the client and server
exchange four different types of packet over channel.
◦ Request
◦ Reply
◦ Event
◦ Error
Clients and servers in the M.I.T. X Window System
10
8
Stateless Low-level interface Machine
◦ The idea is based on traditional centralized timesharing
The architecture of the SLIM terminal system
Messages used in the SLIM protocol from the server to the terminals
11
0
◦ The first general purpose electronics computer, the ENIAC,
had 18000 vacuum tubes and consumed 140,000 watts of
power.
◦ After invention of the transistor ,power usage dropped
dramatically .
◦ A desktop PC often has 200 watt power supply.
◦ There are two general approach to reducing energy
consumption
The first one is for the OS to turn off parts of the computer(mostly
i/o devices). When they are not in use.
The second one is for the application program to use less energy .
Hardware issues:
Batteries come in two general type
Disposable
Rechargeable
DisposableDisposable
◦ batteries can be used to run handheld devices, but do not have
enough energy to power notebook computer with large bright
screens.
Rechargeable
◦ batteries can store enough energy to power a notebook for a
few hours.
Operating system:
◦ operating system plays a key role in energy management. it control
all the devices, so it must decide what to shut down and when to shut
it down
◦ Power management bring up a number of question that operating◦ Power management bring up a number of question that operating
system must deal with.
◦ Which devices can be controller ?Are they on/off or they have
intermediate state?
How much power is saved in the lower power states? Is energy expended to
restart the devices?
Power consumption of various parts of a laptop computer
11
5
The use of zones for backlighting the
display
11
6
Running at full clock speed
Cutting voltage by two
cuts clock speed by two,
cuts power by four
11
7
A GUI is type of computer human interface on a
computer.
◦ GUI usually have common characteristic such as
windows,iocns,menus,and push buttonswindows,iocns,menus,and push buttons
GUI usually has three major components.
A windowing system.
An imaging model.
An application program interface(API)
The windowing system
◦ builds the windows,menus,and dialog boxes that appear on the
screen.
The imaging modelThe imaging model
◦ defines the fonts and graphics that appear on the screen.
The API
◦ is the mean in which the user specifies how and what windows
and graphics appear on the screen.
PURPOSE
◦ Hard drives can be very small, they still contain millions of bits and therefore
need to be organized so that information can be located. This is the purpose of
the file system
◦ The file system is based on management of clusters (the smallest disk unit that
the operating system is able to manage).
◦ An operating system only knows how to manage whole allocation units, the
more sectors per cluster, the more wasted space there will be. This is why the
choice of file system is important
All computer applications need to store and retrieve information.
E.g. banking ,corporate record keeping
A second problem with keeping information within the processor
‘address space’ is that when the process terminates the information
is lost.is lost.
For many application (e.g. databases) ,the information must be
retained for weeks, months ,or even forever.
A third problem is that it is frequently necessary for multiple
process to access (part of )the information at the same time.
◦ The way to solve this problem is to make the information it self
independent of any one process.
◦ Three essential requirement for long term information storage
It must be possible to store a very large amount of informationIt must be possible to store a very large amount of information
The information must survive the termination of the process using it.
Multiple process must be able to access the information concurrently.
◦ The usual solution to all these problems is to store information
on disks and other external media in units called files.
Some typical file extensions
1.Byte sequence
The file is an unstructured sequence of bytes. In effect, the
operating system does not know or care what is in the file.
2.Record sequence
In this model, a file is sequence of fixed length records, each with
some internal structure.some internal structure.
3.Tree
In this organization ,a file consist of tree of records, not necessary
all the same length ,each containing the a key field in a fixed
position in the record. The tree is sorted on the key field, to allow
rapid searching for a particular key.
a) Byte sequence b) Record sequence c)Tree
12
6
1. Regular files
2. Directories
3. Character Special files
4. Block special files
Regular files
are either ASCII files or binary files.
e.g a file contains c program, file containing letter, file containing text
Directories
Directories are system file for maintaining the structure of theDirectories are system file for maintaining the structure of the
file system.
Character special files
These are system files. They are related to i/o and used to
model serial i/o devices such as terminals, printers.
Block special files
used to model disks.
(a) An executable file (b) An archive 12
9
Sequential access
◦ read all bytes/records from the beginning
◦ cannot jump around, could rewind or back up
◦ convenient when medium was mag tape
Random access
◦ bytes/records read in any order◦ bytes/records read in any order
◦ essential for data base systems
◦ read can be …
move file marker (seek), then read or …
read and then move file marker
13
0
Every file has a name and its data. In addition , all
operating systems associate other information with
each.E.g the date time the file was created and the file’s
size. We will call these extra items the file’s attributes.
Possible file attributes 13
2
Files exist to store information and allow it to be
retrieved later. Different system provide different
operation to allow storage and retrieval. Below is a
discussion of the most common system calls relating to
files.files.
1. Create
2. Delete
3. Open
4. Close
7. Append
8. Seek
9. Get attributes
4. Close
5. Read
6. Write
9. Get attributes
10.Set Attributes
11.Rename
(a) Segmented process before mapping files into its address space
(b) Process after mapping existing file abc into one segment creating new segment for xyz
13
5
Directories
◦ Directories is the data structure for storing details about files. A
directories typically contains a number of records , one per file.
Each records contains
1 File name1 File name
2 File attributes
3 Addresses of the disk block where the data are stored
◦ Single-Level Directory Systems
◦ Two-level Directory Systems
◦ Hierarchical Directory Systems
◦ Path Names
The simplest from of directory system is having one directory
containing all the files. Sometimes it is called the root directory .
This scheme is not used multiuser system any more but could be used
on a small embedded system.
Advantage :Advantage :
The advantage of this scheme are its simplicity and the ability to locate
files quickly.
Disadvantage:
1. Not suitable for the a large number of files and more than one user.
2. Because of single directories , files require unique file name.
3. it is difficult to remember the names of all the files as the number of
files increase .
A single level directory system
◦ contains 4 files
◦ owned by 3 different people, A, B, and C
13
9
In two level directory ,each user has his own directory .
It is called user file directory(UFD).Each UFD has
similar structure
When a user refer to a particular file, only his own
UFD is searched.UFD is searched.
Operating system can not accidently delete another user
file that has the same name.
Letters indicate owners of the directories and files
14
1
The two level hierarchy eliminate conflicts among user
but is not satisfactory for the user with a large number
of files.
It is quite common for the user to want to group their
files together in logical way.files together in logical way.
A hierarchical directory system
14
3
When the files system is organized as directory tree, some way is needed for the
specifying file names.
Two different methods are commonly used .
◦ Absolute path name
◦ Relative path name
In the first method, each file is given an absolute path
name consisting of the path from the root directory to
the file.
E.g The path usr/ast/mailbox means that the root
directory contains a subdirectory usr, which in turndirectory contains a subdirectory usr, which in turn
contain a subdirectory ast which contains the file
mailbox.
Absolute path names always start at the root directory .
The second method is the Relative path name. This is
used in conjunction with the concept of the working
Directory.
A user can designate one directory as the current
working directory ,in which case all path names notworking directory ,in which case all path names not
beginning at root directory are taken relative to the
working directory.
For examples , if the current working directory is
usr/ast, the file whose absolute path is usr/ast/mailbox
can be referenced simply as mailbox.
A UNIX directory tree 14
7
1. Create
2. Delete
3. Open dir
5. Read dir
6. Rename
7. Link3. Open dir
4. Close dir
7. Link
8. Unlink
14
8
Files system are stored on disks. Most disks can be divided up
to into one or more partitions, with independent file systems
on each patitions.
Sector 0 of the disks is called the MBR(Master Boot Record )
and is used to boot the computer.
The end of the MBR contains the partition table. This gives
the starting and ending address of each partition. One of the
partition in the table is marked as the Active.
The first one is the Superblock . It contain all the key
parameters about the files system and is read into
memory when the computer is booted or the file system
first touched
I nodes ,an array of data structure, one per file ,tellingI nodes ,an array of data structure, one per file ,telling
all about the file.
Root directory, which contain the top of the file system
tree. Finally , the remainder of the disk typically
contain all the other directories and files.
A possible file system layout
15
1
◦ An important function of the file system is to manage space on
the secondary storage, which includes keeping track of both
disk blocks allocated to files and the free blocks available for
allocation.
The main problem in allocating space to files are
◦◦ Effective utilization of disks space
◦ Fast accessing of files
Management of disk block is similar to memory
management. But secondary storage introduces two
additional problems.
slow disk access time
Large number of blocks to deal withLarge number of blocks to deal with
There are three widely used techniques for allocation
of disks block to a file.
1. Contiguous Allocation
2. Linked Allocation
3. Indexed Allocation
While discussing these allocation strategies, we will
consider that a file is a sequence of blocks. The
conversion from logical records to physical blocks is
done by the software.
In contiguous allocation , files are assigned toIn contiguous allocation , files are assigned to
contiguous area of secondary storage.
In this scheme , user specifies in advance the size of the
area needed to hold a file before creation .if desired
amount of contiguous space is not available , the file
cannot be created.
Unit 6
Advantages : Successive records of a file are normally
adjacent to each other. This increase the accessing
speed of records.
This allocation supports both sequential and direct
accessing of file. It is necessary merely to retain theaccessing of file. It is necessary merely to retain the
starting address of the file and file’s size.
Disadvantages:
External fragmentation
◦ Allocation list of blocks to a file is linked list of blocks. These
blocks may be scattered through the disk. These blocks need
not be contiguous . Each block contain the address of the next
block .
Advantages :
◦◦ Simple to implement .
◦ Disk compaction is not required .
◦ There is no problem of external fragmentation.
◦ The file size can grow or shrink dynamically.
Disadvantages :
Slow accessing of a records – to find out a records , we
must start at the beginning of the file and follow the
pointer until we get block containing the records.
There is wastage of space for storing block pointers.There is wastage of space for storing block pointers.
There is problem of reliability – A single damaged
pointer can make thousands of disk block inaccessible.
(a) Contiguous allocation of disk space for 7 files
(b) State of the disk after files D and F have been
removed
15
9
Storing a file as a linked list of disk blocks
16
0
Linked list allocation using a file allocation table in RAM
16
1
Our last method for keeping track of which
blocks belong to which file is to associate
with each file a data structure called I
node(index node) which lists the attributes
and disk address of the file’s blocks.and disk address of the file’s blocks.
Advantages : The big advantages of this
scheme over linked files using an in memory
table is that the I node need only be in
memory when the corresponding file is open.
An example i-node
16
3
Directory is data structure for the storing details
about files. Directory typically contains a number
of records, one per file. Each records contains file
name, file attributes
To perform any operation on a file, the file must
be opened . To open a file, the operating system
must look into the directory entries to locate themust look into the directory entries to locate the
necessary file. Operating system requires
pathname to locate the directory entry.
The directory entry provides the information
needed to find the disk blocks containing the
data. File attributes are normally stored in
directory entry itself.
(a) A simple directory
fixed size entries
disk addresses and attributes in directory entry
(b) Directory in which each entry just refers to
an i-node
16
5
So far we have assumed that files have short,
fixed length names.
All modern operating system support longer
,variable length files names, how can these be
implemented ?
1.In line: wastes a great deal of directory space
When file is removed, variable sized gap is
introduced into the directory into which the next
file to be entered may not fit.
Pages fault may occur while reading a file name.
2. In a heap: Hash table uses
Two ways of handling long file names in
directory
◦ (a) In-line
◦ (b) In a heap 16
7
When several users are working together on a
project, they often need to share files , it is
often convenient for a shared file to appear
simultaneously in different directories
belonging to different users.belonging to different users.
The following system are called as Directed
Acyclic Graph or DAG
File system containing a shared file
16
9
(a) Situation prior to linking
(b) After the link is created
(c)After the original owner removes the file
17
0
Operating system maintain a list of free disk
blocks. Free disk blocks are those blocks in a
disk which are not being used by any file.
Whenever a file is created , the list of free
disk blocks is searched for and then allocated
to the list of free blocks. When a file isto the list of free blocks. When a file is
deleted, its disk space is added to the list of
free block. Two method to manage free disk
block are popular
Linked list
Bit map
Linked list:
In this method , all free disk block are linked
together by each free block pointing to the next
free block.
This scheme required additional memory for
maintaining linked list of all free disk blocks.
This space could be quite large when the disk is
maintaining linked list of all free disk blocks.
This space could be quite large when the disk is
almost empty. But if the disk is nearly full (very
few free blocks) then the linked list could be the
desired method.
This scheme is not very efficient since to
traverse the list, we must read each block is
represented by a single bit.
Bit map:
In this scheme, the list of free disk blocks is
implemented as bit map or bit vector. Each block is
represented by a single bit
0 for a free block
1 for allocated block
AdvantagesAdvantages
It is very simple method
It is easy to find n consecutive free block on the disk
Compared to linked list the bit map requires less
space since it uses 1 bit per block.
Disadvantages;
If the disk is nearly full then finding a free block may
required many comparison
Dark line (left hand scale) gives data rate of a disk
Dotted line (right hand scale) gives disk space efficiency
All files 2KB
17
4
Block size
(a) Storing the free list on a linked list
(b) A bit map
17
5
(a) Almost-full block of pointers to free disk blocks
in RAM
- three blocks of pointers on disk
(b) Result of freeing a 3-block file
(c) Alternative strategy for handling 3 free blocks
- shaded entries are pointers to free disk blocks
17
6
Quotas for keeping track of each user’s disk use
17
7
A file system to be dumped
◦ squares are directories, circles are files
◦ shaded items, modified since last dump
◦ each directory & file labeled by i-node number
17
8
File that has
not changed
Bit maps used by the logical dumping algorithm
17
9
File system states
(a) consistent
(b) missing block
(c) duplicate block in free list
(d) duplicate data block
18
0
The block cache data structures
18
1
I-nodes placed at the start of the disk
Disk divided into cylinder groups
◦ each with its own blocks and i-nodes
18
2
With CPUs faster, memory larger
◦ disk caches can also be larger
◦ increasing number of read requests can come from cache
◦ thus, most disk accesses will be writes
LFS Strategy structures entire disk as a logLFS Strategy structures entire disk as a log
◦ have all writes initially buffered in memory
◦ periodically write these to the end of the disk log
◦ when file opened, locate i-node, then find blocks
18
3
The ISO 9660 directory entry
18
4
• Every CD ROM begins with 16 blocks whose function is not defined by
the ISO (9660
Standards
•Next block containing the primary volume descriptor, which contains
some general
information about CD ROM. System Identifier 32 bytes, Volume
identifier 32 bytes
In CP/M ,there is only one directory . Each file resides
in this directory . So the work of the file system is
very simple, to look up a filename it search the one
and only directory.
Disk block number are stored in the directory entry
itself. It can store addresses of 16 blocks.itself. It can store addresses of 16 blocks.
The filed EXTENT is needed because a file larger than
16 blocks occupies multiple entries. This field tells
which entry comes first, second and so on.
BLOCK COUNT :This field tells how many of the 16
blocks entries are in use.
The user code field keeps track of the owner of the
field.
Memory layout of CP/M 18
6
The CP/M directory entry format
18
7
The MS-DOS directory entry
18
8
Maximum partition for different block sizes
The empty boxes represent forbidden
combinations 18
9
Bytes
The extended MOS-DOS directory entry used in Windows 98
19
0
Bytes
An entry for (part of) a long file name in Windows 98
19
1
Checksum
An example of how a long name is stored in Windows
98
19
2
A UNIX V7 directory entry
19
3
A UNIX i-node
19
4
The steps in looking up /usr/ast/mbox
19
5

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

PC techniques software and Hardware
PC techniques software and HardwarePC techniques software and Hardware
PC techniques software and Hardware
 
System bus
System busSystem bus
System bus
 
Plan 9: Not (Only) A Better UNIX
Plan 9: Not (Only) A Better UNIXPlan 9: Not (Only) A Better UNIX
Plan 9: Not (Only) A Better UNIX
 
9 virtual memory management
9 virtual memory management9 virtual memory management
9 virtual memory management
 
Unix++: Plan 9 from Bell Labs
Unix++: Plan 9 from Bell LabsUnix++: Plan 9 from Bell Labs
Unix++: Plan 9 from Bell Labs
 
DMA
DMADMA
DMA
 
Operasi Dasar Komputer
Operasi Dasar KomputerOperasi Dasar Komputer
Operasi Dasar Komputer
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
 
Cpu
CpuCpu
Cpu
 
Acceso Directo A Memoria
Acceso Directo A MemoriaAcceso Directo A Memoria
Acceso Directo A Memoria
 
04 Cache Memory
04  Cache  Memory04  Cache  Memory
04 Cache Memory
 
Jamaludin - Proses pada Sistem Operasi
Jamaludin - Proses pada Sistem OperasiJamaludin - Proses pada Sistem Operasi
Jamaludin - Proses pada Sistem Operasi
 
Sistem operasi
Sistem operasi Sistem operasi
Sistem operasi
 
ROM
ROMROM
ROM
 
05 internal memory
05 internal memory05 internal memory
05 internal memory
 
Introduction to operating system
Introduction to operating systemIntroduction to operating system
Introduction to operating system
 
Mostek północny i południowy
Mostek północny i południowyMostek północny i południowy
Mostek północny i południowy
 
Storage devices
Storage devicesStorage devices
Storage devices
 
hardware dan software.ppt
hardware dan software.ppthardware dan software.ppt
hardware dan software.ppt
 
Components Of Computer unit-2
Components Of Computer  unit-2Components Of Computer  unit-2
Components Of Computer unit-2
 

Semelhante a Unit 6

IO SYSTEM AND CASE STUDY STRUCTURE
IO SYSTEM AND CASE STUDY STRUCTUREIO SYSTEM AND CASE STUDY STRUCTURE
IO SYSTEM AND CASE STUDY STRUCTUREHariharan Anand
 
Operating System Case Study and I/O System
Operating System Case Study and I/O SystemOperating System Case Study and I/O System
Operating System Case Study and I/O Systemprakash ganesan
 
COMPUTER BASIC AND FUNDAMENTAL AND ITS ORGANISATION.pptx
COMPUTER BASIC AND FUNDAMENTAL AND ITS ORGANISATION.pptxCOMPUTER BASIC AND FUNDAMENTAL AND ITS ORGANISATION.pptx
COMPUTER BASIC AND FUNDAMENTAL AND ITS ORGANISATION.pptxPannaBushratul
 
IOhardware_operting_systems_2022_libya.pdf
IOhardware_operting_systems_2022_libya.pdfIOhardware_operting_systems_2022_libya.pdf
IOhardware_operting_systems_2022_libya.pdfaptinstallpython3
 
Lecture1,2,3 (1).pdf
Lecture1,2,3 (1).pdfLecture1,2,3 (1).pdf
Lecture1,2,3 (1).pdfTaufeeq8
 
FANDAMENTAL OF COMPUTER SCIENCE FOR ENGINEERING.pptx
FANDAMENTAL OF COMPUTER SCIENCE FOR ENGINEERING.pptxFANDAMENTAL OF COMPUTER SCIENCE FOR ENGINEERING.pptx
FANDAMENTAL OF COMPUTER SCIENCE FOR ENGINEERING.pptxPannaBushratul
 
Ch 7 io_management & disk scheduling
Ch 7 io_management & disk schedulingCh 7 io_management & disk scheduling
Ch 7 io_management & disk schedulingmadhuributani
 
3. Component of computer - System Unit ( CSI-321)
3. Component of computer - System Unit  ( CSI-321) 3. Component of computer - System Unit  ( CSI-321)
3. Component of computer - System Unit ( CSI-321) ghayour abbas
 
Lecture 2 - Computer Hardware & Operating Systems
Lecture 2 - Computer Hardware & Operating SystemsLecture 2 - Computer Hardware & Operating Systems
Lecture 2 - Computer Hardware & Operating SystemsJack Hyman
 
Computer architecture presentation
Computer architecture presentationComputer architecture presentation
Computer architecture presentationMuhammad Hamza
 
Ch # 04 computer hardware
Ch # 04 computer hardware Ch # 04 computer hardware
Ch # 04 computer hardware MuhammadRobeel3
 
Computer architecture input output organization
Computer architecture input output organizationComputer architecture input output organization
Computer architecture input output organizationMazin Alwaaly
 
computer organization and architecture notes
computer organization and architecture notescomputer organization and architecture notes
computer organization and architecture notesUpasana Talukdar
 
computer science and enginnering fundamental organisation.pptx
computer science and enginnering fundamental organisation.pptxcomputer science and enginnering fundamental organisation.pptx
computer science and enginnering fundamental organisation.pptxPannaBushratul
 
Components of a digital computer.ppt
Components of a digital computer.pptComponents of a digital computer.ppt
Components of a digital computer.pptDibyenduBiswas31
 

Semelhante a Unit 6 (20)

IO SYSTEM AND CASE STUDY STRUCTURE
IO SYSTEM AND CASE STUDY STRUCTUREIO SYSTEM AND CASE STUDY STRUCTURE
IO SYSTEM AND CASE STUDY STRUCTURE
 
Operating System Case Study and I/O System
Operating System Case Study and I/O SystemOperating System Case Study and I/O System
Operating System Case Study and I/O System
 
COMPUTER BASIC AND FUNDAMENTAL AND ITS ORGANISATION.pptx
COMPUTER BASIC AND FUNDAMENTAL AND ITS ORGANISATION.pptxCOMPUTER BASIC AND FUNDAMENTAL AND ITS ORGANISATION.pptx
COMPUTER BASIC AND FUNDAMENTAL AND ITS ORGANISATION.pptx
 
IOhardware_operting_systems_2022_libya.pdf
IOhardware_operting_systems_2022_libya.pdfIOhardware_operting_systems_2022_libya.pdf
IOhardware_operting_systems_2022_libya.pdf
 
Lecture1,2,3 (1).pdf
Lecture1,2,3 (1).pdfLecture1,2,3 (1).pdf
Lecture1,2,3 (1).pdf
 
Operating System Lecture 2
Operating System Lecture 2Operating System Lecture 2
Operating System Lecture 2
 
Components of a computer
Components of a computerComponents of a computer
Components of a computer
 
FANDAMENTAL OF COMPUTER SCIENCE FOR ENGINEERING.pptx
FANDAMENTAL OF COMPUTER SCIENCE FOR ENGINEERING.pptxFANDAMENTAL OF COMPUTER SCIENCE FOR ENGINEERING.pptx
FANDAMENTAL OF COMPUTER SCIENCE FOR ENGINEERING.pptx
 
Ch 7 io_management & disk scheduling
Ch 7 io_management & disk schedulingCh 7 io_management & disk scheduling
Ch 7 io_management & disk scheduling
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
The system unit
The system unitThe system unit
The system unit
 
3. Component of computer - System Unit ( CSI-321)
3. Component of computer - System Unit  ( CSI-321) 3. Component of computer - System Unit  ( CSI-321)
3. Component of computer - System Unit ( CSI-321)
 
Lecture 2 - Computer Hardware & Operating Systems
Lecture 2 - Computer Hardware & Operating SystemsLecture 2 - Computer Hardware & Operating Systems
Lecture 2 - Computer Hardware & Operating Systems
 
IO_ORGANIZATION.pdf
IO_ORGANIZATION.pdfIO_ORGANIZATION.pdf
IO_ORGANIZATION.pdf
 
Computer architecture presentation
Computer architecture presentationComputer architecture presentation
Computer architecture presentation
 
Ch # 04 computer hardware
Ch # 04 computer hardware Ch # 04 computer hardware
Ch # 04 computer hardware
 
Computer architecture input output organization
Computer architecture input output organizationComputer architecture input output organization
Computer architecture input output organization
 
computer organization and architecture notes
computer organization and architecture notescomputer organization and architecture notes
computer organization and architecture notes
 
computer science and enginnering fundamental organisation.pptx
computer science and enginnering fundamental organisation.pptxcomputer science and enginnering fundamental organisation.pptx
computer science and enginnering fundamental organisation.pptx
 
Components of a digital computer.ppt
Components of a digital computer.pptComponents of a digital computer.ppt
Components of a digital computer.ppt
 

Último

How to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesHow to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesCeline George
 
In - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxIn - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxAditiChauhan701637
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxSaurabhParmar42
 
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRADUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRATanmoy Mishra
 
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxPISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxEduSkills OECD
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17Celine George
 
How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17Celine George
 
Quality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICEQuality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICESayali Powar
 
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptxSandy Millin
 
How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17Celine George
 
CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapitolTechU
 
M-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxM-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxDr. Santhosh Kumar. N
 
What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?TechSoup
 
Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational PhilosophyShuvankar Madhu
 
The Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsThe Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsEugene Lysak
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfMohonDas
 
Human-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesHuman-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesMohammad Hassany
 

Último (20)

How to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesHow to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 Sales
 
In - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxIn - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptx
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptx
 
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRADUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
 
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxPISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
 
Personal Resilience in Project Management 2 - TV Edit 1a.pdf
Personal Resilience in Project Management 2 - TV Edit 1a.pdfPersonal Resilience in Project Management 2 - TV Edit 1a.pdf
Personal Resilience in Project Management 2 - TV Edit 1a.pdf
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17
 
How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17
 
Quality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICEQuality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICE
 
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
 
How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17
 
CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptx
 
M-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxM-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptx
 
What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?
 
Prelims of Kant get Marx 2.0: a general politics quiz
Prelims of Kant get Marx 2.0: a general politics quizPrelims of Kant get Marx 2.0: a general politics quiz
Prelims of Kant get Marx 2.0: a general politics quiz
 
Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational Philosophy
 
The Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsThe Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George Wells
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdf
 
Human-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesHuman-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming Classes
 
Finals of Kant get Marx 2.0 : a general politics quiz
Finals of Kant get Marx 2.0 : a general politics quizFinals of Kant get Marx 2.0 : a general politics quiz
Finals of Kant get Marx 2.0 : a general politics quiz
 

Unit 6

  • 1. Review of computer hardware Principles of i/o hardware Principles of i/o software i/o software layers Disks, clocks Graphical user interfaceGraphical user interface Network terminal Power management Files,directories,file system implementation File system layout, implementing files Implementing directories, shared files, Disc space management ,examples of file system CDROM,MSDODS,Win98,UNIX.
  • 2. The control of devices connected to the computer is a major aspect of operating system. There is a wide variety I/O devices These devices are vary in their function and speed. It is difficult for any operating system to develop aIt is difficult for any operating system to develop a general ,consistent solution for these I/O devices.
  • 3. There is no single method to control these i/o devices. Every operating system separates methods of dealing with i/o devices from the rest of OS Devices drives are becoming popular Devices drivers provide standard interface between i/oDevices drivers provide standard interface between i/o devices and OS.
  • 4. A computer uses many kind of devices .These devices can be put in three categories 1.Storage devices such as Disks ,tapes. 2.Transmission devices, such as modem ,network cards.2.Transmission devices, such as modem ,network cards. 3. Human interface devices such as screen, mouse, keyboard, etc
  • 5. I/o devices communicate with a computer system through a port. Devices are connected through a bus . A bus is set of wires. Interaction through a bus is through a set of messages.messages. A controller is a collection of electronics circuit That can operate a port ,a bus or a device.
  • 6. I/o devices can be put in two categories 1.Block Devices 2.Character devices Block devices:- Blocks device stores information in fixed size blocks. Each blocks has unique address .each blocks can be accessed independently.eg disks ,tape ,CD
  • 7. Character devices:- A character devices accepts or delivers a stream of character. There is no concept of blocking in a character devices. Terminals ,printers, network interface, keyboards etc,are character devices.etc,are character devices. Some devices like clocks do not fit into any of the above two categories . Clocks simply generate interrupts at well defined intervals .
  • 8. A device controller consists of electronic components. It interact both with the device and the system bus. Disk Printer DiskDisk Printer Other controller CPU Disk controller Printer controller controller Memory bus
  • 9. An OS interact with the controller and it does not interact with the devices. A controller has several registers for data and control signals. The processor communicate with the controller by reading and writing data in these registers.by reading and writing data in these registers. Device control registers can be memory mapped or I/o mapped. Controller has four registers
  • 10. 1.Data in register 2. Data out register 3.Status Register Busy and Ready 4.Error condition. The OS perform I/O by writing commands into theThe OS perform I/O by writing commands into the control register
  • 11. In most of the data processing activities, a program has to accept input from the keyboards or from a secondary storage device. i/o operation refers to a data transfer between an i/o device and main memory or between an i/o device anddevice and main memory or between an i/o device and CPU. User program never interact directly with i/o devices.
  • 12. All i/o operations are performed with the help of system calls. Whenever a system call is made, CPU executes a small memory resident program known as device driver or interrupt service routine. These specialized routinesinterrupt service routine. These specialized routines interact with an i/o device with the help of i/o commands . There are four types of i/o commands 1.control 2.Test status 3.Read 4.Write
  • 13. A CPU is general purpose processor. it is capable of addressing all needs of an i/o device. CPU executes a program that intiates,directs,and terminates the i/o operation ,the computer is said to be using programmed i/o.i/o. i/o device is very slow,CPU will be wasting a lot of its time in trivial i/o operations.
  • 14. Another technique, that can considerably improve CPU performance is known as Interrupt driven Input/output. In both programmed and interrupt driven i/o CPU is responsible for either sending and receiving of data . A slight increase in hardware enables an i/o device toA slight increase in hardware enables an i/o device to transfer a block of data to and from memory without intervention of CPU . This mode of interaction is known as DMA(Direct Memory Access)
  • 15. Thus there are three commonly used I/o techniques (data transfer mode). 1.Programmed Input/output1.Programmed Input/output 2.Interrupt Driven input/output 3. Direct Memory Access.
  • 16. Programmed i/o is useful method for computers where hardware costs need to be minimized. Entire i/o is handled by CPU with the help of small software without any additional hardware. CPU perform the following steps.CPU perform the following steps.
  • 17. 1. Read the i/o device’s status bit. 2.Test the status bit to determine if the device is ready to begin data transfer operation. 3.If the device is not ready, return to step1,;otherwise proceed with the data transfer. During the interval ,device is not ready ,CPU simply wastes its time until the devices become ready.
  • 18. When the processor, main memory, i/o share a common bus, two modes of addressing are possible memory –mapped i/o i/o mapped i/o
  • 19. Data bus Address bus Write line Read line Main memory CPU I/o module-1 i/o modules-2 Write line i/o device i/o device •Read command is for input of data •Write command is for output of data •I/o modules is used for interfacing of a Device with the system bus
  • 20. With memory mapped i/o, there is a single address space for memory location and i/o devices. Processor treats status and data registers as separates memory location. Processor uses same memory instruction to access bothProcessor uses same memory instruction to access both memory and i/o device With memory mapped i/o single read line and single write line are needed on the bus
  • 21. READ: line is activated during transfer of data from memory to CPU. e.g.: MOV Ax [AX x] in 8086 transfer a word of data from memory location x into CPU Register AX. Write : line is activated during transfer of data from CPU to memory .memory . e.g: MOV x ,AX[x AX] With memory mapped i/o, no special commands (like IN,OUT )are needed for i/o operations. A large set of instruction can be used for i/o Interfacing circuit for memory mapped i/o is complex.
  • 22. Data bus Address bus i/o Read Memory read Memory write Main memory CPU I/o module- 1 i/o modules- 2 i/o Write i/o device i/o device
  • 23. There are separate control lines for memory and i/o devices. A memory reference instruction does not effect an i/o device. A memory reference instruction for memory read will cause generation of ‘memory read’ control signal. MOV AX,x [Ax x] A memory reference instruction for memory write will cause generation of ‘memory write’ control signal.generation of ‘memory write’ control signal. MOV x ,AX [x AX ] A i/o reference instruction for i/o read will cause generation of ‘i/o read’ control signal. IN AL ,300H [AL 300H ] A i/o reference instruction for i/o write will cause generation of ‘i/o write’ control signal. OUT 300H,AL
  • 24. Major drawback of programmed i/o is busy waiting . CPU Switches to some other program without waiting for the i/o device to complete or to become free. when device become ,it inform back the CPU through adevice become ,it inform back the CPU through a mechanism known as interrupt.
  • 26. Types of interrupts Program Interrupt(s/w interrupt ) Timer interrupts i/o interrupts Hardware failureHardware failure
  • 27. Program interrupt: are generated by some condition that occurs as a result of an instruction execution, Arithmetic overflow Division by zero Execution of an illegal machine instruction Segment limit violationSegment limit violation Execution of privileged instruction Timer interrupt: are generated within processor i/o interrupt are generated due to initiation or completion of operation. Hardware failure interrupt are generated by a failure,such as power failure or memory parity error.
  • 28. Both interrupt driven and programmed i/o required involvement of CPU for data transfer. CPU can be better utilized for program execution. i/o activities are slow and involvement of CPU will not have a desired effect on system performance . When CPU was involved in data transfer, it uses the system bus twice. During memory to CPU transfer & CPU to i/o transfer. DMA increase the speed of i/o transfer by eliminating the role played by CPU in such operation. When i/o is requested , the CPU instruct the DMA module about the operation.
  • 29. Operation of a DMA transfer 29
  • 30. DAM DMA Data transfer mode 1.DMA Block Data count Data lines 1.DMA Block Transfer 2. Cycle Stealing mode 3.Transparents DMA Data register Address register Control unit Address lines Read Write
  • 31. How interrupts happens. Connections between devices and interrupt controller actually use interrupt lines on the bus rather than dedicated wires 31
  • 32. Device independence ◦ Programs can access any I/O device ◦ without specifying device in advance · (floppy, hard drive, or CD-ROM) · For examples :-A program that reads a file as input should be able to read a file on a floppy, disk, on a hard disk or on a CD-ROM, without having to modify the program for each different device. Uniform namingUniform naming ◦ name of a file or device a string or an integer ◦ not depending on which machine ◦ The name of file or device should simply be a string or an integer and not depend on the device in any way. ◦ In UNIX ,all disks can be integrated in the file system hierarchy in arbitrary ways so the user need not be aware of which name corresponds to which device. 32
  • 33. Error handling Errors should be handled as close to the hardware as possible . If controller discovers a read error , it should try to correct the error it self if it can. If it cannot ,then the device driver handled it, perhaps by just trying to reads the block again. Synchronous vs. asynchronous transfersSynchronous vs. asynchronous transfers ◦ blocked transfers vs. interrupt-driven ◦ Most physical i/o is asynchronous the CPU starts the transfer and goes off to do something else until the interrupt arrives . ◦ User program are much easier to write if the i/o operations are blocking –after a read system call the program is automatically suspended until the data are available in the buffer. 33
  • 34. Buffering ◦ data coming off a device cannot be stored in final destination ◦ For E.g when a packet comes in off the networks the operating system does not know where to put it until it has stored the packet somewhere and examined it. ◦ Also some devices have severe() real time constraints ,(e,g digital◦ Also some devices have severe() real time constraints ,(e,g digital audio devices)so the data must be put into an output buffer in advance to decoupled the rate at which the buffer is filled from the rate at which it is emptied ,in order to avoid buffer under runs. Sharable vs. dedicated devices ◦ disks are sharable ◦ tape drives would not be
  • 35. Steps in printing a string 35
  • 36. Writing a string to the printer using programmed I/O 36
  • 37. Writing a string to the printer using interrupt-driven I/O ◦ Code executed when print system call is made ◦ Interrupt service procedure 37
  • 38. Printing a string using DMA ◦ code executed when the print system call is made ◦ interrupt service procedure 38
  • 39. Layers of the I/O Software System 39
  • 40. i/o software is typically organized in four layers . Each layer has a well defined function to perform and well defined interface to the adjacent layers. Lowermost layer interacts with the hardware . Uppermost layer provides a nice and friendly interface to users
  • 41. Interrupt handlers are best hidden ◦ have driver starting an I/O operation block until interrupt notifies of completion Interrupt procedure does its taskInterrupt procedure does its task ◦ then unblocks driver that started it 41
  • 42. Steps must be performed in software after interrupt completed Save regs not already saved by interrupt hardware Set up context for interrupt service procedure. Doing this may involve setting up the TLB,MMU and Page table . Set up stack for interrupt service procedure Ack interrupt controller, reenable interrupts Copy registers from where saved Run service procedure Set up MMU context for process to run next Load new process' registers Start running the new process 42
  • 43. Logical position of device drivers is shown here Communications between drivers and device controllers goes over the bus 43
  • 44. A device driver is piece of i/o software that handles all device independent tasks. A device driver accepts abstract request from the device-independent software above it, and converts itdevice-independent software above it, and converts it into device dependent commands. A device drivers essentially converts the generals commands from the device-independent software to messages that the device type can understand.
  • 45. Each controller has some device register used to give it command or some device register used to readout its status or both. e.gMouse driver accept the information from the mouse telling how far it has moved and which button are currently depressed. In contrast, a disk driver has to know about sector, tracks, cylinders, heads, arm motion, motor drives ,head setting time and all other mechanism of making the disks work properly. Each i/o device attached to a computer needs some device- specific code for controlling it. This is called the device Driver
  • 46. Device independent i/o software refers to that set of program which provide a device independent interface to the user. The basic function of the device independent software is to perform functions common to all devices. It provides a uniform interface to the user level software. The basic function of the device inedpendent software are as follows:
  • 47. Uniform interfacing for device drivers Buffering Error reporting Functions of the device-independent I/O software 47 Error reporting Allocating and releasing dedicate devices Providing a device-independent block size
  • 48. (a) Without a standard driver interface (b) With a standard driver interface 48
  • 49. (a) Unbuffered input (b) Buffering in user space (c) Buffering in the kernel followed by copying to user space (d) Double buffering in the kernel 49
  • 50. Consider a process that wants to read data from a modem. One possible strategy for dealing with the incoming character is to have arriving character cause an interrupt .The interrupt service procedure hands the character to the user process andservice procedure hands the character to the user process and unblocks it. After putting the character somewhere ,the process reads another character and blocks again. The trouble with this way of doing business is that the user process has to be started up for every incoming character. Allowing a process to run many times for short run is inefficient , so this design is not a good one
  • 51. Networking may involve many copies 51
  • 52. Layers of the I/O system and the main functions of each layer 52
  • 53. Spooling is way of dealing with dedicated i/o device in a multiprogramming system.
  • 54. Disks come in variety of types 1.Magnetic disks (hard disks and floppy disks) 2. Arrays of disks 3.Optical disks (CD-ROMs ,CD-recordables, CD-Rewritables, DVD) A magnetic disk is a circular platter of plastic that is coated with magnetized material.A magnetic disk is a circular platter of plastic that is coated with magnetized material. The disks are mounted on a rotary drive so that the magnetized surface move in close proximity to read/write head. The disks rotate at uniform speed. Sides : The magnetic coating if applied to both sides of the platter is called as double sided disks. A disks has multiple platter that are stacked vertically . This is known as disk pack. A cylinder is defined which is the ring of all Co-centric tracks.
  • 55. Data is stored in co-centric rings know as a tracks. The width of the tracks is equal to the width of the head. These track are separated by inter tracks gaps. Tracks are divided into sector. Two adjacent sector are separated by intra tracks gaps. In a typical hard disk, a sector of 600 bytes can contain, only 512 bytes of data anddisk, a sector of 600 bytes can contain, only 512 bytes of data and remaining is control information. Both data and identification field start with synchronization byte and have 2 byte of error-detecting code. The identification field contains the basic information such as the tracks number ,sector number and head number which are needed to identify a sector.
  • 57. The most common ones are the magnetic disks(hard disks and floppy disks) .They are characterized by the fact that reads and write are equally fast, which makes them ideal as secondary memory.. Magnetics Disks are organized into cylinders, each one containing as many tracks as there are heads stacked vertically. The tracks are divided into sectors ,with the number of sector around the circumference typically being 8 to 32 on floppy disks, and up to several hundred in hard disks.
  • 58. CPU performance has been increasing exponentially over the past decade. In the 1970s, average seek times on minicomputers disks were 50 to 100msec.Now seek times are slightly under 10msec. In 1988 paper ,Patterson suggested six specific disk organizations that could be used to improve disks performance, reliability or both. These ideas were quickly adopted by industry and have led to a new class of i/o device called a RAID. RAID as Redundant array of Inexpensive Disks ,but industry redefined the I to be independent rather than Inexpensive RAID: Redundant array of Independent Disks.
  • 59. In a RAID system, a single large file is stored in several separate disks units by breaking the file up into a number of small pieces and storing these pieces on different disks. When a file is accessed for a read, all disks deliver their dataWhen a file is accessed for a read, all disks deliver their data in parallel. RAID may be implemented in hardware or in the operating system.
  • 60. RAID Level 0 It creates one large virtual disks from a number of smaller disks. Storage is grouped into logical unit called strips. The strips are mapped round –robin to consecutive array member. RAID level 0 architecture achieves the parallism but it does not include redundancy to improve reliability.include redundancy to improve reliability. Benefit:- Create a large disks. Limitation:- Files tend to get scattered over number of disks, even after a disks failure , some file data may be retrievable. In n disk array , the first n logical strips are physically stored as the first strip on each of the n disks, the second n strips are disturbed as second strips on each disks and so on.
  • 61. RAID Level-1 Redundancy is achieved by Just duplicating all the data. The data stripping is used, same as RAID Level 0. RAID level 1 stores duplicates copies of each strip, with each copy on a different disk.
  • 62. RAID Level-2 Single copies of each strip are maintained. Error correcting code such as hamming code is calculated for the corresponding bits on each data disks. The bits of code are stored in the corresponding bit position on multiple parity disks. The strips are very small, so when a block is read, all disks are accessed in parallel
  • 63. RAID Level-3 In RAID level 3,single parity bit is used instead of an error correcting code. It required just one extra disks.It required just one extra disks. The data stripping is used , similar to the other RAID Levels. If any disk in the array fails ,its data can be determined from the data on the remaining disks.
  • 64. RAID Level-4 RAID level 4 is similar to RAID level 3 , Except strips are larger. Operations to read a block involves only s single disk. Parity bit are stored in the Corresponding strips on the parity disk. A bit by bit parity strip is calculated across corresponding data blocks on each data disk. Write operation requires parity information to be calculated. Write must be performed on both the data and parity disks. For each read and write operation parity bits are checked for data reliability.
  • 65. RAID level-5 It eliminates the potential bottleneck found in RAID-4. RAID-5 distributes the parity strips across all disks.
  • 66. Disk parameters for the original IBM PC floppy disk and a Western Digital WD 18300 hard disk
  • 67. Physical geometry of a disk with two zones A possible virtual geometry for this disk 67
  • 68. Raid levels 0 through 2 Backup and parity drives are shaded 68
  • 69. Raid levels 3 through 5 Backup and parity drives are shaded 69
  • 70. Optical disks have much higher recording densities than conventional Magnetic disks. Optical disks were originally developed for the recording television Program. First – generation optical disks were invented by the Dutch electronics conglomerate Philips for holding movies . In 1980,Philips , together with Sony developed the CD( Compact Disc)In 1980,Philips , together with Sony developed the CD( Compact Disc) A CD-ROM (Compact Disk read only memory) disk is an optical Laser disk which stores digital data by using laser beams. This laser technology provides very large storages capacities, and a CD-ROM disk is able to store up to 600 MB of data All technical details given in RED book.
  • 71. A CD is prepared by using a high power infrared laser to burn 0.8 micron diameter holes in a coated glass master disk. From this master, a mold is made, with bumps where the laser holes were. Into this mold, molten Polycarbonate resin is injected toInto this mold, molten Polycarbonate resin is injected to form a CD with the same pattern of holes as the glass master. Then very thin layer of reflective aluminum is deposited on the polycarbonate, topped by a protective lacquer and finally a label. The depressions in the polycarbonate substrate are called Pits. The unburned areas between the pits are called lands.
  • 72. Recording structure of a CD or CD-ROM 72
  • 73. In 1984 Philips and Sony launched new version of CD. All details in Yellow book. The basic format of a CD-ROM consist of encoding every byte in a 14 Bit symbol.byte in a 14 Bit symbol. A group of 42 consecutive symbol forms a 588 bit frame. Each frame holds 192 data bits (24 bytes) remaining 396 bit bits are used for error correction and control.
  • 74. Logical data layout on a CD-ROM 74 Mode1: 2048 data+16 bytes Preamble+ 288 ECCMode1: 2048 data+16 bytes Preamble+ 288 ECCMode1: 2048 data+16 bytes Preamble+ 288 ECCMode1: 2048 data+16 bytes Preamble+ 288 ECC Mode2: 2336 data+ Mode2 combine data &ECCMode2: 2336 data+ Mode2 combine data &ECCMode2: 2336 data+ Mode2 combine data &ECCMode2: 2336 data+ Mode2 combine data &ECC
  • 75. Cross section of a CD-R disk and laser ◦ not to scale Silver CD-ROM has similar structure ◦ without dye layer ◦ with pitted aluminum layer instead of gold 75
  • 76. Although people are used to other write once media such as paper and photographic film , there is a demand for a rewritable CD-ROM. CD-RW uses an alloy of silver , indium ,antimony and tellurium for the recording layer.tellurium for the recording layer. CD-RW drives use laser with three different powers. At high power At medium power At low power
  • 77. DVD(Digitally Video Disk) but now (Digital versatile Disk) Hollywood would like to put multiple movies on the same disk so four format have been defined 1. Single sided, single layer(4.7 GB).1. Single sided, single layer(4.7 GB). 2. Single sided, dual layer(8.5 GB). 3. Double sided, single layer(9.4 GB). 4. Double sided ,double layer(17 GB).
  • 78. A double sided, dual layer DVD disk 78
  • 80. 80 An illustration of cylinder skew
  • 81. A hard disks consists of a stack of aluminum ,alloy or glass platters 5.25 inch or 3.5 inch in diameter. On each Platter is deposited a thin magnetizable metal oxide. After manufacturing there is no information whatsoever on disk.on disk. Before the disk can be used, each platter must receive a low level format done by software .
  • 82. Preamble:- it start with a certain bit pattern that allows the hardware to recognize the start of sector. It also contains the cylinder and sector number and some other information. Data:-The size of the data portion is determined by the low level formatting program. Most disks use 512 byte sector. ECC:- This field contains redundant information that can be used toECC:- This field contains redundant information that can be used to recover from read errors. The size and content of this field varies from manufacturer to manufacturer. Disks formatting is of two types 1. Physical formatting or Low level formatting . 2. Logical Formatting .
  • 83. Physical Formatting :- Disk must be formatted before storing a data. Disk must be divided into sector that the disk controller can read/write. Low level formatting fills the disk with a special data structure for each sector. Data structure consist of three fields: Header, data area and trailer. Sector number and error correcting codes (ECC) contained in the header and trailer.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.
  • 84. Logical Formatting:- After disk is partitioned , logical formatting used. Operating system stored the initial file system data structures onto the disk.structures onto the disk.
  • 86. Time required to read or write a disk block determined by 3 factors Seek time Rotational delay Actual transfer time Seek time : Seek time is the time required to move the disk arm to the required track . It consist of two key components : initial startup time and rate at which read/write head can arm to the required track . It consist of two key components : initial startup time and rate at which read/write head can be moved. Ts= m x n + s Where Ts= seek time, m = constants that depends on the disk drive, n = Number of track traversed. s = startup time. 86
  • 87. Rotational delay:- Disks , other than floppy disks, typically rotate at 3600 rpm, which is one revolution per 16.7 msec. Rotational Latency:-it is the time spent waiting for the target sector to appear under the read and write heads. Transfer time:- The transfer time to or form the disk from the disk depends on the rotation speed of the disk in the following fashion. By reducing the mean seek time,the system performance can be improved substantially.
  • 88. There are several scheduling algorithms. 1. First-Come First served (FCFS). 2. Shortest –seek –time-first (SSTF).2. Shortest –seek –time-first (SSTF). 3. Scan Scheduling 4. Circular Scan.
  • 89. ◦ In this scheduling, request are serviced in the sequence they arrive. ◦ FCFS is easy to program. ◦ Consider the examples of disk queue with requests involving tracks to read ◦ Consider an examples◦ Consider an examples ◦ 98,183,37,122,14,124,65,67
  • 90. ◦ The SSTF Scheduling select the disk i/o request that required the least movement of disk head from its current position. ◦ Consider an examples ◦◦ 98,183,37,122,14,124,65,67
  • 91. ◦ Scan scheduling algorithm is also called as the elevator algorithm. This algorithm developed for the two reasons 1.To preserve advantages of both FCFS & SSTF. 2. To eliminate shortcoming of2. To eliminate shortcoming of both FCFS & SSTF.
  • 92. In c-scan algorithm . Scanning and servicing is restricted to one direction only. Thus when the last track is serviced in one direction , the disk head is returned to the opposite end of the disk and the scan begin again.
  • 94. Which algorithm is this? e 94
  • 95. A disk track with a bad sector Substituting a spare for the bad sector Shifting all the sectors to bypass the bad one 95
  • 96. As we have seen,disks sometimes make errors. Good sector can suddenly become bad sectors. Whole drives can die unexpectedly. RAIDs Protect against a few sector going bad or even a drive falling out. For some applications, it is essential that never be lost or corrupted, even in the face of disk and CPU errors. Ideally, a disk should simply work all the time with no errors. Unfortunately , that is not achievable .errors. Unfortunately , that is not achievable . What is achievable that has following property When a write is issued to it, the disk either correctly writes the data or it does nothing, leaving the existing data intact .Such as system is called Stable storage. Stable devices never lost the information .
  • 97. Analysis of the influence of crashes on stable writes 97 1.Stable write 2. Stable reads 3.Crash Recovery
  • 98. Hardware clocks (also called timers) • give the current time • give the elapsed time • set a timer to trigger operation X at time T • Programmable interval timer - hardware to measure elapsed time and trigger operations • This mechanism is used by the scheduler, disk I/O subsystem, network subsystem
  • 99. • Older/simpler clocks • Tied to the 110 or 220 volt power line and cause interrupt on every voltage cycle at 50-60 Hz. • Current clocks consist of three components: • a crystal oscillator • a counter• a counter • a holding register. • Feature: • Quartz crystal generates very accurate periodic signal • This signal is fed into the counter which counts down to zero. • When the counter is zero, it causes CPU interrupt. The holding register is used to load the counter
  • 100. Modes of programmable clocks: • one-shot mode: • Software starts the clock • Copies the register value into the counter • Decrements the counter (interrupt when 0) • Stops • square-wave mode:• square-wave mode: • Clock starts • Copies the register value into the counter • Decrements the counter (interrupt when 0) • Holding register value is copied into the counter • Whole process repeats (i.e., there is no explicit start of the clock by the software) The periodic interrupts are called clock ticks. Programmable clock chips usually contain two or three independently programmable clocks.
  • 102. Clock hardware generates interrupts at known intervals. The clock hardware is served by the clock driver software. Functions of the clock driver: – Maintaining the time of day– Maintaining the time of day – Preventing processes from running longer than they are allowed to – Accounting for CPU usage – Handling alarm system call made by the user process – Providing watchdog timers for parts of the system itself – Doing profiling, monitoring and statistics gathering
  • 103. Three ways to maintain the time of day 10 3
  • 104. Simulating multiple timers with a single clock 10 4
  • 105. • Software-based timer, called soft timer, is a timer which • sets to the requested frequency as needed • is checked by the kernel when entries are made for other reasons such as system calls, TLB misses, page faults, I/O interrupts, CPU going idle. • If the soft timer has expired, the scheduled event is performed• If the soft timer has expired, the scheduled event is performed (e.g., packet transmission) with no need to switch to kernel mode. • The kernel resets the soft timer again to go off. The kernel copies the current clock value to the timer and adds the timeout interval to it. • Soft timer can avoid interrupts • the frequency of kernel entries is so high that the kernel can check on the soft timer and schedule the events without sending an interrupt.
  • 106. Network terminals are used to connect a remote user to computer over a network either local area network or wide area network The X Window system: ◦ The x windows system is a windowing graphical user interface. ◦ The program inside the x terminals that collects input from the keyboard or mouse and accepts commands from a remote computer is called the X server.server. ◦ One layer is Xlib , which is a set of library procedure for accessing the X functionality. ◦ To make programming with X easier, a toolkit consisting of the intrinsic is supplied as part of X. This layer manages buttons ,scroll bars and other GUI elements called widgets.
  • 107. The x window server ◦ Managing the i/o The x window Client ◦ runs the programs that use the x window server. After connection is establish , the client and serverAfter connection is establish , the client and server exchange four different types of packet over channel. ◦ Request ◦ Reply ◦ Event ◦ Error
  • 108. Clients and servers in the M.I.T. X Window System 10 8
  • 109. Stateless Low-level interface Machine ◦ The idea is based on traditional centralized timesharing The architecture of the SLIM terminal system
  • 110. Messages used in the SLIM protocol from the server to the terminals 11 0
  • 111. ◦ The first general purpose electronics computer, the ENIAC, had 18000 vacuum tubes and consumed 140,000 watts of power. ◦ After invention of the transistor ,power usage dropped dramatically . ◦ A desktop PC often has 200 watt power supply.
  • 112. ◦ There are two general approach to reducing energy consumption The first one is for the OS to turn off parts of the computer(mostly i/o devices). When they are not in use. The second one is for the application program to use less energy .
  • 113. Hardware issues: Batteries come in two general type Disposable Rechargeable DisposableDisposable ◦ batteries can be used to run handheld devices, but do not have enough energy to power notebook computer with large bright screens. Rechargeable ◦ batteries can store enough energy to power a notebook for a few hours.
  • 114. Operating system: ◦ operating system plays a key role in energy management. it control all the devices, so it must decide what to shut down and when to shut it down ◦ Power management bring up a number of question that operating◦ Power management bring up a number of question that operating system must deal with. ◦ Which devices can be controller ?Are they on/off or they have intermediate state? How much power is saved in the lower power states? Is energy expended to restart the devices?
  • 115. Power consumption of various parts of a laptop computer 11 5
  • 116. The use of zones for backlighting the display 11 6
  • 117. Running at full clock speed Cutting voltage by two cuts clock speed by two, cuts power by four 11 7
  • 118. A GUI is type of computer human interface on a computer. ◦ GUI usually have common characteristic such as windows,iocns,menus,and push buttonswindows,iocns,menus,and push buttons GUI usually has three major components. A windowing system. An imaging model. An application program interface(API)
  • 119. The windowing system ◦ builds the windows,menus,and dialog boxes that appear on the screen. The imaging modelThe imaging model ◦ defines the fonts and graphics that appear on the screen. The API ◦ is the mean in which the user specifies how and what windows and graphics appear on the screen.
  • 120. PURPOSE ◦ Hard drives can be very small, they still contain millions of bits and therefore need to be organized so that information can be located. This is the purpose of the file system ◦ The file system is based on management of clusters (the smallest disk unit that the operating system is able to manage). ◦ An operating system only knows how to manage whole allocation units, the more sectors per cluster, the more wasted space there will be. This is why the choice of file system is important
  • 121. All computer applications need to store and retrieve information. E.g. banking ,corporate record keeping A second problem with keeping information within the processor ‘address space’ is that when the process terminates the information is lost.is lost. For many application (e.g. databases) ,the information must be retained for weeks, months ,or even forever. A third problem is that it is frequently necessary for multiple process to access (part of )the information at the same time.
  • 122. ◦ The way to solve this problem is to make the information it self independent of any one process. ◦ Three essential requirement for long term information storage It must be possible to store a very large amount of informationIt must be possible to store a very large amount of information The information must survive the termination of the process using it. Multiple process must be able to access the information concurrently.
  • 123. ◦ The usual solution to all these problems is to store information on disks and other external media in units called files.
  • 124. Some typical file extensions
  • 125. 1.Byte sequence The file is an unstructured sequence of bytes. In effect, the operating system does not know or care what is in the file. 2.Record sequence In this model, a file is sequence of fixed length records, each with some internal structure.some internal structure. 3.Tree In this organization ,a file consist of tree of records, not necessary all the same length ,each containing the a key field in a fixed position in the record. The tree is sorted on the key field, to allow rapid searching for a particular key.
  • 126. a) Byte sequence b) Record sequence c)Tree 12 6
  • 127. 1. Regular files 2. Directories 3. Character Special files 4. Block special files
  • 128. Regular files are either ASCII files or binary files. e.g a file contains c program, file containing letter, file containing text Directories Directories are system file for maintaining the structure of theDirectories are system file for maintaining the structure of the file system. Character special files These are system files. They are related to i/o and used to model serial i/o devices such as terminals, printers. Block special files used to model disks.
  • 129. (a) An executable file (b) An archive 12 9
  • 130. Sequential access ◦ read all bytes/records from the beginning ◦ cannot jump around, could rewind or back up ◦ convenient when medium was mag tape Random access ◦ bytes/records read in any order◦ bytes/records read in any order ◦ essential for data base systems ◦ read can be … move file marker (seek), then read or … read and then move file marker 13 0
  • 131. Every file has a name and its data. In addition , all operating systems associate other information with each.E.g the date time the file was created and the file’s size. We will call these extra items the file’s attributes.
  • 133. Files exist to store information and allow it to be retrieved later. Different system provide different operation to allow storage and retrieval. Below is a discussion of the most common system calls relating to files.files.
  • 134. 1. Create 2. Delete 3. Open 4. Close 7. Append 8. Seek 9. Get attributes 4. Close 5. Read 6. Write 9. Get attributes 10.Set Attributes 11.Rename
  • 135. (a) Segmented process before mapping files into its address space (b) Process after mapping existing file abc into one segment creating new segment for xyz 13 5
  • 136. Directories ◦ Directories is the data structure for storing details about files. A directories typically contains a number of records , one per file. Each records contains 1 File name1 File name 2 File attributes 3 Addresses of the disk block where the data are stored
  • 137. ◦ Single-Level Directory Systems ◦ Two-level Directory Systems ◦ Hierarchical Directory Systems ◦ Path Names
  • 138. The simplest from of directory system is having one directory containing all the files. Sometimes it is called the root directory . This scheme is not used multiuser system any more but could be used on a small embedded system. Advantage :Advantage : The advantage of this scheme are its simplicity and the ability to locate files quickly. Disadvantage: 1. Not suitable for the a large number of files and more than one user. 2. Because of single directories , files require unique file name. 3. it is difficult to remember the names of all the files as the number of files increase .
  • 139. A single level directory system ◦ contains 4 files ◦ owned by 3 different people, A, B, and C 13 9
  • 140. In two level directory ,each user has his own directory . It is called user file directory(UFD).Each UFD has similar structure When a user refer to a particular file, only his own UFD is searched.UFD is searched. Operating system can not accidently delete another user file that has the same name.
  • 141. Letters indicate owners of the directories and files 14 1
  • 142. The two level hierarchy eliminate conflicts among user but is not satisfactory for the user with a large number of files. It is quite common for the user to want to group their files together in logical way.files together in logical way.
  • 143. A hierarchical directory system 14 3
  • 144. When the files system is organized as directory tree, some way is needed for the specifying file names. Two different methods are commonly used . ◦ Absolute path name ◦ Relative path name
  • 145. In the first method, each file is given an absolute path name consisting of the path from the root directory to the file. E.g The path usr/ast/mailbox means that the root directory contains a subdirectory usr, which in turndirectory contains a subdirectory usr, which in turn contain a subdirectory ast which contains the file mailbox. Absolute path names always start at the root directory .
  • 146. The second method is the Relative path name. This is used in conjunction with the concept of the working Directory. A user can designate one directory as the current working directory ,in which case all path names notworking directory ,in which case all path names not beginning at root directory are taken relative to the working directory. For examples , if the current working directory is usr/ast, the file whose absolute path is usr/ast/mailbox can be referenced simply as mailbox.
  • 147. A UNIX directory tree 14 7
  • 148. 1. Create 2. Delete 3. Open dir 5. Read dir 6. Rename 7. Link3. Open dir 4. Close dir 7. Link 8. Unlink 14 8
  • 149. Files system are stored on disks. Most disks can be divided up to into one or more partitions, with independent file systems on each patitions. Sector 0 of the disks is called the MBR(Master Boot Record ) and is used to boot the computer. The end of the MBR contains the partition table. This gives the starting and ending address of each partition. One of the partition in the table is marked as the Active.
  • 150. The first one is the Superblock . It contain all the key parameters about the files system and is read into memory when the computer is booted or the file system first touched I nodes ,an array of data structure, one per file ,tellingI nodes ,an array of data structure, one per file ,telling all about the file. Root directory, which contain the top of the file system tree. Finally , the remainder of the disk typically contain all the other directories and files.
  • 151. A possible file system layout 15 1
  • 152. ◦ An important function of the file system is to manage space on the secondary storage, which includes keeping track of both disk blocks allocated to files and the free blocks available for allocation. The main problem in allocating space to files are ◦◦ Effective utilization of disks space ◦ Fast accessing of files
  • 153. Management of disk block is similar to memory management. But secondary storage introduces two additional problems. slow disk access time Large number of blocks to deal withLarge number of blocks to deal with There are three widely used techniques for allocation of disks block to a file. 1. Contiguous Allocation 2. Linked Allocation 3. Indexed Allocation
  • 154. While discussing these allocation strategies, we will consider that a file is a sequence of blocks. The conversion from logical records to physical blocks is done by the software. In contiguous allocation , files are assigned toIn contiguous allocation , files are assigned to contiguous area of secondary storage. In this scheme , user specifies in advance the size of the area needed to hold a file before creation .if desired amount of contiguous space is not available , the file cannot be created.
  • 156. Advantages : Successive records of a file are normally adjacent to each other. This increase the accessing speed of records. This allocation supports both sequential and direct accessing of file. It is necessary merely to retain theaccessing of file. It is necessary merely to retain the starting address of the file and file’s size. Disadvantages: External fragmentation
  • 157. ◦ Allocation list of blocks to a file is linked list of blocks. These blocks may be scattered through the disk. These blocks need not be contiguous . Each block contain the address of the next block . Advantages : ◦◦ Simple to implement . ◦ Disk compaction is not required . ◦ There is no problem of external fragmentation. ◦ The file size can grow or shrink dynamically.
  • 158. Disadvantages : Slow accessing of a records – to find out a records , we must start at the beginning of the file and follow the pointer until we get block containing the records. There is wastage of space for storing block pointers.There is wastage of space for storing block pointers. There is problem of reliability – A single damaged pointer can make thousands of disk block inaccessible.
  • 159. (a) Contiguous allocation of disk space for 7 files (b) State of the disk after files D and F have been removed 15 9
  • 160. Storing a file as a linked list of disk blocks 16 0
  • 161. Linked list allocation using a file allocation table in RAM 16 1
  • 162. Our last method for keeping track of which blocks belong to which file is to associate with each file a data structure called I node(index node) which lists the attributes and disk address of the file’s blocks.and disk address of the file’s blocks. Advantages : The big advantages of this scheme over linked files using an in memory table is that the I node need only be in memory when the corresponding file is open.
  • 164. Directory is data structure for the storing details about files. Directory typically contains a number of records, one per file. Each records contains file name, file attributes To perform any operation on a file, the file must be opened . To open a file, the operating system must look into the directory entries to locate themust look into the directory entries to locate the necessary file. Operating system requires pathname to locate the directory entry. The directory entry provides the information needed to find the disk blocks containing the data. File attributes are normally stored in directory entry itself.
  • 165. (a) A simple directory fixed size entries disk addresses and attributes in directory entry (b) Directory in which each entry just refers to an i-node 16 5
  • 166. So far we have assumed that files have short, fixed length names. All modern operating system support longer ,variable length files names, how can these be implemented ? 1.In line: wastes a great deal of directory space When file is removed, variable sized gap is introduced into the directory into which the next file to be entered may not fit. Pages fault may occur while reading a file name. 2. In a heap: Hash table uses
  • 167. Two ways of handling long file names in directory ◦ (a) In-line ◦ (b) In a heap 16 7
  • 168. When several users are working together on a project, they often need to share files , it is often convenient for a shared file to appear simultaneously in different directories belonging to different users.belonging to different users. The following system are called as Directed Acyclic Graph or DAG
  • 169. File system containing a shared file 16 9
  • 170. (a) Situation prior to linking (b) After the link is created (c)After the original owner removes the file 17 0
  • 171. Operating system maintain a list of free disk blocks. Free disk blocks are those blocks in a disk which are not being used by any file. Whenever a file is created , the list of free disk blocks is searched for and then allocated to the list of free blocks. When a file isto the list of free blocks. When a file is deleted, its disk space is added to the list of free block. Two method to manage free disk block are popular Linked list Bit map
  • 172. Linked list: In this method , all free disk block are linked together by each free block pointing to the next free block. This scheme required additional memory for maintaining linked list of all free disk blocks. This space could be quite large when the disk is maintaining linked list of all free disk blocks. This space could be quite large when the disk is almost empty. But if the disk is nearly full (very few free blocks) then the linked list could be the desired method. This scheme is not very efficient since to traverse the list, we must read each block is represented by a single bit.
  • 173. Bit map: In this scheme, the list of free disk blocks is implemented as bit map or bit vector. Each block is represented by a single bit 0 for a free block 1 for allocated block AdvantagesAdvantages It is very simple method It is easy to find n consecutive free block on the disk Compared to linked list the bit map requires less space since it uses 1 bit per block. Disadvantages; If the disk is nearly full then finding a free block may required many comparison
  • 174. Dark line (left hand scale) gives data rate of a disk Dotted line (right hand scale) gives disk space efficiency All files 2KB 17 4 Block size
  • 175. (a) Storing the free list on a linked list (b) A bit map 17 5
  • 176. (a) Almost-full block of pointers to free disk blocks in RAM - three blocks of pointers on disk (b) Result of freeing a 3-block file (c) Alternative strategy for handling 3 free blocks - shaded entries are pointers to free disk blocks 17 6
  • 177. Quotas for keeping track of each user’s disk use 17 7
  • 178. A file system to be dumped ◦ squares are directories, circles are files ◦ shaded items, modified since last dump ◦ each directory & file labeled by i-node number 17 8 File that has not changed
  • 179. Bit maps used by the logical dumping algorithm 17 9
  • 180. File system states (a) consistent (b) missing block (c) duplicate block in free list (d) duplicate data block 18 0
  • 181. The block cache data structures 18 1
  • 182. I-nodes placed at the start of the disk Disk divided into cylinder groups ◦ each with its own blocks and i-nodes 18 2
  • 183. With CPUs faster, memory larger ◦ disk caches can also be larger ◦ increasing number of read requests can come from cache ◦ thus, most disk accesses will be writes LFS Strategy structures entire disk as a logLFS Strategy structures entire disk as a log ◦ have all writes initially buffered in memory ◦ periodically write these to the end of the disk log ◦ when file opened, locate i-node, then find blocks 18 3
  • 184. The ISO 9660 directory entry 18 4 • Every CD ROM begins with 16 blocks whose function is not defined by the ISO (9660 Standards •Next block containing the primary volume descriptor, which contains some general information about CD ROM. System Identifier 32 bytes, Volume identifier 32 bytes
  • 185. In CP/M ,there is only one directory . Each file resides in this directory . So the work of the file system is very simple, to look up a filename it search the one and only directory. Disk block number are stored in the directory entry itself. It can store addresses of 16 blocks.itself. It can store addresses of 16 blocks. The filed EXTENT is needed because a file larger than 16 blocks occupies multiple entries. This field tells which entry comes first, second and so on. BLOCK COUNT :This field tells how many of the 16 blocks entries are in use. The user code field keeps track of the owner of the field.
  • 186. Memory layout of CP/M 18 6
  • 187. The CP/M directory entry format 18 7
  • 188. The MS-DOS directory entry 18 8
  • 189. Maximum partition for different block sizes The empty boxes represent forbidden combinations 18 9
  • 190. Bytes The extended MOS-DOS directory entry used in Windows 98 19 0
  • 191. Bytes An entry for (part of) a long file name in Windows 98 19 1 Checksum
  • 192. An example of how a long name is stored in Windows 98 19 2
  • 193. A UNIX V7 directory entry 19 3
  • 195. The steps in looking up /usr/ast/mbox 19 5