Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

File Systems - Operating Systems, Distributed Computation - Lecture Slides, Slides of Operating Systems

During the course of work of the Operating Systems, Distributed Computation, we learn the core of the programming. The main points disucss in these lecture slides are:File Systems, File System Interface, File System Implementation, Sequence of Words, Complex Structures, Attributes of File, User Identification, File Concept, Blocking, Sequential Access, Access Methods

Typology: Slides

2012/2013

Uploaded on 04/24/2013

banamala
banamala 🇮🇳

4.4

(19)

120 documents

1 / 39

Toggle sidebar

Related documents


Partial preview of the text

Download File Systems - Operating Systems, Distributed Computation - Lecture Slides and more Slides Operating Systems in PDF only on Docsity! 10: File Systems 1 OPERATING SYSTEMS FILE SYSTEMS Docsity.com 10: File Systems 2 FILE SYSTEMS This material covers Silberschatz Chapters 10 and 11. File System Interface The user level (more visible) portion of the file system. • Access methods • Directory Structure • Protection File System Implementation The OS level (less visible) portion of the file system. • Allocation and Free Space Management • Directory Implementation Docsity.com 10: File Systems 5 FILE SYSTEMS INTERFACE Attributes of a File  Name – only information kept in human-readable form • Identifier – unique tag (number) identifies file within file system • 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 is kept in the directory structure, which is maintained on the disk. File Concept Docsity.com 10: File Systems 6 FILE SYSTEMS INTERFACE Blocking (packing) occurs when some entity, (either the user or the Operating System) must pack bytes into a physical block. a) Block size is fixed for disks, variable for tape b) Size determines maximum internal fragmentation c) We can allow reference to a file as a set of logical records (addressable units) and then divide ( or pack ) logical records into physical blocks. What does it mean to “open” a file?? File Concept Docsity.com 10: File Systems 7 If files had only one "chunk" of data, life would be simple. But for large files, the files themselves may contain structure, making access faster. SEQUENTIAL ACCESS • Implemented by the filesystem. • Data is accessed one record right after the last. • Reads cause a pointer to be moved ahead by one. • Writes allocate space for the record and move the pointer to the new End Of File. • Such a method is reasonable for tape FILE SYSTEMS INTERFACE Access Methods Docsity.com 10: File Systems 10 Example 1: Index contains the name appearing as the first record in each block. There are as many index entries as there are blocks. Example 2: Index contains the block number where "A" begins, where "B" begins, etc. Here there are only 26 index entries. FILE SYSTEMS INTERFACE Access Methods Smith Smith, John | data Adams Arthur Asher Saarnin Smith, John | data Adams Baker Charles Adams | Data Arthur | Data Asher | Data Baker | Data Saarnin | data Docsity.com 10: File Systems 11 Directories maintain information about files: For a large number of files, may want a directory structure - directories under directories. Information maintained in a directory: Name The user visible name. Type The file is a directory, a program image, a user file, a link, etc. Location Device and location on the device where the file header is located. Size Number of bytes/words/blocks in the file. Position Current next-read/next-write pointers. Protection Access control on read/write/ execute/delete. Usage Open count Usage time of creation/access, etc. Mounting a filesystem occurs when the root of one filesystem is "grafted" into the existing tree of another filesystem. There is a need to PROTECT files and directories. Actions that might be protected include: read, write, execute, append, delete, list FILE SYSTEMS INTERFACE Directory Structure In Memory only! Docsity.com 10: File Systems 12 Tree-Structured Directory FILE SYSTEMS INTERFACE Directory Structure Docsity.com 10: File Systems 15 FILE SYSTEMS INTERFACE Protection Example on Windows XP Docsity.com 10: File Systems 16 FILE SYSTEM IMPLEMENTATION FILE SYSTEM STRUCTURE: When talking about “the file system”, you are making a statement about both the rules used for file access, and about the algorithms used to implement those rules. Here’s a breakdown of those algorithmic pieces. Application Programs The code that's making a file request. Logical File System This is the highest level in the OS; it does protection, and security. Uses the directory structure to do name resolution. File-organization Module Here we read the file control block maintained in the directory so we know about files and the logical blocks where information about that file is located. Basic File System Knowing specific blocks to access, we can now make generic requests to the appropriate device driver. IO Control These are device drivers and interrupt handlers. They cause the device to transfer information between that device and CPU memory. Devices The disks / tapes / etc. Docsity.com 10: File Systems 17 FILE SYSTEM IMPLEMENTATION Layered File System Handles the CONTENT of the file. Knows the file’s internal structure. Handles the OPEN, etc. system calls. Understands paths, directory structure, etc. Uses directory information to figure out blocks, etc. Implements the READ. POSITION calls. Determines where on the disk blocks are located. Interfaces with the devices – handles interrupts. Docsity.com 10: File Systems 20 FILE SYSTEM IMPLEMENTATION a) Accessing the file requires a minimum of head movement. b) Easy to calculate block location: block i of a file, starting at disk address b, is b + i. c) Difficulty is in finding the contiguous space, especially for a large file. Problem is one of dynamic allocation (first fit, best fit, etc.) which has external fragmentation. If many files are created/deleted, compaction will be necessary. • It's hard to estimate at create time what the size of the file will ultimately be. What happens when we want to extend the file --- we must either terminate the owner of the file, or try to find a bigger hole. Allocation Methods CONTIGUOUS ALLOCATION • Method: Lay down the entire file on contiguous sectors of the disk. Define by a dyad <first block location, length >. Docsity.com 10: File Systems 21 FILE SYSTEM IMPLEMENTATION LINKED ALLOCATION Each file is a linked list of disk blocks, scattered anywhere on the disk. At file creation time, simply tell the directory about the file. When writing, get a free block and write to it, enqueueing it to the file header. There's no external fragmentation since each request is for one block. Method can only be effectively used for sequential files. Allocation Methods Docsity.com 10: File Systems 22 FILE SYSTEM IMPLEMENTATION LINKED ALLOCATION Pointers use up space in each block. Reliability is not high because any loss of a pointer loses the rest of the file. A File Allocation Table is a variation of this. It uses a separate disk area to hold the links. This method doesn't use space in data blocks. Many pointers may remain in memory. A FAT file system is used by MS-DOS. Allocation Methods Docsity.com 10: File Systems 25 FILE SYSTEM IMPLEMENTATION PERFORMANCE ISSUES FOR THESE METHODS It's difficult to compare mechanisms because usage is different. Let's calculate, for each method, the number of disk accesses to read block i from a file: contiguous: 1 access from location start + i. linked: i + 1 accesses, reading each block in turn. (is this a fair example?) index: 2 accesses, 1 for index, 1 for data. Allocation Methods Docsity.com 10: File Systems 26 FILE SYSTEM IMPLEMENTATION We need a way to keep track of space currently free. This information is needed when we want to create or add (allocate) to a file. When a file is deleted, we need to show what space is freed up. BIT VECTOR METHOD • Each block is represented by a bit 1 1 0 0 1 1 0 means blocks 2, 3, 6 are free. • This method allows an easy way of finding contiguous free blocks. Requires the overhead of disk space to hold the bitmap. • A block is not REALLY allocated on the disk unless the bitmap is updated. • What operations (disk requests) are required to create and allocate a file using this implementation? Free Space Management Docsity.com 10: File Systems 27 FILE SYSTEM IMPLEMENTATION FREE LIST METHOD • Free blocks are chained together, each holding a pointer to the next one free. • This is very inefficient since a disk access is required to look at each sector. GROUPING METHOD • In one free block, put lots of pointers to other free blocks. Include a pointer to the next block of pointers. COUNTING METHOD • Since many free blocks are contiguous, keep a list of dyads holding the starting address of a "chunk", and the number of blocks in that chunk. • Format < disk address, number of free blocks > Free Space Management Docsity.com 10: File Systems 30 FILE SYSTEM IMPLEMENTATION THE DISK CACHE MECHANISM • There are many places to store disk data so the system doesn’t need to get it from the disk again and again. Efficiency and Performance Docsity.com 10: File Systems 31 FILE SYSTEM IMPLEMENTATION THE DISK CACHE MECHANISM • This is an essential part of any well- performing Operating System. • The goal is to ensure that the disk is accessed as seldom as possible. • Keep previously read data in memory so that it might be read again. • They also hold on to written data, hoping to aggregate several writes from a process. • Can also be “smart” and do things like read-ahead. Anticipate what will be needed. Efficiency and Performance Docsity.com 10: File Systems 32 OVERVIEW: • Runs on SUNOS - NFS is both an implementation and a specification of how to access remote files. It's both a definition and a specific instance. • The goal: to share a file system in a transparent way. • Uses client-server model ( for NFS, a node can be both simultaneously.) Can act between any two nodes ( no dedicated server. ) Mount makes a server file- system visible from a client. mount server:/usr/shared client:/usr/local • Then, transparently, a request for /usr/local/dir-server accesses a file that is on the server. • Can use heterogeneous machines - different hardware, operating systems, network protocols. • Uses RPC for isolation - thus all implementations must have the same RPC calls. These RPC's implement the mount protocol and the NFS protocol. DISTRIBUTED FILE SYSTEMS SUN Network File System Docsity.com 10: File Systems 35 NFS ARCHITECTURE: Follow local and remote access through this figure: DISTRIBUTED FILE SYSTEMS SUN Network File System Docsity.com 10: File Systems 36 NFS ARCHITECTURE: 1. UNIX filesystem layer - does normal open / read / etc. commands. 2. Virtual file system ( VFS ) layer - a) Gives clean layer between user and filesystem. b) Acts as deflection point by using global vnodes. c) Understands the difference between local and remote names. d) Keeps in memory information about what should be deflected (mounted directories) and how to get to these remote directories. 3. System call interface layer - a) Presents sanitized validated requests in a uniform way to the VFS. DISTRIBUTED FILE SYSTEMS SUN Network File System Docsity.com 10: File Systems 37 PATH-NAME TRANSLATION: • Break the complete pathname into components. • For each component, do an NFS lookup using the component name + directory vnode. • After a mount point is reached, each component piece will cause a server access. • Can't hand the whole operation to server since the client may have a second mount on a subsidiary directory (a mount on a mount ). • A directory name cache on the client speeds up lookups. DISTRIBUTED FILE SYSTEMS SUN Network File System Docsity.com
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved