Operating Systems Chapter 4
-
Upload
kirk-walsh -
Category
Documents
-
view
28 -
download
0
description
Transcript of Operating Systems Chapter 4
![Page 1: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/1.jpg)
Operating SystemsChapter 4
The File System
![Page 2: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/2.jpg)
File Attributes
Name – only information kept in human-readable form. 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.
![Page 3: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/3.jpg)
File Operations
create write read reposition within file – file seek delete truncate open(Fi) – search the directory structure on disk for
entry Fi, and move the content of entry to memory. close (Fi) – move the content of entry Fi in memory to
directory structure on disk.
![Page 4: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/4.jpg)
Access Methods
Sequential Accessread nextwrite next reset
Direct Access (Random)read nwrite nposition to n
n = relative block number
![Page 5: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/5.jpg)
Directory Structure
A collection of nodes containing information about all files.
F 1 F 2F 3
F 4
F n
Directory
Files
![Page 6: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/6.jpg)
Tree-Structured Directories
![Page 7: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/7.jpg)
Acyclic-Graph Directories
![Page 8: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/8.jpg)
Acyclic-Graph Directories (Cont.)
Two different names (aliasing) If dict deletes w/list dangling pointer.
Solutions:• Backpointers, so we can delete all pointers ->
Variable size records a problem.
• Entry-hold-count solution.
![Page 9: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/9.jpg)
Acyclic-Graph Directories (Cont.)
How do we guarantee no cycles?• Allow only links to file not
subdirectories.
• Every time a new link is added use a cycle detectionalgorithm to determine whether it is OK.
![Page 10: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/10.jpg)
Access Lists and Groups
Mode of access: read, write, execute Three classes of users
RWXa) owner access 7 1 1 1
RWXb) groups access 6 1 1 0
RWXc) public access 1 0 0 1
Attach a group to a file
chgrp G game
owner group public
chmod 761 game
![Page 11: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/11.jpg)
In-Memory File System Structures
![Page 12: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/12.jpg)
File-System Allocation Methods
Contiguous Allocation Linked Allocation Indexed Allocation
![Page 13: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/13.jpg)
Contiguous Allocation
![Page 14: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/14.jpg)
Linked Allocation
Each file is a linked list of disk blocks: blocks may be scattered anywhere on the disk.• Simple – need only starting address
• Free-space management system – no waste of space
• No random access
• Allocate as needed, link together; e.g., file starts at block 9
![Page 15: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/15.jpg)
Linked Allocation (cont.)
![Page 16: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/16.jpg)
File-Allocation Table
File-allocation table (FAT) – disk-space allocation used by MS-DOS and OS/2.
![Page 17: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/17.jpg)
Indexed Allocation
Brings all pointers together into the index block.
index table
![Page 18: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/18.jpg)
Example of Indexed Allocation
![Page 19: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/19.jpg)
Indexed Allocation (Cont.)
Need index table Random access have overhead of index block. Mapping from logical to physical in a file of
maximum size of 256K words and block size of 512 words. We need only 1 block for index table.
![Page 20: Operating Systems Chapter 4](https://reader036.fdocuments.in/reader036/viewer/2022062721/56813697550346895d9e26af/html5/thumbnails/20.jpg)
UNIX inode (UFS)