0% found this document useful (0 votes)
11 views53 pages

Unit 6 OS

Uploaded by

Sandip Thamke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views53 pages

Unit 6 OS

Uploaded by

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

Government Polytechnic Jintur

Department of Computer Engg

Course Name: Operating System (OSY)


Course Code : 22516

M.A. Zahed
Lecturer
Unit VI: File Management
File Concept
⚫ Collection of related information that is recorded in
secondary storage
⚫ Types:
◦ Data
● numeric
● character
● binary
◦ Program
⚫ Contents defined by file’s creator
◦ Many types
● Consider text file, source file, executable
file
File Attributes
⚫ Name – only information kept in human-readable form
⚫ Identifier – unique tag (number) identifies file within file
system
⚫ Type – needed for systems that support different types
⚫ Location – pointer to file location on device
⚫ Size – current file size
⚫ Protection – controls who can do reading, writing,
executing
⚫ Time, date, and user identification – data for
protection, security, and usage monitoring
⚫ Information about files are kept in the directory structure,
which is maintained on the disk
⚫ Many variations, including extended file attributes such as
file checksum
⚫ Information kept in the directory structure
File Operations
⚫ Create
⚫ Write – at write pointer location
⚫ Read – at read pointer location
⚫ Reposition within file - seek
⚫ Delete
⚫ Truncate
⚫ Open(Fi) – search the directory structure on disk
for entry Fi, and move the content of entry to
memory
⚫ Close (Fi) – move the content of entry Fi in
memory to directory structure on disk
File Types – Name, Extension
Allocation Methods
⚫An allocation method refers to
how disk blocks are allocated for
files:
⚫Contiguous allocation
⚫Linked allocation
⚫Indexed allocation
Contiguous Allocation

⚫ Each file occupies a set of contiguous


