SlideShare una empresa de Scribd logo
1 de 47
File System
Management
Prepared by: Janki Kansagra
File-System Interface
 File Concept
 Access Methods
 Directory Structure
 File-System Mounting
 File Sharing
 Protection
Objectives
 To explain the function of file systems
 To describe the interfaces to file systems
 To discuss file-system design tradeoffs, including access
methods, file sharing, file locking, and directory structures
 To explore file-system protection
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
File Operations
 Create
 Write
 Read
 Reposition within file
 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
Open Files
 Several pieces of data are needed to manage open files:
File pointer: pointer to last read/write location, per
process that has the file open
File-open count: counter of number of times a file is
open – to allow removal of data from open-file table
when last processes closes it
Disk location of the file: cache of data access
information
Access rights: per-process access mode information
File Types – Name, Extension
Access Methods
 Sequential Access
read next
write next
reset
no read after last write
(rewrite)
 Direct Access
read n
write n
position to n
read next
write next
rewrite n
n = relative block number
Sequential-access File
Directory Structure
 A collection of nodes containing information about all files.
F 1 F 2
F 3
F 4
F n
Directory
Files
Both the directory structure and the files reside on disk
Operations Performed on
Directory
 List directory contents
 Search for a file
 Create a file
 Delete a file
 Rename a file
 Traverse the file system
Single-Level Directory
 A single directory for all user called the root
directory
 Pros: Simple, easy to quickly locate files
 Cons: inconvenient naming (uniqueness), no
grouping
Two-Level Directory
 Separate directory for each user
 Introduces the notion of a path name
 Can have the same file name for different user
 Efficient searching
 No grouping capability
Tree-Structured
Directories
 Directories can now contain files and
subdirectories
 Efficient searching, allows grouping
Path Names
 To access a file, the user should either:
 Go to the directory where file resides, or Specify the
path where the file is
 Path names are either absolute or relative
 Absolute: path of file from the root directory
 Relative: path from the current working directory
 Most OSes have two special entries in each directory:
 “.” for current directory and “..” for parent
Acyclic-Graph Directories
 Allow sharing of subdirectories and files
Protection
 File owner/creator should be able to control:
 what can be done
 by whom
Types of access
 Read
 Write
 Execute
 Append
 Delete
 List
Categories of Users
Individual user
 Log in establishes a user-id
 Might be just local on the computer or could be
through interaction with a network service
Groups to which the user belongs
 For example, “nahum” is in “w4118”
 Again could just be automatic or could involve
talking to a service that might assign, say, a
temporary cryptographic key
UNIX Access Rights
 Mode of access: read, write, execute
 Three classes of users
RWX
a) owner access 7  1 1 1
RWX
b) group access 6  1 1 0
RWX
c) public access 1  0 0 1
 Ask manager to create a group (unique name), say
G, and add some users to the group.
 For a particular file (say game) or subdirectory,
define an appropriate access.
owner group public
chmod 761 game
Issues with Access Rights
 Just a single owner, a single group and the public
 Pro: Compact enough to fit in just a few bytes
 Con: Not very expressive
 Access Control List: This is a per-file list that tells
who can access that file
 Pro: Highly expressive
 Con: Harder to represent in a compact way
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.
Disk Scheduling
 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.
Disk Scheduling
 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
FCFS Disk Scheduling
SSTF Disk Scheduling
 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.
SSTF Disk Scheduling
SCAN Disk Scheduling
 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.
SCAN Disk Scheduling
C-SCAN Disk Scheduling
 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.
C-SCAN Disk Scheduling
LOOK and C-LOOK Disk
Scheduling
 In LOOK and C-LOOK the arm goes as far as the final
request in each direction then reverses direction
immediately without first going all the way to the end
of the disk.
 Versions of SCAN and C-SCAN that follow this
pattern are called LOOK and C-LOOK.
LOOK Disk Scheduling
C-LOOK Disk Scheduling
Disk Allocation Methods
Three allocation methods:
 Contiguous allocation
 Linked allocation
 Indexed allocation
Contiguous Allocation
 Each file occupies a set of contiguous blocks on the
disk
 Pros:
