File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File...
-
date post
15-Jan-2016 -
Category
Documents
-
view
226 -
download
0
Transcript of File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File...
![Page 1: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/1.jpg)
File Systems
Topics– File– Directory– File System Implementation
Reference: Chapter 5: File Systems
Operating Systems Design and Implementation (Second Edition)
by Andrew S. Tanenbaum, Albert S. Woodhull
![Page 2: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/2.jpg)
File: Long-term Information Storage
1. Must store large amounts of data
2. Information stored must survive the termination of the process using it
3. Multiple processes must be able to access the information concurrently
![Page 3: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/3.jpg)
File Naming
Typical file extensions.
![Page 4: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/4.jpg)
File Structure
• Three kinds of files– byte sequence– record sequence– tree
![Page 5: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/5.jpg)
File Access• Sequential access
– read all bytes/records from the beginning– cannot jump around, could rewind or back up– convenient when medium was magnetic tape
• Random access– bytes/records read in any order– essential for data base systems– read can be
• move file marker (seek), then read or• read and then move file marker
![Page 6: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/6.jpg)
File Attributes
Possible file attributes
![Page 7: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/7.jpg)
File Operations
1. Create2. Delete3. Open4. Close5. Read6. Write
7. Append8. Seek9. Get attributes10.Set Attributes11.Rename
![Page 8: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/8.jpg)
A UNIX directory tree
Path Names
![Page 9: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/9.jpg)
Directory Operations
1. Create2. Delete3. Opendir4. Closedir
5. Readdir6. Rename7. Link8. Unlink
![Page 10: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/10.jpg)
File System Implementation
• Contiguous Allocation• Linked List Allocation• Linked List Allocation using Index
– FAT used by WINDOWS• I-nodes
– Used by UNIX
![Page 11: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/11.jpg)
Contiguous Allocation
(a) Contiguous allocation of disk space for 7 files(b) State of the disk after files D and E have been removed
Drawback
• Have to know maximum size of the file while creation
• Fragmentation
![Page 12: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/12.jpg)
Linked List Allocation
Storing a file as a linked list of disk blocks
Advantage• No fragmentation (except internal fragmentation)
Drawback• Random access is slow
![Page 13: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/13.jpg)
Linked List Allocation using Index
Linked list allocation using a file allocation table in RAM
Fast Random Access
![Page 14: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/14.jpg)
I-node
A UNIX i-node
![Page 15: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/15.jpg)
Implementing Directories
(a) A simple directoryfixed size entriesdisk addresses and attributes in directory entry
(b) Directory in which each entry just refers to an i-node
![Page 16: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/16.jpg)
MS-DOS Directory Entry
The MS-DOS directory entry
![Page 17: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/17.jpg)
The UNIX Directory Entry
A UNIX V7 directory entry
![Page 18: File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.](https://reader035.fdocuments.in/reader035/viewer/2022062409/56649d495503460f94a252d5/html5/thumbnails/18.jpg)
Looking up for an entry
The steps in looking up /usr/ast/mbox