blocks on the disk
⚫ Simple – only starting location (block
#) and length (number of blocks) are
required
⚫ Random access
⚫ Wasteful of space (dynamic storage-
allocation problem)
Contiguous Allocation of Disk Space
Linked Allocation
⚫ Each file is a linked list of disk blocks: blocks
may be scattered anywhere on the disk.

block = pointer
Linked Allocation (Cont.)

⚫ Simple – need only starting address


⚫ Free-space management system – no waste of space
⚫ No random access
⚫ The pointers need to be followed from block to block in order to read a file.
⚫ Each block holds a pointer to the next block.
⚫ If a pointer is damaged or lost then the file would be inaccessible.
Linked Allocation
Indexed Allocation
⚫ In this, all the pointers are kept in one location called as index block.
⚫ There is a index block assigned to each file and this index block holds the
disk block addresses of particular file.
⚫ There is a pointer from ith entry in the index block to the ith block of the file.
⚫ It supports random access.
⚫ The pointer overhead of index block is more.
Example of Indexed
Allocation
File system structure
⚫There are three ways in which
files can be structured

1. Unstructured sequence of bytes


2. Sequence of fixed length records
3. Tree structure
Unstructured sequence of bytes
⚫In this case, OS treats content of
file as a sequence of bytes. Any
meaning must be imposed by
user level programs.

⚫Both Windows and linux uses


this.

⚫It provides more flexibility


Sequence of fixed length
records
⚫In this case, file is treated as
sequence of fixed length record.
Each record may have its
internal structure.
⚫Read operation will return one
record and write operation will
append or overwrite one record.
⚫When punched cards were in
use, record size of 80 characters.
Tree structure
⚫In this case, All records not
necessarily have same length.
⚫It is mainly used in large
mainframe computers and still
used in some commercial data
processing.
File system structure
File Access methods
⚫Sequential access method

⚫Random or Direct access


Sequential access method
⚫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.
Sequential access method
⚫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 write


next append to the end of the file and
advance to the newly written
material.
Sequential access method
⚫Data is accessed one record right after
another record in an order.

⚫When we use read command, it move


ahead pointer by one

⚫When we use write command, it will


allocate memory and move the pointer
to the end of the file

⚫Such a method is reasonable for tape.


Random or Direct access
⚫It is also known as relative access
method.
⚫A filed-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.
Random or Direct access
⚫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.
Disc Organization
⚫There are platters covered with
magnetic media and those have
working surfaces.
⚫Each working surface is divided
into a number of concentric rings
called as tracks.
⚫The collection of all tracks that
are the same distance from
platter edge i.e. all tracks are
immediately above one another
Disc Organization
⚫Each track is divided into
sectors.
⚫The data on hard drive is read by
read write heads. The standard
configuration uses one head per
surface each on a separate arm
and controlled by a common arm
assembly which moves all heads
simultaneously from one cylinder
to another.
Disc Organization
⚫The storage capacity is equal to
number of heads i.e. the no of
working surfaces, at times the
number of tracks per surface, at
times the number of sectors per
track and at times the number of
bytes per sector.
Disc Organization
⚫The storage capacity is equal to
number of heads i.e. the no of
working surfaces, at times the
number of tracks per surface, at
times the number of sectors per
track and at times the number of
bytes per sector.
Directory Structure
⚫Directories are used to keep the
track of files. We need to
organize large no of files.
⚫There can be

-Single level directory system


-Two level directory system
-Tree structured/ Hierarchical
directory
Single level directory
Single level directory
⚫It is simple to implement.
⚫If a user has huge number of
files kept in a single directory, it
becomes difficult to remember
the name of each file.
Two level directory
Two level directory
⚫It solves user collision problem
as every user has a separate
directory.
⚫Independent user gets isolated
from each other.

⚫If the users are co-operative,


that is working on common task
then some systems does not
allow accessing the users file.
Tree structured / Hierarchical
directory
Tree structured / Hierarchical
directory
⚫It is quiet general and
advantageous for users to group
their files together in logical
ways. A student for example,
might have collection of files
related to different subject in
their curriculum.
⚫A tree is the most common
directory structure. It has a root
directory and every file in the
system has a unique path name.
Disc Structure
Disc Structure
Disc Structure
Disc Structure
⚫The positioning time, seek time or
random access time is the time
require to move the heads from one
cylinder to another and for the heads
to position at the correct track after
the move.

⚫The rotational latency or delay is the


amount of time required for desired
sector to rotate around and come
under read write head.
Disc Structure
⚫The transfer rate or transmission time
which the time required to move the
data electronically from disk to the
computer.

⚫With constant linear velocity CLV, the


density of bits is uniform from cylinder
to cylinder. As there are more sectors in
outer cylinders, the disk spins slower
when reading those, causing the rate of
bits passing rw head to remain constant.
Disc Structure
⚫With constant angular velocity,
CAV, the disk rotates at a
constant angular speed with the
bit density decreasing on outer
cylinders.
RAID Structure
⚫It stands for Redundant array of
inexpensive disks. Latest name is
Redundant array of independent
disk.

⚫These are used for higher reliability


and higher data transfer rate.

⚫It also improves throughput,


performance.
RAID Levels
⚫RAID level 0
⚫RAID level 1
⚫RAID level 2
⚫RAID level 3
⚫RAID level 4
⚫RAID level 5
⚫RAID level 6
RAID Level 0
⚫It includes striping at the levels of blocks.
RAID Level 1
⚫It includes mirroring.
RAID Level 2
⚫It includes error correcting codes on
additional disks allowing for any
damaged data to be reconstructed.
⚫It can use the parity bits and can be
useful detect single bit error.
RAID Level 3
⚫It is mostly similar to level 2 except that
there is bit interleaved parity error
detection.
RAID Level 4
⚫It is block interleaved parity organization
and it involves block level striping so that
blocks can read independently
RAID Level 5
⚫It is similar to level 4 except that the
parity blocks are distributed over all disks
thereby more evenly balancing the road.
RAID Level 6
⚫It is called as P+Q redundancy scheme. It
stores extra information to guard against
multiple disk failures.

⚫It extends level 5 by storing multiple bits


of error recovery codes such as Reed
Solomon codes for each bit data position.
RAID Level 6
Thank You..!!!

You might also like