Presentation is loading. Please wait.

Presentation is loading. Please wait.

File Systems Kanwar Gill July 7, 2015.

Similar presentations


Presentation on theme: "File Systems Kanwar Gill July 7, 2015."— Presentation transcript:

1 File Systems Kanwar Gill July 7, 2015

2 File Systems Provides long-term storage Requirements: Two views:
Store large amounts of information Information must be persistent Multiple processes should be able to access it concurrently Two views: User view: logical organization of information OS view: managing actual physical storage media File systems then essentially: implement an abstraction for secondary storage Organize files logically Permit data sharing b/w processes/users/machines Provide protection of the data

3 File operations File sharing File access
Read, write, open, close, seek, etc. File sharing Two keys issues: Semantics of concurrent access Protection Two levels of internal tables: Per process open file table System wide open file table File access Sequential Access: read bytes one at a time Direct/Random Access: random access given block/byte number

4 Disk Layout Files span multiple disk blocks.
Problem: How can we find all the blocks for a file? Contiguous allocation Fast but causes fragmentation Linked structure Works for sequential access but not for others Indexed structure (inode) Handles random access better

5 Question: Say we have a file system with a block size of 4096 bytes. Assume that each time a disk block is read, it is cached in memory. Suppose a user program issues the following system calls for accessing the file "data". This file is 50KB (51200 bytes) in size, and is stored in the root (/) directory. Assume we start with no data or metadata cached in memory. Linked allocation For the first set of statements, assume you are using the linked allocation strategy, and that each operation is executed in sequence. (In other words, memory is not reset in between each operation.) In this system, the disk block containing the root directory is in a well-known location and can be read directly. Directory entries hold the name of a file or directory and the block number of the first block in the file. (For this question, we will ignore where meta data is stored.) How many disk blocks are read (from disk) on each system call? open read 50 bytes at offset 100 read 60 bytes at offset 12250 read 120 bytes at offset 49300 read 80 bytes at offset 22010

6 Hybrid indexed allocation
For the following statements, assume you are using a hybrid indexed allocation strategy as with UNIX: the first 12 blocks of the file are linked directly from the inode, followed by a single-indirect link, a double-indirect link, and a triple-indirect link. The root inode is known, and can be read directly. Assume each inode that needs to be read in the question below is stored in a different disk block. Remember that you are starting with no data or metadata cached in memory. How many disk blocks are read (from disk) on each system call? open read 50 bytes at offset 100 read 60 bytes at offset 12250 read 120 bytes at offset 49300 read 80 bytes at offset 22010


Download ppt "File Systems Kanwar Gill July 7, 2015."

Similar presentations


Ads by Google