1 / 20

Minix File System Functions

Minix File System Functions. allocates and de-allocates space for files keeps tracks of disk blocks and free space protects files against unauthorized usage carries out file system calls. File System in the Minix Structure. At which layer of the Minix structure is FS located?.

russ
Download Presentation

Minix File System Functions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Minix File System Functions • allocates and de-allocates space for files • keeps tracks of disk blocks and free space • protects files against unauthorized usage • carries out file system calls Minix File System

  2. File System in the Minix Structure • At which layer of the Minix structure is FS located? Minix File System

  3. File System Messages • The file system accepts 39 types of messages. • All but two are for Minix system calls. • Examples of message types are: • access, chdir, close, creat, link, time, lseek, mount, open, read, rename, unlink, umount, write. Minix File System

  4. File System Layout • The file system is stored on a disk or ona portion of a disk. • It contains the following structures: • boot block • super block • zone bit map • I-nodes • disk blocks with data Minix File System

  5. Boot Block • each file system begins with it • it contains executable code • it starts the process of loading the o.s. • it is marked with a magic number which is a flag indicating if the block is bootable or not. Minix File System

  6. Super-Block on Disk and in Main Memory • Contains the layout of the file system: • number of nodes • number of zones (V1- 16 bit) • number of I-node bit map blocks • number of zone bit map blocks • first data zone • log2 (zone/block) • maximum file size • magic number • padding • number of zones (V2 -32 bit) Minix File System

  7. Super Block in Main Memory • Pointer to I-node of mounted file system. • Pointer to I-node mounted upon. • Device number • System Flags (read only, etc.) • FS version Minix File System

  8. Bit Maps • Are used to keep track of which I-nodes and zones are free. • When the I-node (or zone) is allocated the corresponding bit is set to 1. • When the I-node (or zone) is deallocted the corresponding bit is set to 0. • The I-node 0 is never used. Minix File System

  9. mkfs • Is a utility program that builds a file system. • Example: • mkfs /dev/fd1 144 • creates an empty 1440 block file system on the floppy drive 1. • It zeroes I-node 0 and sets the lowest bit in the bit map to 1, so the file system never tries to allocate I-node 0. Minix File System

  10. Zones vs. blocks • Zones are collections of consecutive blocks on the disk. (2, 4, 8…) • Zone size/block size is always a power of two. • File space is allocated on per/zone basis. • Why? Minix File System

  11. I-Node Structure • Mode - file type and rwx bits • Number of links • Uid • Gid • File size (in bytes) • Access, modification, status change times • Zone 0-7 addresses • Indirect Zone address • Double Indirect Zone address Minix File System

  12. The Block Cache • Minix use a block cache to improve file system performance • The cache is implemented as an array of buffers. • Buffers hold disk block data. • LRU is for block replacement policy • Hash table is used to provide fast access to buffered blocks. • Super-block is written through. Data blocks are not. Minix File System

  13. Directories and Paths • Consist of files 16-byte entries. • First two bytes form a 16-bit I-node number • Remaining 14 bytes are the file name • File name lookup is done one component at a time. • E.g. • To look up the path /usr/me/myprogram, the system looks up / for usr, then usr for me and then me for myprogram. Minix File System

  14. Mounted File System • A flag is set in the memory copy of the I-node of the mounted upon directory. • This flag indicates that the I-node is mounted upon. • The super block of the mounted file system is placed in the super block table. • If a file system is mounted on /usr, how does the lookup work for /usr/me/myprogram? Minix File System

  15. File Descriptors • File descriptor is an index in a filp (file position) table. • Filp table contains file position and I-node pointer of the file and the file mode, and the count of processes using it. • Filp is a shared table that allows for: • sharing files with out sharing file positions • sharing files and share file positions (e.g. between parent and a child) Minix File System

  16. What is a file lock and when it is used? • What is the difference between advisory and mandatory locking? Minix File System

  17. File Locking • Minix support advisory file locking that permits any part or multiple parts of a file to be marked as locked. • Advisory locking means that the o.s. does not enforce the lock but processes are responsible for it. • File_lock table (similar to filp table) is used to keep track of locks. Minix File System

  18. Pipes • Pipes are treated like files that are never written to the disk. • They are used to send data between processes. • A process awaiting data from an empty pipe suspends until there is some data in the pipe. Minix File System

  19. Special Files • Special files such as disks and terminals are accessed via their major device number stored in the I-node. • Major device number is an index into a file system table that maps it onto the corresponding task number. • The file system then send a message with the request to this task and waits for a reply. Minix File System

  20. An Example: The Read System Call • User program executes: • n=read(fd,buffer, nbytes • A library procedure read is called. • This procedure sends message READ to FS and blocks waiting for the reply. • FS calls a local procedure that retrieves data blocks from the cache or from the calls a task to read it from the disk. • Once the data is placed in the cache and in the user’s buffer the reply is send. Minix File System

More Related