0% found this document useful (0 votes)
5 views73 pages

Unit 4 Part 1

The document covers mass storage systems, including disk structure, disk scheduling, and file system interfaces. It discusses various disk scheduling algorithms such as FCFS, SSTF, SCAN, C-SCAN, and C-LOOK, highlighting their efficiency in managing disk I/O requests. Additionally, it outlines file operations, attributes, access methods, and the importance of file system mounting for accessibility within the operating system.

Uploaded by

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

Unit 4 Part 1

The document covers mass storage systems, including disk structure, disk scheduling, and file system interfaces. It discusses various disk scheduling algorithms such as FCFS, SSTF, SCAN, C-SCAN, and C-LOOK, highlighting their efficiency in managing disk I/O requests. Additionally, it outlines file operations, attributes, access methods, and the importance of file system mounting for accessibility within the operating system.

Uploaded by

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

UNIT 4 OS

Mass Storage system – Disk Structure - Disk Scheduling and Management; File-
System Interface -
File concept - Access methods - Directory Structure - Directory
organization - File system mounting - File Sharing and Protection;
File System Implementation - File System Structure - Directory implementation -
Allocation Methods - Free Space Management;
I/O Systems – I/O Hardware, Application I/O interface, Kernel I/O subsystem.
Disk Scheduling

Based on the slides supporting


the text

1
User-Space I/O Software

Layers of the I/O system and the


main functions of each layer
2
Disk Structure
 Disk drives are addressed as large 1-dimensional
arrays of logical blocks, where the logical block is
the smallest unit of transfer.

 The 1-dimensional array of logical blocks is


mapped into the sectors of the disk sequentially.
 Sector 0 is the first sector of the first track

on the outermost cylinder.


 Mapping proceeds in order through that track,

then the rest of the tracks in that cylinder, and


then through the rest of the cylinders from
outermost to innermost.

3
Disk Scheduling
 The operating system is responsible for using
hardware efficiently — for the disk drives, this
means having a fast access time and disk
bandwidth.
 Access time has two major components
 Seek time is the time for the disk are to

move the heads to the cylinder containing


the desired sector.
 Rotational latency is the additional time

waiting for the disk to rotate the desired sector


to the disk head.
 Minimize seek time
 Seek time  seek distance
 Disk bandwidth is the total number of bytes
transferred, divided by the total time between
the first request for
service and the completion of the last transfer. 4
Disk Arm Scheduling Algorithms
(1)
 Time required to read or write
a disk block determined by 3
factors
1. Seek time
2. Rotational delay
3. Actual transfer time
 Seek time dominates
 Error checking is
done by controllers
5
Disk Scheduling (Cont.)
 Several algorithms exist to schedule the
servicing of disk I/O requests.
 We illustrate them with a request queue (0-
199).

98, 183, 37, 122, 14, 124, 65, 67

Head pointer 53
8
FCFS

Illustration shows total head movement of 640 cylinders.

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

11
SCAN
 The disk arm starts at one end of the
disk, and moves toward the other
end, servicing requests until it gets
to the other end of the disk, where
the head movement is reversed and
servicing continues.
 Sometimes called the elevator
algorithm.
 Illustration shows total head
movement of 208 cylinders.
12
SCAN (Cont.)

13
C-SCAN
 Provides a more uniform wait time than
SCAN.
 The head moves from one end of the disk
to the other. servicing requests as it goes.
When it reaches the other end, however,
it immediately returns to the beginning of
the disk, without servicing any requests
on the return trip.
 Treats the cylinders as a circular list that
wraps around from the last cylinder to
the first one.
14
C-SCAN (Cont.)

15
C-LOOK
 Version of C-SCAN
 Arm only goes as far as the last
request in each direction, then
reverses direction immediately,
without first going all the way to
the end of the disk.
16
C-LOOK (Cont.)

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

1. File attributes
2. File Operations
3. File types
4. File Structure
5. File Internal Structure
File Attributes - NILTIPS
FILE OPERATIONS

