SlideShare a Scribd company logo
1 of 43
Download to read offline
Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10h Edition
Chapter 5: File Management
System
Dr. Amar Nath
AP, SLIET, Longowal
14.2 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Outline
▪ File Concept
▪ File Structure
▪ Access Methods
▪ Allocation Method
▪ Directories Structure
14.3 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Introduction
▪ File Management System : It includes the tasks like how to create, store and
manipulate the file.
▪
What is a File:
• A file is an object on a computer that stores data, information, settings, or
commands used with a computer program.
• Or A file is sequence of bits, bytes, lines or records created by its
owner.
• On a computer there are three types of files, application files, data files,
and system files.
G:My DriveSLIET
DATASLIET_3Nov_20200_Taught_Courses0_Course_2021-
22_EvenSemOS_CS-122_21CDMy_OS_PPTs
Where are files stored?
Computer files are stored on a drive (e.g.,
the hard drive), disc (e.g., DVD), and
a diskette (e.g., floppy disk) and may be
in a folder (directory) on that medium.
14.4 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Files 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
14.5 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
14.6 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Hide a folder
attrib +h +s +r name_of_the_file_with_extension
i) attrib means attributes.
ii) + means we are adding an attribute.
iii) h means hidden, s means system file, r means read only.
14.7 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Unhide
13.8 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Directory Structure
 A directory is a container that is used to contain
folders and files. It organizes files and folders in a
hierarchical manner.
 A collection of nodes containing information about all
files
 Both the directory structure and the files reside on
disk
13.9 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
13.10 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Types of Directory
 Single-level directory
 The single-level directory is the simplest directory structure. In it, all
files are contained in the same directory which makes it easy to
support and understand.
 A single level directory has a significant limitation, however, when
the number of files increases or when the system has more than one
user. Since all the files are in the same directory, they must have a
unique name. if two users call their dataset test, then the unique
name rule violated.
14.11 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Advantages:
•Since it is a single directory, so its implementation is very easy.
•If the files are smaller in size, searching will become faster.
•The operations like file creation, searching, deletion, updating
are very easy in such a directory structure.
Disadvantages:
•There may chance of name collision because two files can have
the same name.
•Searching will become time taking if the directory is large.
•This can not group the same type of files together.
14.12 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Two-level directory –
Two-level directory –
As we have seen, a single level directory often leads to
confusion of files names among different users. the solution
to this problem is to create a separate directory for each
user. In the two-level directory structure, each user has their
own user files directory (UFD).
14.13 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Advantages:
•We can give full path like /User-name/directory-name/.
•Different users can have the same directory as well as the file
name.
•Searching of files becomes easier due to pathname and user-
grouping.
Disadvantages:
•A user is not allowed to share files with other users.
•Still, it not very scalable, two files of the same type cannot be
grouped together in the same user.
14.14 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Operations on File
14.15 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Now let's describe briefly about all the above most common operations that can be
performed with files.
File Create Operation
The file is created with no data.
The file create operation is the first step of the file.
Without creating any file, there is no any operation can be performed.
File Delete Operation
File must has to be deleted when it is no longer needed just to free up the disk space.
The file delete operation is the last step of the file.
After deleting the file, it doesn't exist.
14.16 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
File Open Operation
The process must open the file before using it.
File Close Operation
The file must be closed to free up the internal table space, when all the
accesses are finished and the attributes and the disk addresses are no
longer needed.
File Read Operation
The file read operation is performed just to read the data that are stored
in the required file.
14.17 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
File Write Operation
The file write operation is used to write the data to the file, again, generally at
the current position.
File Append Operation
The file append operation is same as the file write operation except that the file
append operation only add the data at the end of the file.
File Seek Operation
For random access files, a method is needed just to specify from where to take
the data. Therefore, the file seek operation performs this task.
14.18 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
File Rename Operation
The file rename operation is used to change the name of the existing file.
● Truncating a file. The user may want to erase the contents of a file but
keep its attributes. Rather than forcing the user to delete the file and
then recreate it, this function allows all attributes to remain unchanged
(except for file length) but lets the file be reset to length zero and its file
space released.
14.19 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
n summary, several pieces of information are associated with an
open file.
● File pointer.
● File-open count.
● Disk location of the file. The information needed to locate the
file on disk is kept in memory so that the system does not have
to read it from disk for each operation.
● Access rights
14.20 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
File-System Structure
▪ File structure
• Logical storage unit
• Collection of related information
▪ File system resides on secondary storage (disks)
• Provided user interface to storage, mapping logical to physical
• Provides efficient and convenient access to disk by allowing data
to be stored, located retrieved easily
▪ Disk provides in-place rewrite and random access
• I/O transfers performed in blocks of sectors (usually 512 bytes)
▪ File control block (FCB) – storage structure consisting of information
about a file
▪ Device driver controls the physical device
▪ File system organized into layers
14.21 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
File System Layers
▪ Device drivers manage I/O devices at the I/O control layer
Given commands like
read drive1, cylinder 72, track 2, sector 10, into memory
location 1060
Outputs low-level hardware specific commands to hardware
controller
▪ Basic file system given command like “retrieve block 123”
translates to device driver
▪ Also manages memory buffers and caches (allocation, freeing,
replacement)
• Buffers hold data in transit
• Caches hold frequently used data
14.22 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
▪ Many file systems, sometimes many within an
operating system
• Each with its own format:
• CD-ROM is ISO 9660;
• Unix has UFS, FFS;
• Windows has FAT, FAT32, NTFS as well as
floppy, CD, DVD Blu-ray,
• Linux has more than 130 types, with extended
file system ext3 and ext4 leading; plus
distributed file systems, etc.)
• New ones still arriving – ZFS, GoogleFS, Oracle
ASM, FUSE
File System Layers (Cont.)
14.23 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
File Control Block (FCB)
▪ OS maintains FCB per file, which contains many details about
the file
• Typically, inode number, permissions, size, dates
• Example
14.24 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
File Access Method in OS
▪ There are three ways to access a file into a computer system:
Sequential-Access,
▪ Direct Access,
▪ Index sequential Method.
Sequential Access –
It is the simplest access method. Information in the file is processed
in order, one record after the other.
▪ 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.
13.25 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Sequential Access
 Operations