Simple – only starting location (block #) and
length (number of blocks) are required
Random access
 Cons:
Wasteful of space (dynamic storage-allocation
problem)
External fragmentation: may need to compact
space
Files cannot grow
Contiguous Allocation
Contiguous Allocation
 Some newer file systems (i.e. high-performance
Veritas File System) use a modified contiguous
allocation scheme
 Extent-based file systems allocate disk blocks in
extents
 An extent is a contiguous chunk of blocks (similar to
clusters)
 Extents are allocated when the file grows
 Extents are linked
 A file consists of one or more extents
 Extent size can be set by owner of file
Linked Allocation
 Each file is a linked list of disk blocks
 Blocks may be scattered anywhere on the disk
 Pros:
Simple – need only starting address
Free-space management system – no waste of
space
 Cons:
No efficient random access
Linked Allocation
File Allocation Table
 Variation on linked list allocation.
 FAT is located in contiguous space on disk
 Each entry corresponds to disk block number
 Each entry contains a pointer to the next block or 0
 Used by MS-DOS and OS/2
Linked Allocation
Indexed Allocation
 Brings all pointers together into the index block
 Pros:
 Efficient random access
 Dynamic access without external fragmentation
 Cons:
 Index table storage overhead
Indexed Allocation
Indexed Allocation
 Linked Scheme: If the size of index block is too
large link several index blocks together.
 Last pointer in the block points next index block.
 Nil indicates the end of index file.
Indexed Allocation
 Multi level Index: First level index block points to
second level index blocks which point to file blocks.

outer-index
index table file
Indexed Allocation
 Combined Scheme: first n-3 pointers point to data
blocks, last three are multilevel indexes.
 First block points to single level index, second block
points to second level. Third block points to third
level.
Indexed Allocation

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS
 
File Management
File ManagementFile Management
File Management
 
Types of RAM
Types of RAMTypes of RAM
Types of RAM
 
Computer hardware
Computer hardwareComputer hardware
Computer hardware
 
Overview of physical storage media
Overview of physical storage mediaOverview of physical storage media
Overview of physical storage media
 
Microprocessor
MicroprocessorMicroprocessor
Microprocessor
 
Computer storage devices
Computer storage devicesComputer storage devices
Computer storage devices
 
Processor types
Processor typesProcessor types
Processor types
 
Hard Disk Drive
Hard Disk DriveHard Disk Drive
Hard Disk Drive
 
Secondary Storage
Secondary StorageSecondary Storage
Secondary Storage
 
Kernel I/O subsystem
Kernel I/O subsystemKernel I/O subsystem
Kernel I/O subsystem
 
Chapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage SystemsChapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage Systems
 
The cpu cycle
The cpu cycleThe cpu cycle
The cpu cycle
 
Hard disk drive components
Hard disk drive componentsHard disk drive components
Hard disk drive components
 
Concurrency Control & Deadlock Handling
Concurrency Control & Deadlock HandlingConcurrency Control & Deadlock Handling
Concurrency Control & Deadlock Handling
 
Expansion slots
Expansion slotsExpansion slots
Expansion slots
 
Registers
RegistersRegisters
Registers
 
Computer hardware
Computer hardwareComputer hardware
Computer hardware
 
Advantages of DBMS
Advantages of DBMSAdvantages of DBMS
Advantages of DBMS
 
OSI Model Assignment Help
OSI Model Assignment HelpOSI Model Assignment Help
OSI Model Assignment Help
 

Similar a File Management.ppt

Similar a File Management.ppt (20)

file management_part2_os_notes.ppt
file management_part2_os_notes.pptfile management_part2_os_notes.ppt
file management_part2_os_notes.ppt
 
Chapter 11 - File System Implementation
Chapter 11 - File System ImplementationChapter 11 - File System Implementation
Chapter 11 - File System Implementation
 
Unit 3 file management
Unit 3 file managementUnit 3 file management
Unit 3 file management
 
Unit 3 chapter 1-file management
Unit 3 chapter 1-file managementUnit 3 chapter 1-file management
Unit 3 chapter 1-file management
 
file management_osnotes.ppt
file management_osnotes.pptfile management_osnotes.ppt
file management_osnotes.ppt
 
OSCh12
OSCh12OSCh12
OSCh12
 
Ch12 OS
Ch12 OSCh12 OS
Ch12 OS
 
OS_Ch12
OS_Ch12OS_Ch12
OS_Ch12
 
File system interfacefinal
File system interfacefinalFile system interfacefinal
File system interfacefinal
 
Chapter 10 - File System Interface
Chapter 10 - File System InterfaceChapter 10 - File System Interface
Chapter 10 - File System Interface
 
Chapter13
Chapter13Chapter13
Chapter13
 
Ch11 OS
Ch11 OSCh11 OS
Ch11 OS
 
OSCh11
OSCh11OSCh11
OSCh11
 
OS_Ch11
OS_Ch11OS_Ch11
OS_Ch11
 
File System Implementation
File System ImplementationFile System Implementation
File System Implementation
 
File System operating system operating system
File System  operating system operating systemFile System  operating system operating system
File System operating system operating system
 
Ch10
Ch10Ch10
Ch10
 
Files
FilesFiles
Files
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Ch11
Ch11Ch11
Ch11
 

Más de JeelBhanderi4

Process Management.ppt
Process Management.pptProcess Management.ppt
Process Management.pptJeelBhanderi4
 
2. Efficient Market Hypothesis.pptx
2. Efficient Market Hypothesis.pptx2. Efficient Market Hypothesis.pptx
2. Efficient Market Hypothesis.pptxJeelBhanderi4
 
akshardham-160916093034 (2).pdf
akshardham-160916093034 (2).pdfakshardham-160916093034 (2).pdf
akshardham-160916093034 (2).pdfJeelBhanderi4
 
Ch_6 Regulated Power Supply (1).ppt
Ch_6 Regulated Power Supply (1).pptCh_6 Regulated Power Supply (1).ppt
Ch_6 Regulated Power Supply (1).pptJeelBhanderi4
 
Chapter-4 FET (1).ppt
Chapter-4 FET (1).pptChapter-4 FET (1).ppt
Chapter-4 FET (1).pptJeelBhanderi4
 
Chapter-6 DC biasing-1.ppt
Chapter-6 DC biasing-1.pptChapter-6 DC biasing-1.ppt
Chapter-6 DC biasing-1.pptJeelBhanderi4
 
Chapter-5- Transistor Characteristics-1.ppt
Chapter-5- Transistor Characteristics-1.pptChapter-5- Transistor Characteristics-1.ppt
Chapter-5- Transistor Characteristics-1.pptJeelBhanderi4
 

Más de JeelBhanderi4 (10)

Process Management.ppt
Process Management.pptProcess Management.ppt
Process Management.ppt
 
Deadlock.ppt
Deadlock.pptDeadlock.ppt
Deadlock.ppt
 
2. Efficient Market Hypothesis.pptx
2. Efficient Market Hypothesis.pptx2. Efficient Market Hypothesis.pptx
2. Efficient Market Hypothesis.pptx
 
akshardham-160916093034 (2).pdf
akshardham-160916093034 (2).pdfakshardham-160916093034 (2).pdf
akshardham-160916093034 (2).pdf
 
Ch_6 Regulated Power Supply (1).ppt
Ch_6 Regulated Power Supply (1).pptCh_6 Regulated Power Supply (1).ppt
Ch_6 Regulated Power Supply (1).ppt
 
Chapter-4 FET (1).ppt
Chapter-4 FET (1).pptChapter-4 FET (1).ppt
Chapter-4 FET (1).ppt
 
Chapter-6 DC biasing-1.ppt
Chapter-6 DC biasing-1.pptChapter-6 DC biasing-1.ppt
Chapter-6 DC biasing-1.ppt
 
Chapter-5- Transistor Characteristics-1.ppt
Chapter-5- Transistor Characteristics-1.pptChapter-5- Transistor Characteristics-1.ppt
Chapter-5- Transistor Characteristics-1.ppt
 
Chapter 3 (2).ppt
Chapter 3 (2).pptChapter 3 (2).ppt
Chapter 3 (2).ppt
 
All C ppt.ppt
All C ppt.pptAll C ppt.ppt
All C ppt.ppt
 

Último

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 

Último (20)

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 

File Management.ppt

  • 2. File-System Interface  File Concept  Access Methods  Directory Structure  File-System Mounting  File Sharing  Protection
  • 3. Objectives  To explain the function of file systems  To describe the interfaces to file systems  To discuss file-system design tradeoffs, including access methods, file sharing, file locking, and directory structures  To explore file-system protection
  • 4. 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
  • 5. File Operations  Create  Write  Read  Reposition within file  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
  • 6. Open Files  Several pieces of data are needed to manage open files: File pointer: pointer to last read/write location, per process that has the file open File-open count: counter of number of times a file is open – to allow removal of data from open-file table when last processes closes it Disk location of the file: cache of data access information Access rights: per-process access mode information
  • 7. File Types – Name, Extension
  • 8. Access Methods  Sequential Access read next write next reset no read after last write (rewrite)  Direct Access read n write n position to n read next write next rewrite n n = relative block number
  • 10. Directory Structure  A collection of nodes containing information about all files. F 1 F 2 F 3 F 4 F n Directory Files Both the directory structure and the files reside on disk
  • 11. Operations Performed on Directory  List directory contents  Search for a file  Create a file  Delete a file  Rename a file  Traverse the file system
  • 12. Single-Level Directory  A single directory for all user called the root directory  Pros: Simple, easy to quickly locate files  Cons: inconvenient naming (uniqueness), no grouping
  • 13. Two-Level Directory  Separate directory for each user  Introduces the notion of a path name  Can have the same file name for different user  Efficient searching  No grouping capability
  • 14. Tree-Structured Directories  Directories can now contain files and subdirectories  Efficient searching, allows grouping
  • 15. Path Names  To access a file, the user should either:  Go to the directory where file resides, or Specify the path where the file is  Path names are either absolute or relative  Absolute: path of file from the root directory  Relative: path from the current working directory  Most OSes have two special entries in each directory:  “.” for current directory and “..” for parent
  • 16. Acyclic-Graph Directories  Allow sharing of subdirectories and files
  • 17. Protection  File owner/creator should be able to control:  what can be done  by whom Types of access  Read  Write  Execute  Append  Delete  List
  • 18. Categories of Users Individual user  Log in establishes a user-id  Might be just local on the computer or could be through interaction with a network service Groups to which the user belongs  For example, “nahum” is in “w4118”  Again could just be automatic or could involve talking to a service that might assign, say, a temporary cryptographic key
  • 19. UNIX Access Rights  Mode of access: read, write, execute  Three classes of users RWX a) owner access 7  1 1 1 RWX b) group access 6  1 1 0 RWX c) public access 1  0 0 1  Ask manager to create a group (unique name), say G, and add some users to the group.  For a particular file (say game) or subdirectory, define an appropriate access. owner group public chmod 761 game
  • 20. Issues with Access Rights  Just a single owner, a single group and the public  Pro: Compact enough to fit in just a few bytes  Con: Not very expressive  Access Control List: This is a per-file list that tells who can access that file  Pro: Highly expressive  Con: Harder to represent in a compact way
  • 21. 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.
  • 22. Disk Scheduling  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.
  • 23. Disk Scheduling  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
  • 25. SSTF Disk Scheduling  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.
  • 27. SCAN Disk Scheduling  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.
  • 29. C-SCAN Disk Scheduling  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.
  • 31. LOOK and C-LOOK Disk Scheduling  In LOOK and C-LOOK the arm goes as far as the final request in each direction then reverses direction immediately without first going all the way to the end of the disk.  Versions of SCAN and C-SCAN that follow this pattern are called LOOK and C-LOOK.
  • 34. Disk Allocation Methods Three allocation methods:  Contiguous allocation  Linked allocation  Indexed allocation
  • 35. Contiguous Allocation  Each file occupies a set of contiguous blocks on the disk  Pros: Simple – only starting location (block #) and length (number of blocks) are required Random access  Cons: Wasteful of space (dynamic storage-allocation problem) External fragmentation: may need to compact space Files cannot grow
  • 37. Contiguous Allocation  Some newer file systems (i.e. high-performance Veritas File System) use a modified contiguous allocation scheme  Extent-based file systems allocate disk blocks in extents  An extent is a contiguous chunk of blocks (similar to clusters)  Extents are allocated when the file grows  Extents are linked  A file consists of one or more extents  Extent size can be set by owner of file
  • 38. Linked Allocation  Each file is a linked list of disk blocks  Blocks may be scattered anywhere on the disk  Pros: Simple – need only starting address Free-space management system – no waste of space  Cons: No efficient random access
  • 40. File Allocation Table  Variation on linked list allocation.  FAT is located in contiguous space on disk  Each entry corresponds to disk block number  Each entry contains a pointer to the next block or 0  Used by MS-DOS and OS/2
  • 42. Indexed Allocation  Brings all pointers together into the index block  Pros:  Efficient random access  Dynamic access without external fragmentation  Cons:  Index table storage overhead
  • 44. Indexed Allocation  Linked Scheme: If the size of index block is too large link several index blocks together.  Last pointer in the block points next index block.  Nil indicates the end of index file.
  • 45. Indexed Allocation  Multi level Index: First level index block points to second level index blocks which point to file blocks.  outer-index index table file
  • 46. Indexed Allocation  Combined Scheme: first n-3 pointers point to data blocks, last three are multilevel indexes.  First block points to single level index, second block points to second level. Third block points to third level.