1. CREATE
2. READ
3. WRITE
4. REPOSITION
5. DELETE
6. TRUNCATE
INTERNAL FILE STRUCTURE

● Internally, locating an offset within a file can be complicated for the operating system.
● Disk systems typically have a well-defined block size determined by the size of a
sector.
● All disk I/O is performed in units of one block (physical record), and all blocks
are the same size. It is unlikely that the physical record size will exactly
match the length of the desired logical record.
● Logical records may even vary in length. Packing a number of logical
records into physical blocks is a common solution to this problem.
● For example, the UNIX operating system defines all files to be simply streams
of bytes. Each byte is individually addressable by its offset from the beginning
(or end) of the file. In this case, the logical record size is 1 byte.
● The file system automatically packs and unpacks bytes into physical disk
blocks— say, 512 bytes per block—as necessary.
● The logical record size, physical block size, and packing technique
determine how many logical records are in each physical block.
● The packing can be done either by the user’s application program or by
the operating system.
● THE END
Sequential Access –

It is the simplest access method. Information in the file is processed in order, one record
after the other. This mode of access is by far the most common; for example, editor and
compiler usually access the file in this fashion.

Read and write make up the bulk of the operation on a file. A read operation -read next-
read the next position of the file and automatically advance a file pointer, which keeps
track I/O location. Similarly, for the -write next- append to the end of the file and
advance to the newly written material.
.Direct Access –
Another method is direct access method also known as relative access method. A fixed-length
logical record that allows the program to read and write record rapidly. in no
particular order. The direct access is based on the disk model of a file since disk allows
random access to any file block. For direct access, the file is viewed as a numbered
sequence of block or record. Thus, we may read block 14 then block 59, and then we
can write block 17. There is no restriction on the order of reading and writing for a
direct access file.
A block number provided by the user to the operating system is normally a relative block
number, the first relative block of the file is 0 and then 1 and so on
Index sequential method –
It is the other method of accessing a file that is built on the top of the sequential
access method. These methods construct an index for the file. The index, like an index in
the back of a book, contains the pointer to the various blocks. To find a record in the file,
we first search the index, and then by the help of pointer we access the file directly.

Key points:
● It is built on top of Sequential access.
● It control the pointer by using inde
● THE END
STORAGE STRUCTURE
DIRECTORY OPERATIONS
DIRECTORY STRUCTURE
TREE STRUCTURE DIRECTORY- KEY POINTS
ACYCLIC KEY POINTS
● THE END
File system mounting
● Just as a file must be opened before it is used, a file system must be mounted before it can be
available to processes on the system. More specifically, the directory structure may be built out of
multiple volumes, which must be mounted to make them available within the file-system name
space.
● The operating system is given the name of the device and the mount point—the location within the
file structure where the file system is to be attached. Some operating systems require that a file
system type be provided, while others inspect the structures of the device and determine the type of
file system. Typically, a mount point is an empty directory.
● For instance, on a UNIX system, a file system containing a user’s home directories might be mounted
as /home; then, to access the directory structure within that file system, we could precede the
directory names with /home, as in /home/jane
● Next, the operating system verifies that the device contains a valid file system. It does so by asking
the device driver to read the device directory and verifying that the directory has the expected
format. Finally, the operating system notes in its directory structure that a file system is mounted
at the specified mount point. This scheme enables the operating system to traverse its directory
structure, switching among file systems, and even file systems of varying types, as appropriate.
● Systems impose semantics to clarify functionality. For example, a system may disallow a mount
over a directory that contains files; or it may make the mounted file system available at that
directory and obscure the directory’s existing files until the file system is unmounted, terminating
the use of the file system and allowing access to the original files in that directory
● Consider the actions of the Mac OS X operating system. Whenever the system encounters a disk for
the first time (either at boot time or while the system is running), the Mac OS X operating system
searches for a file system on the device. If it finds one, it automatically mounts the file system under
the /Volumes directory, adding a folder icon labeled with the name of the file system (as stored in
the device directory). The user is then able to click on the icon and thus display the newly mounted
file system
● THE END
FILE SHARING
● THE END
EXAMPLE

You might also like