• read next
• write next
• Reset
• no read after last write (rewrite)
 Figure
Data is accessed one record right after another record
in an order.
Such a method is reasonable for tape, and cassette.
13.26 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Simulation of Sequential Access on Direct-access File
13.27 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Direct/Random Access
 Operations
• read n
• write n
• position to n
 read next
 write next
 rewrite n
n = relative block number
 Relative block numbers allow OS to decide where file
should be placed
 It is done in HDD, CD- and DVDs
It is based on the disk-model of a file, as a disk allows random access to
any block.
The Direct Access is mostly required in the case of database systems.
13.28 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
13.29 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Example of Index and Relative Files
Here an index contains the pointers to various blocks of the
file.
If a file can be sorted on any of the filed then an index can be assigned to a
group of certain records.
However, A particular record can be accessed by its index. The index is
nothing but the address of a record in the file.
14.30 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Allocation Method
▪ An allocation method refers to
how disk blocks are allocated
for files:
• Contiguous
• Linked
• File Allocation Table (FAT)
Indexed
14.31 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Contiguous Allocation Method
▪ An allocation method refers to how disk blocks are
allocated for files:
▪ Each file occupies set of contiguous blocks
• Best performance in most cases
• Simple – only starting location (block #) and length
(number of blocks) are required
• Problems include:
4 Finding space on the disk for a file,
4 Knowing file size,
4 External fragmentation, need for compaction
off-line (downtime) or on-line
14.32 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Contiguous Allocation (Cont.)
▪ Mapping from logical to physical
(block size =512 bytes)
▪ Block to be accessed = starting
address + Q
▪ Displacement into block = R
LA/512
Q
R
14.33 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Linked Allocation
▪ Each file is a linked list of blocks
▪ File ends at nil pointer
▪ No external fragmentation
▪ Each block contains pointer to next block
▪ No compaction, external fragmentation
▪ Free space management system called when new
block needed
▪ Improve efficiency by clustering blocks into groups but
increases internal fragmentation
▪ Reliability can be a problem
▪ Locating a block can take many I/Os and disk seeks
14.34 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Linked Allocation Example
▪ Each file is a linked list of disk blocks: blocks may be scattered
anywhere on the disk
▪ Scheme
14.35 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Linked Allocation (Cont.)
▪ Mapping
▪ Block to be accessed is the Qth block in the linked chain
of blocks representing the file.
▪ Displacement into block = R + 1
LA/51
1
Q
R
14.36 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
FAT Allocation Method
▪ Beginning of volume has table, indexed by block number
▪ Much like a linked list, but faster on disk and cacheable
▪ New block allocation simple
14.37 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
File-Allocation Table
14.38 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Indexed Allocation Method
▪ Each file has its own index block(s) of pointers to its data blocks
▪ Logical view
14.39 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Example of Indexed Allocation
14.40 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Indexed Allocation – Small Files
▪ Need index table
▪ Random access
▪ Dynamic access without external fragmentation, but have
overhead of index block
▪ Mapping from logical to physical in a file of maximum size of 256K
bytes and block size of 512 bytes. We need only 1 block for index
table
▪ Calculation:
• Q = displacement into index table
• R = displacement into block
LA/512
Q
R
14.41 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Indexed Allocation – Large Files
▪ Mapping from logical to physical in a file of unbounded
length (block size of 512 words)
• Linked scheme – Link blocks of index table (no limit on
size)
• Multi-level indexing
14.42 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Indexed Allocation – Two-Level Scheme
Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10h Edition
Thanks

More Related Content

Similar to File_mngtChap6.pdf

Ch11 file system implementation
Ch11 file system implementationCh11 file system implementation
Ch11 file system implementationAbdullah Al Shiam
 
638241896796578949.PPTcfrdrservbvmnbmnbjh
638241896796578949.PPTcfrdrservbvmnbmnbjh638241896796578949.PPTcfrdrservbvmnbmnbjh
638241896796578949.PPTcfrdrservbvmnbmnbjhprincekushwahfzd
 
ch12_fileImplementation.pdf
ch12_fileImplementation.pdfch12_fileImplementation.pdf
ch12_fileImplementation.pdfHoNguyn746501
 
Hdg explains swapfile.sys, hiberfil.sys and pagefile
Hdg explains   swapfile.sys, hiberfil.sys and pagefileHdg explains   swapfile.sys, hiberfil.sys and pagefile
Hdg explains swapfile.sys, hiberfil.sys and pagefileTrường Tiền
 
Hdg explains swapfile.sys, hiberfil.sys and pagefile
Hdg explains   swapfile.sys, hiberfil.sys and pagefileHdg explains   swapfile.sys, hiberfil.sys and pagefile
Hdg explains swapfile.sys, hiberfil.sys and pagefileTrường Tiền
 
10.file system interface
10.file system interface10.file system interface
10.file system interfaceSenthil Kanth
 
White Paper: Still All on One Server: Perforce at Scale
White Paper: Still All on One Server: Perforce at ScaleWhite Paper: Still All on One Server: Perforce at Scale
White Paper: Still All on One Server: Perforce at ScalePerforce
 
File Management in Operating Systems
File Management in Operating SystemsFile Management in Operating Systems
File Management in Operating Systemsvampugani
 
UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptx
UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptxUNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptx
UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptxLeahRachael
 
Lamp1
Lamp1Lamp1
Lamp1Reka
 
Lamp
LampLamp
LampReka
 

Similar to File_mngtChap6.pdf (20)

Ch11 file system implementation
Ch11 file system implementationCh11 file system implementation
Ch11 file system implementation
 
Ch11 file system interface
Ch11 file system interfaceCh11 file system interface
Ch11 file system interface
 
Operating system
Operating systemOperating system
Operating system
 
638241896796578949.PPTcfrdrservbvmnbmnbjh
638241896796578949.PPTcfrdrservbvmnbmnbjh638241896796578949.PPTcfrdrservbvmnbmnbjh
638241896796578949.PPTcfrdrservbvmnbmnbjh
 
ch12_fileImplementation.pdf
ch12_fileImplementation.pdfch12_fileImplementation.pdf
ch12_fileImplementation.pdf
 
Hdg explains swapfile.sys, hiberfil.sys and pagefile
Hdg explains   swapfile.sys, hiberfil.sys and pagefileHdg explains   swapfile.sys, hiberfil.sys and pagefile
Hdg explains swapfile.sys, hiberfil.sys and pagefile
 
Hdg explains swapfile.sys, hiberfil.sys and pagefile
Hdg explains   swapfile.sys, hiberfil.sys and pagefileHdg explains   swapfile.sys, hiberfil.sys and pagefile
Hdg explains swapfile.sys, hiberfil.sys and pagefile
 
10.file system interface
10.file system interface10.file system interface
10.file system interface
 
Edubooktraining
EdubooktrainingEdubooktraining
Edubooktraining
 
White Paper: Still All on One Server: Perforce at Scale
White Paper: Still All on One Server: Perforce at ScaleWhite Paper: Still All on One Server: Perforce at Scale
White Paper: Still All on One Server: Perforce at Scale
 
ppt ch10
ppt ch10ppt ch10
ppt ch10
 
File Management in Operating Systems
File Management in Operating SystemsFile Management in Operating Systems
File Management in Operating Systems
 
File System operating system operating system
File System  operating system operating systemFile System  operating system operating system
File System operating system operating system
 
os
osos
os
 
file management
 file management file management
file management
 
UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptx
UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptxUNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptx
UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptx
 
Lamp1
Lamp1Lamp1
Lamp1
 
Lamp1
Lamp1Lamp1
Lamp1
 
Lamp
LampLamp
Lamp
 
C) ICT Application
C) ICT ApplicationC) ICT Application
C) ICT Application
 

