Unit-4(Notes) OS
Unit-4(Notes) OS
management
SYLLABUS
4.1 File Management
4.1.1 User view of file system
4.1.2 Attributes and Operations
C
4.1.3 File system Design
4.1.4 Disk Space
HN I
E C
O L
4.2 Directory Structure YT
P P
4.3 P
V M
Disk Organization
4.3.1 Physical structure
4.3.2 Logical structure
4.3.3 Addressing
2
4.4 Security And Protection Mechanism
4.1.1USER VIEW OF FILE
SYSTEM
File
File is a named collection of related
I C
HN
information which is stored in a secondary
storage device.
E C
O L YT
It is used to store the information
P
permanently. P
VP M
File System
A part of an operating system which deals
with files is known as file system or file manager
It manage all the files. 3
4.2.2 ATTRIBUTES AND
OPERATIONS
Attributes
1 Name : A string of alpha numerical character and
I C
HN
some special character like (_).
E C
tagT
2 Identifier : It is unique Y
P L usually a number.
O the file system.
M P
It identify the file within
V P
3 Type : It is used to identify type of a file. It is
generally expressed in the form of file extension.
5
OPERATIONS
1 Create :A new file can be created by a system
call embedded in a program or by an OS
command issued by user.
I C
E C HN
YT
2 Delete: when a file is no longer needed it has
P O L
to be deleted to free up disk space.
M P
V P : before using a file it must be opened.
3 Open
I C
HN
6 Write: Data are written to the file. The system
E C
YT
maintain a write pointer to specify the location in
P O L
a file from where to write the data content
M P
V P It is restricted form of a write pointer.
7 Append:
here data are only added to the end of the file.
7
8 Seek: For random access files, a location is
needed to specify from where to start read/write
operations.
I C
9 Get Attributes : It is used to retrieve file
attributes.
E C HN
O L YT
P
10 Set Attributes : It is used to write file
P
VP M
attributes.
VP M
10
Tree structure
Byte structure
I C
E C HN
O L YT
P P
VP M
11
4.1.4 DISK SPACE
(1) Regular File
Contain User information.
I C
(2) Directories
E C HN
YT
They are containers for files and other sub
directories.
P O L
M P
Used to manage other files and sub directories.
VP
(3) Character special files
They are related to I/O.
Used to model serial I/O devices such as
printers, terminals
12
(4) Block special files
13
4.2 DIRECTORY SYSTEMS
What is directory?
Directory operation
I C
HN
Create , delete , open , close , read , write ,
rename , link E C
O
Directory structure
L YT
P P
VP M
Single level directory
Twolevel directory
Tree structured directories
Acyclic graph directory
General graph directory
14
SINGLE LEVEL
Simplest directory structure
All files in same directory
I C
HN
Contains only files no sub directory
E C
YT
Used in Pc
Advantage
P O L
M
Simple P
VP
Easy to search
Disadvantage
Not suitable for multiuser system
I C
E C HN
O L YT
P P
VP M
16
TWO LEVEL
Each user has private directory to avoid file
collision
I C
HN
Two level directory
E C
Root directory(master file directory MFD)
L
User file directory(UFD)
O YT
P
Advantage P
VP M
Avoid file collision
Used in multi user system
Efficient searching
Disadvantage
I C
E C HN
O L YT
P P
VP M
18
TREE STRUCTURED
User can create their own sub directory
Known as hierarchical system
I C
HN
Each file has unique file path.
E C
YT
Advantage
P O L
Avoid file collision
M P
Used in multi user system
VP
Different files can be grouped
Disadvantage
19
TREE STRUCTURED
I C
E C HN
O L YT
P P
VP M
20
ACYCLIC GRAPH
When the same files need to be accessed in more
than one place in the directory structure it can be
I C
useful to provide an acyclicgraph structure.
C HN
Permits user to create shared files and director
E
L YT
shared files and directory created using links
O
P
Directory structure does not contain cycle.
P
VP M
Advantage
22
GENERAL GRAPH
Same as acyclic graph but allows cycles in
directory
I C
E C HN
YT
Advantage
O L
Allows sharing of file
P
M P
Disadvantage
VP
Searching should be done careful ,it may get
infinite.
23
I C
E C HN
O L YT
P P
VP M
24
4.3.1 PHYSICAL STRUCTURE
Hard disk is a sealed circuit. it contains one or
more platters.
I C
Platters :
E C HN
YT
Each
P O L
platter contains magnetic coating on
M P
VPboth of its surfaces.Platters are stacked one
on top of another.
Each platter contains two surfaces.
They rotate together round a central spindle. 25
Rotation speed is normally 3600, 5400 or
7200 rpm (Rotation per Minute).
Disk contain 1 to 8 platters.
Data
I C
is read from and written to these platters
E C HN
YT
using a number of read /write heads.
Thereare P O L
many heads , Each of head is
P MP
Vattached to an arm.
An arm can be moved in order to access
different parts of the platters. 26
I C
E C HN
O L YT
P P
VP M
27
A platter is a collection of circular , concentric ,
flat rings . these rings are called tracks.
Data is stored on surface of a platter inside
I C
HN
these tracks in form bits (0 to 1).there are
E C
O L YT
more than thousands f tracks on a single surface.
Each track is P
M P divided into a fixed size blocks,
V P sector. sector size is of 512 bytes and there
called
are hundred of sectors on a single track.
A group of tracks with the same radius are called
28
cylinders . each track is on different platter.
4.3.2 LOGICAL ADDRESS
Disk is considered as large one dimensional array
N I C
Size
H
of blocks is varying from system to system.
E C
Unique no. are used toL Y T identify on a disk.
O uniquely
P
Pstarts from ‘0’ or ‘1’ to some maximum
VP M
Numbering
number.
Total number of blocks depends upon a storage
C H
L Y TE
PO
Logical structure of disk
M P
VP
30
4.3.3 ADDRESSING
To read and write to and from disk ,OS tells
I C
HN
the drive the required position .
E C
O L YT
The drive moves the head to the right position
P P
and either reads or write.
V M
P are given to identify particular sector .
Address
there two methods used for addressing:
CHS (Cylinder Head Sector)
31
LBA (Logical Block Addressing)
CHS (CYLINDER –HEAD
SECTOR)
This method identifies sectors by simply
specifying the cylinder (radius) ,Head (platter
I C
side), and sector (angular position) numbers.
E C HN
Cylinder are numbered from 0 to some maximum
L YT
from outer cylinder to inner cylinder
O
P P
Sector on each track are numbered from 0 to
VP M
some maximum.
Read/write heads are given numbers ,So
combination of cylinder , head and sector
identifies individual sectors uniquely on disk.
This method was Used on earlier system.
32
LBA (LOGICAL BLOCK
ADDRESSING)
This methods identifies sector by simply
specifying the sector number.
Each sector on disk is assigned a sequential
number starting from 0 . I C
E C HN
Disk contains large one dimensional array of
fixed size blocks.
O L YT
P P
These type of logical blocks are mapped into
VP M
sectors of the disk sequentially.
Sector 0 is the first sector of first track on the
outermost cylinder . All sector on that track are
numbered.
Then other tracks in that cylinder are covered .
33
Rest of the cylinders are covered In order from
outermost to innermost.
I C
E C HN
O L YT
P P
VP M
34
DISK I/O
To read /write operation ,OS needs to provide location
(address).
I C
HN
Address is provided to hard disk controller.
E C
Hard disk controller is an interface between
L YT
operating system and disk . It converts the various
O
P
commands provided by an OS into proper signals so
P
VP M
that disk hardware can understand.
Address system to identify locations on hard disk can
O L YT
at specified cylinder. Time required for this
operation is called seek time.
P P
VP M
Wait till specified sector is directly comes
above/below the read/write head. Time
required for this operation is called rotational
latency.
Read/write data.
36
4.4 SECURITY AND
PROTECTION MECHANISM
Reliability
It means safety from physical damage.
I C
HN
File systems can be damage by hardware
E C
problems, fire, dirt, power failure
O L YT
Files may be deleted accidently.
P P
It is generally provided by keeping more than
VP M
one copies of files, means duplicating of files.
If original files are damaged then they can be
retrieved back from the backups
37
Protection
Protection means safety from improper access.
Protection is required where files can be shared
among various users.
Some files need to be shared among all users,
I C
HN
while some need to be shared among limited
users.
E C
Two types.
O L YT
P
1 Password P
VP Mhere password is associated with each file.
User can access the file if he know the
password.
2 Access control
here a list called access control list is 38
associated with each user.
Thank u…..
I C
E C HN
O L YT
P P
VP M
39