0% found this document useful (0 votes)
35 views

Operating - System File System

1. File systems must allow storing large amounts of information, ensure information survives process termination, and allow concurrent access by multiple processes. 2. Files are organized hierarchically with directories and path names to locate them. Common file operations include create, delete, read, write, rename and attribute changes. 3. File system implementations use structures like inodes to store file metadata separately from file data, and allocate data in disk blocks, using schemes like contiguous allocation, linked lists or bitmaps to track free blocks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Operating - System File System

1. File systems must allow storing large amounts of information, ensure information survives process termination, and allow concurrent access by multiple processes. 2. Files are organized hierarchically with directories and path names to locate them. Common file operations include create, delete, read, write, rename and attribute changes. 3. File system implementations use structures like inodes to store file metadata separately from file data, and allocate data in disk blocks, using schemes like contiguous allocation, linked lists or bitmaps to track free blocks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

File System

Chapter 4
File Systems (1)
Essential requirements for long-term
information storage:
1. It must be possible to store a very
large amount of information.
2. The information must survive the
termination of the process using it.
3. Multiple processes must be able to
access the information concurrently.
File Systems (2)
Think of a disk as a linear sequence of fixed size
blocks and supporting reading and writing of
blocks.
Questions that quickly arise:
1. How do you find information?
2. How do you keep one user from reading
another user’s data?
3. How do you know which blocks are free?
File Naming

Figure 4-1. Some typical file extensions.


File Structure
Windows
& linux

Figure 4-2. Three kinds of files. (a) Byte sequence.


(b) Record sequence. (c) Tree.
File Types

Figure 4-3.
(a) An
executable
file. (b) An
archive.
File Attributes

Figure 4-4. Some possible file attributes.


File Operations
The most common system calls relating to files
1. Create
2. Delete
3. Open
4. Close
5. Read
6. Write
7. Append
8. Seek
9. Get Attributes
10. Set Attributes
11. Rename
Hierarchical Directory Systems (1)

Figure 4-6. A single-level directory system containing four


files.
Hierarchical Directory Systems (2)

Figure 4-7. A hierarchical directory system.


Path Names

Figure 4-8. A UNIX


directory tree.
Directory Operations
System calls for managing directories
1. Create
2. Delete
3. Opendir
4. Closedir
5. Readdir
6. Rename
7. Link
8. Unlink
File System Layout

Figure 4-9. A possible file system layout.


Contiguous Allocation

Figure 4-10. (a) Contiguous allocation of disk space for seven


files. (b) The state of the disk after files D and F have been
removed.
Linked List Allocation

Figure 4-11. Storing a file as a linked list of disk blocks.


Linked List Allocation Using a Table in
Memory

Figure 4-12. Linked list


allocation using a
file allocation table
in main memory.
I-nodes

Figure 4-13. An example i-node.


Implementing Directories (1)

Figure 4-14. (a) A simple directory containing fixed-size entries


with the disk addresses and attributes in the directory entry.
(b) A directory in which each entry just refers to an i-node.
Shared Files (1)

Figure 4-16. File system containing a shared


file.
Shared Files (2)

Figure 4-17. (a) Situation prior to linking. (b) After the link is
created. (c) After the original owner removes the file.
Journaling File Systems
Read 1st paragraph page 285
Virtual File Systems (1)

Figure 4-18. Position of the virtual file system.


Keeping Track of Free Blocks (1)

Figure 4-22. (a) Storing the free list on a linked list. (b) A
bitmap.
Keeping Track of Free Blocks (2)

Figure 4-23. (a) An almost-full block of pointers to free disk blocks


in memory and three blocks of pointers on disk. (b) Result of
freeing a three-block file. (c) An alternative strategy for
handling the three free blocks. The shaded entries represent
pointers to free disk blocks.
Disk Quotas

Figure 4-24. Quotas are kept


track of on a per-user basis
in a quota table.
File System Backups (1)
Backups to tape are generally made to
handle one of two potential problems:
1. Recover from disaster.
2. Recover from stupidity.
File System Backup (2)
Backup considerations:
1. Entire File or only part
2. Incremental dump (backup files only that
have changed)
3. Compress the data
4. Backup on an active file (added, deleted and
modified)
5. Backup tapes storage
File System Backup (3)
Backup strategies to tape
1. Physical Dump
Start at block 0 of the disk, writes all
2. Logical Dump
Dumps all files and directories found there
that have changed since some given base
date.
File System Backups (4)

Figure 4-25. A file system to be dumped. Squares are directories,


circles are files. Shaded items have been modified since last
dump. Each directory and file is labeled by its i-node number.
1. All Directories and File that has been
modified
2. Unmarking any directories that have no
modified files or directories
3. Result Phase 2, choose directories
4. Result Phase 2, choose file
File System Backups (5)

Figure 4-26. Bitmaps used by the logical


dumping algorithm.
File System Consistency

Figure 4-27. File system states. (a) Consistent. (b) Missing block at
slot 2.(c) Duplicate block in free list at slot 4 (d) Duplicate data
block at slot 5
Caching (1)

Figure 4-28. The buffer cache data structures.


Caching (2)
• Some blocks, such as i-node blocks, are rarely
referenced two times within a short interval.
• Consider a modified LRU scheme, taking two
factors into account:
1. Is the block likely to be needed again soon?
2. Is the block essential to the consistency of the
file system?
Reducing Disk Arm Motion

Figure 4-29. (a) I-nodes placed at the start of the disk.


(b) Disk divided into cylinder groups, each with its own blocks
and i-nodes.
CD ROM File System
Read page 310, Last paragraph
The MS-DOS File System

Read page 316, second paragraph


The UNIX V7 File System (1)

Figure 4-33. A UNIX V7 directory entry.


The UNIX V7 File System (2)

Figure 4-34. A UNIX i-node.


The UNIX V7 File System (3)

Figure 4-35. The steps in looking up /usr/ast/mbox.

You might also like