More from DrAmarNathDhebla

OS_Process_Management_Chap4.pptx
OS_Process_Management_Chap4.pptxOS_Process_Management_Chap4.pptx
OS_Process_Management_Chap4.pptxDrAmarNathDhebla
 
Operating_System_Concepts_8th_EditionA4.pdf
Operating_System_Concepts_8th_EditionA4.pdfOperating_System_Concepts_8th_EditionA4.pdf
Operating_System_Concepts_8th_EditionA4.pdfDrAmarNathDhebla
 
OS_MS_DOS_Structure_Chap_2.pptx
OS_MS_DOS_Structure_Chap_2.pptxOS_MS_DOS_Structure_Chap_2.pptx
OS_MS_DOS_Structure_Chap_2.pptxDrAmarNathDhebla
 
OS-CPU-Scheduling-chap5.pptx
OS-CPU-Scheduling-chap5.pptxOS-CPU-Scheduling-chap5.pptx
OS-CPU-Scheduling-chap5.pptxDrAmarNathDhebla
 
Lec3_Storage_Management.ppt
Lec3_Storage_Management.pptLec3_Storage_Management.ppt
Lec3_Storage_Management.pptDrAmarNathDhebla
 

More from DrAmarNathDhebla (8)

Command Line Interpreter
Command Line InterpreterCommand Line Interpreter
Command Line Interpreter
 
