1 chapter 12 file management patricia roy manatee community college, venice, fl ©2008, prentice...
TRANSCRIPT
![Page 1: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/1.jpg)
1
Chapter 12File Management
Patricia RoyManatee Community College, Venice,
FL©2008, Prentice Hall
Operating Systems:Internals and Design Principles, 6/E
William Stallings
![Page 2: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/2.jpg)
2
File Management
• File management system consists of system utility programs that run as privileged applications
• Concerned with secondary storage
• Long-term existence
• Shared between processes
• Structure (internal or directories)
![Page 3: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/3.jpg)
3
File Attributes
Possible file attributes
![Page 4: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/4.jpg)
4
File System Calls
• Principle Win32 API functions for file I/O
• Second column gives nearest UNIX equivalent
![Page 5: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/5.jpg)
5
Files System Software Architecture
![Page 6: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/6.jpg)
6
Elements of File Management
![Page 7: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/7.jpg)
7
File Management Functions
• Identify and locate a selected file
• Use a directory to describe the location of all files plus their attributes
• On a shared system describe user access control
![Page 8: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/8.jpg)
8
Criteria for File Organization
• Quick random access– Needed when accessing a single record
• Ease of update
• Economy of storage– Should be minimum redundancy in the data– Redundancy can be used to speed access such as
an index
• Simple maintenance
• Reliability
![Page 9: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/9.jpg)
9
The Pile
![Page 10: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/10.jpg)
10
The Sequential File
![Page 11: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/11.jpg)
11
Indexed Sequential File
![Page 12: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/12.jpg)
12
Indexed File
![Page 13: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/13.jpg)
13
File Organization
• The Direct or Hashed File– Directly access a block at a known address– Key field required for each record
![Page 14: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/14.jpg)
14
Performance
![Page 15: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/15.jpg)
15
File Directories
• Contains information about files– Attributes– Location– Ownership
• Directory itself is a file owned by the operating system
• Provides mapping between file names and the files themselves
![Page 16: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/16.jpg)
16
Information Elements of a File Directory
![Page 17: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/17.jpg)
17
Information Elements of a File Directory
![Page 18: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/18.jpg)
18
Hierarchical, or Tree-Structured Directory
• Master directory with user directories underneath it
• Each user directory may have subdirectories and files as entries
![Page 19: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/19.jpg)
19
Tree-Structured Directory
![Page 20: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/20.jpg)
20
Example of Tree-Structured Directory
![Page 21: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/21.jpg)
21
Hierarchical, or Tree-Structured Directory
• Files can be located by following a path from the root, or master, directory down various branches– This is the pathname for the file
• Can have several files with the same file name as long as they have unique path names
• Current directory is the working directory
• Files are referenced relative to the working directory
![Page 22: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/22.jpg)
22
Directory System Calls
• Principle Win32 API functions for directory management
• Second column gives nearest UNIX equivalent, when one exists
![Page 23: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/23.jpg)
23
File Sharing
• In multiuser system, allow files to be shared among users
• Two issues– Access rights (read, write, execute)– Management of simultaneous access (cf.
interprocess communication, mutual exclusion)
![Page 24: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/24.jpg)
24
Access Matrix
![Page 25: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/25.jpg)
25
Access Control List
![Page 26: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/26.jpg)
26
Capability Lists
![Page 27: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/27.jpg)
27
File System Implementation
A possible file system layout
![Page 28: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/28.jpg)
28
Secondary Storage Management
• Space must be allocated to files
• Must keep track of the space available for allocation
![Page 29: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/29.jpg)
29
Disk Space Management
• Dark line (left hand scale) gives data rate of a disk• Dotted line (right hand scale) gives disk space efficiency• All files 2KB
Block size
![Page 30: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/30.jpg)
30
Contiguous Allocation
• Single set of blocks is allocated to a file at the time of creation
• Only a single entry in the file allocation table– Starting block and length of the file
• External fragmentation will occur– Need to perform compaction
![Page 31: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/31.jpg)
31
Contiguous File Allocation
![Page 32: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/32.jpg)
32
Contiguous File Allocation
![Page 33: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/33.jpg)
33
Chained Allocation
• Allocation on basis of individual block
• Each block contains a pointer to the next block in the chain
• Only single entry in the file allocation table– Starting block and length of file
![Page 34: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/34.jpg)
34
Chained Allocation
• No external fragmentation
• Best for sequential files
• No accommodation of the principle of locality
![Page 35: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/35.jpg)
35
Chained Allocation
![Page 36: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/36.jpg)
36
Chained Allocation
![Page 37: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/37.jpg)
37
Indexed Allocation
• File allocation table contains a separate one-level index for each file
• The index has one entry for each portion allocated to the file
• The file allocation table contains block number for the index
![Page 38: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/38.jpg)
38
Indexed Allocation
![Page 39: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/39.jpg)
39
The MS-DOS File System (1)
The MS-DOS directory entry
![Page 40: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/40.jpg)
40
The MS-DOS File System (2)
• Maximum partition for different block sizes• The empty boxes represent forbidden combinations
![Page 41: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/41.jpg)
41
Inodes
• Index node
• Control structure that contains key information for a particular file: attributes and location of blocks
![Page 42: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/42.jpg)
42
FreeBSD
File
Allocation
![Page 43: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/43.jpg)
43
UNIX Directories and Inodes
![Page 44: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/44.jpg)
44
The UNIX File System
The steps in looking up /usr/ast/mbox
![Page 45: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/45.jpg)
45
Shared Files (1)
File system containing a shared file
![Page 46: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/46.jpg)
46
Shared Files (2)
(a) Situation prior to linking
(b) After the link is created
(c) After the original owner removes the file
![Page 47: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/47.jpg)
47
Windows 2000 (1)
The NTFS master file table
![Page 48: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/48.jpg)
48
Windows 2000 (2)
An MFT record for a three-run, nine-block file
![Page 49: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/49.jpg)
49
Windows 2000 (3)
A file that requires three MFT records to store its runs
![Page 50: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/50.jpg)
50
Linux Virtual File System
• Uniform file system interface to user processes
• Represents any conceivable file system’s general feature and behavior
• Assumes files are objects that share basic properties regardless of the target file system
![Page 51: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/51.jpg)
51
Linux Virtual File System Context
![Page 52: 1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,](https://reader035.vdocument.in/reader035/viewer/2022062417/5515d26d550346d46f8b46cc/html5/thumbnails/52.jpg)
52
Linux Virtual File System Concept