OS_StorageMngt_Chap3.pptx
OS_StorageMngt_Chap3.pptxOS_StorageMngt_Chap3.pptx
OS_StorageMngt_Chap3.pptx
 
OS_Process_Management_Chap4.pptx
OS_Process_Management_Chap4.pptxOS_Process_Management_Chap4.pptx
OS_Process_Management_Chap4.pptx
 
Operating_System_Concepts_8th_EditionA4.pdf
Operating_System_Concepts_8th_EditionA4.pdfOperating_System_Concepts_8th_EditionA4.pdf
Operating_System_Concepts_8th_EditionA4.pdf
 
OS_MS_DOS_Structure_Chap_2.pptx
OS_MS_DOS_Structure_Chap_2.pptxOS_MS_DOS_Structure_Chap_2.pptx
OS_MS_DOS_Structure_Chap_2.pptx
 
OS-CPU-Scheduling-chap5.pptx
OS-CPU-Scheduling-chap5.pptxOS-CPU-Scheduling-chap5.pptx
OS-CPU-Scheduling-chap5.pptx
 
Lec3_Storage_Management.ppt
Lec3_Storage_Management.pptLec3_Storage_Management.ppt
Lec3_Storage_Management.ppt
 
OS_Intro_Chap_1.ppt
OS_Intro_Chap_1.pptOS_Intro_Chap_1.ppt
OS_Intro_Chap_1.ppt
 

Recently uploaded

Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 

Recently uploaded (20)

POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 

File_mngtChap6.pdf

  • 1. Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10h Edition Chapter 5: File Management System Dr. Amar Nath AP, SLIET, Longowal
  • 2. 14.2 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Outline ▪ File Concept ▪ File Structure ▪ Access Methods ▪ Allocation Method ▪ Directories Structure
  • 3. 14.3 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Introduction ▪ File Management System : It includes the tasks like how to create, store and manipulate the file. ▪ What is a File: • A file is an object on a computer that stores data, information, settings, or commands used with a computer program. • Or A file is sequence of bits, bytes, lines or records created by its owner. • On a computer there are three types of files, application files, data files, and system files. G:My DriveSLIET DATASLIET_3Nov_20200_Taught_Courses0_Course_2021- 22_EvenSemOS_CS-122_21CDMy_OS_PPTs Where are files stored? Computer files are stored on a drive (e.g., the hard drive), disc (e.g., DVD), and a diskette (e.g., floppy disk) and may be in a folder (directory) on that medium.
  • 4. 14.4 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Files 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
  • 5. 14.5 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition
  • 6. 14.6 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Hide a folder attrib +h +s +r name_of_the_file_with_extension i) attrib means attributes. ii) + means we are adding an attribute. iii) h means hidden, s means system file, r means read only.
  • 7. 14.7 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Unhide
  • 8. 13.8 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Directory Structure  A directory is a container that is used to contain folders and files. It organizes files and folders in a hierarchical manner.  A collection of nodes containing information about all files  Both the directory structure and the files reside on disk
  • 9. 13.9 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition
  • 10. 13.10 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Types of Directory  Single-level directory  The single-level directory is the simplest directory structure. In it, all files are contained in the same directory which makes it easy to support and understand.  A single level directory has a significant limitation, however, when the number of files increases or when the system has more than one user. Since all the files are in the same directory, they must have a unique name. if two users call their dataset test, then the unique name rule violated.
  • 11. 14.11 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Advantages: •Since it is a single directory, so its implementation is very easy. •If the files are smaller in size, searching will become faster. •The operations like file creation, searching, deletion, updating are very easy in such a directory structure. Disadvantages: •There may chance of name collision because two files can have the same name. •Searching will become time taking if the directory is large. •This can not group the same type of files together.
  • 12. 14.12 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Two-level directory – Two-level directory – As we have seen, a single level directory often leads to confusion of files names among different users. the solution to this problem is to create a separate directory for each user. In the two-level directory structure, each user has their own user files directory (UFD).
  • 13. 14.13 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Advantages: •We can give full path like /User-name/directory-name/. •Different users can have the same directory as well as the file name. •Searching of files becomes easier due to pathname and user- grouping. Disadvantages: •A user is not allowed to share files with other users. •Still, it not very scalable, two files of the same type cannot be grouped together in the same user.
  • 14. 14.14 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Operations on File
  • 15. 14.15 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Now let's describe briefly about all the above most common operations that can be performed with files. File Create Operation The file is created with no data. The file create operation is the first step of the file. Without creating any file, there is no any operation can be performed. File Delete Operation File must has to be deleted when it is no longer needed just to free up the disk space. The file delete operation is the last step of the file. After deleting the file, it doesn't exist.
  • 16. 14.16 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition File Open Operation The process must open the file before using it. File Close Operation The file must be closed to free up the internal table space, when all the accesses are finished and the attributes and the disk addresses are no longer needed. File Read Operation The file read operation is performed just to read the data that are stored in the required file.
  • 17. 14.17 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition File Write Operation The file write operation is used to write the data to the file, again, generally at the current position. File Append Operation The file append operation is same as the file write operation except that the file append operation only add the data at the end of the file. File Seek Operation For random access files, a method is needed just to specify from where to take the data. Therefore, the file seek operation performs this task.
  • 18. 14.18 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition File Rename Operation The file rename operation is used to change the name of the existing file. ● Truncating a file. The user may want to erase the contents of a file but keep its attributes. Rather than forcing the user to delete the file and then recreate it, this function allows all attributes to remain unchanged (except for file length) but lets the file be reset to length zero and its file space released.
  • 19. 14.19 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition n summary, several pieces of information are associated with an open file. ● File pointer. ● File-open count. ● Disk location of the file. The information needed to locate the file on disk is kept in memory so that the system does not have to read it from disk for each operation. ● Access rights
  • 20. 14.20 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition File-System Structure ▪ File structure • Logical storage unit • Collection of related information ▪ File system resides on secondary storage (disks) • Provided user interface to storage, mapping logical to physical • Provides efficient and convenient access to disk by allowing data to be stored, located retrieved easily ▪ Disk provides in-place rewrite and random access • I/O transfers performed in blocks of sectors (usually 512 bytes) ▪ File control block (FCB) – storage structure consisting of information about a file ▪ Device driver controls the physical device ▪ File system organized into layers
  • 21. 14.21 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition File System Layers ▪ Device drivers manage I/O devices at the I/O control layer Given commands like read drive1, cylinder 72, track 2, sector 10, into memory location 1060 Outputs low-level hardware specific commands to hardware controller ▪ Basic file system given command like “retrieve block 123” translates to device driver ▪ Also manages memory buffers and caches (allocation, freeing, replacement) • Buffers hold data in transit • Caches hold frequently used data
  • 22. 14.22 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition ▪ Many file systems, sometimes many within an operating system • Each with its own format: • CD-ROM is ISO 9660; • Unix has UFS, FFS; • Windows has FAT, FAT32, NTFS as well as floppy, CD, DVD Blu-ray, • Linux has more than 130 types, with extended file system ext3 and ext4 leading; plus distributed file systems, etc.) • New ones still arriving – ZFS, GoogleFS, Oracle ASM, FUSE File System Layers (Cont.)
  • 23. 14.23 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition File Control Block (FCB) ▪ OS maintains FCB per file, which contains many details about the file • Typically, inode number, permissions, size, dates • Example
  • 24. 14.24 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition File Access Method in OS ▪ There are three ways to access a file into a computer system: Sequential-Access, ▪ Direct Access, ▪ Index sequential Method. Sequential Access – It is the simplest access method. Information in the file is processed in order, one record after the other. ▪ 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.
  • 25. 13.25 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Sequential Access  Operations • read next • write next • Reset • no read after last write (rewrite)  Figure Data is accessed one record right after another record in an order. Such a method is reasonable for tape, and cassette.
  • 26. 13.26 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Simulation of Sequential Access on Direct-access File
  • 27. 13.27 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Direct/Random Access  Operations • read n • write n • position to n  read next  write next  rewrite n n = relative block number  Relative block numbers allow OS to decide where file should be placed  It is done in HDD, CD- and DVDs It is based on the disk-model of a file, as a disk allows random access to any block. The Direct Access is mostly required in the case of database systems.
  • 28. 13.28 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition
  • 29. 13.29 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Example of Index and Relative Files Here an index contains the pointers to various blocks of the file. If a file can be sorted on any of the filed then an index can be assigned to a group of certain records. However, A particular record can be accessed by its index. The index is nothing but the address of a record in the file.
  • 30. 14.30 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Allocation Method ▪ An allocation method refers to how disk blocks are allocated for files: • Contiguous • Linked • File Allocation Table (FAT) Indexed
  • 31. 14.31 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Contiguous Allocation Method ▪ An allocation method refers to how disk blocks are allocated for files: ▪ Each file occupies set of contiguous blocks • Best performance in most cases • Simple – only starting location (block #) and length (number of blocks) are required • Problems include: 4 Finding space on the disk for a file, 4 Knowing file size, 4 External fragmentation, need for compaction off-line (downtime) or on-line
  • 32. 14.32 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Contiguous Allocation (Cont.) ▪ Mapping from logical to physical (block size =512 bytes) ▪ Block to be accessed = starting address + Q ▪ Displacement into block = R LA/512 Q R
  • 33. 14.33 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Linked Allocation ▪ Each file is a linked list of blocks ▪ File ends at nil pointer ▪ No external fragmentation ▪ Each block contains pointer to next block ▪ No compaction, external fragmentation ▪ Free space management system called when new block needed ▪ Improve efficiency by clustering blocks into groups but increases internal fragmentation ▪ Reliability can be a problem ▪ Locating a block can take many I/Os and disk seeks
  • 34. 14.34 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Linked Allocation Example ▪ Each file is a linked list of disk blocks: blocks may be scattered anywhere on the disk ▪ Scheme
  • 35. 14.35 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Linked Allocation (Cont.) ▪ Mapping ▪ Block to be accessed is the Qth block in the linked chain of blocks representing the file. ▪ Displacement into block = R + 1 LA/51 1 Q R
  • 36. 14.36 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition FAT Allocation Method ▪ Beginning of volume has table, indexed by block number ▪ Much like a linked list, but faster on disk and cacheable ▪ New block allocation simple
  • 37. 14.37 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition File-Allocation Table
  • 38. 14.38 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Indexed Allocation Method ▪ Each file has its own index block(s) of pointers to its data blocks ▪ Logical view
  • 39. 14.39 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Example of Indexed Allocation
  • 40. 14.40 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Indexed Allocation – Small Files ▪ Need index table ▪ Random access ▪ Dynamic access without external fragmentation, but have overhead of index block ▪ Mapping from logical to physical in a file of maximum size of 256K bytes and block size of 512 bytes. We need only 1 block for index table ▪ Calculation: • Q = displacement into index table • R = displacement into block LA/512 Q R
  • 41. 14.41 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Indexed Allocation – Large Files ▪ Mapping from logical to physical in a file of unbounded length (block size of 512 words) • Linked scheme – Link blocks of index table (no limit on size) • Multi-level indexing
  • 42. 14.42 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Indexed Allocation – Two-Level Scheme
  • 43. Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10h Edition Thanks