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: Understanding File Organization and Access Methods - Prof. Geoffrey M. Voelk, Study notes of Computer Science

An in-depth look into file systems, covering the organization of files, file operations, access methods, directories, and file sharing. Topics include the physical structure of disks, disk interaction, file performance, basic directory operations, file sharing, and protection mechanisms such as access control lists (acls).

Typology: Study notes

2009/2010

Uploaded on 03/28/2010

koofers-user-c9b
koofers-user-c9b 🇺🇸

10 documents

1 / 15

Toggle sidebar

Related documents


Partial preview of the text

Download File Systems: Understanding File Organization and Access Methods - Prof. Geoffrey M. Voelk and more Study notes Computer Science in PDF only on Docsity! 1 CSE 120 Principles of Operating Systems Winter 2007 Lecture 12: File Systems Keith Marzullo and Geoffrey M Voelker . File Systems First we’ll discuss properties of physical disks Structure Performance Scheduling Then we’ll discuss how we build file systems on them Files Directories Sharing © 2007 Keith Marzullo and Geoffrey M. Voelker February 21, 2007 CSE 120 – Lecture 12 – File Systems 2 Protection File System Layouts File Buffer Cache Read Ahead 2 Disks and the OS Disks are messy physical devices: Errors bad blocks missed seeks etc, , , . The job of the OS is to hide this mess from higher level software Low-level device control (initiate a disk read, etc.) Higher-level abstractions (files, databases, etc.) The OS may provide different levels of disk access to different clients © 2007 Keith Marzullo and Geoffrey M. Voelker February 21, 2007 CSE 120 – Lecture 12 – File Systems 3 Physical disk (surface, cylinder, sector) Logical disk (disk block #) Logical file (file block, record, or byte #) Physical Disk Structure Disk components Platters Track Sector Surfaces Tracks Sectors Cylinders Arm Heads Arm Heads Platter Surface Cylinder © 2007 Keith Marzullo and Geoffrey M. Voelker February 21, 2007 CSE 120 – Lecture 12 – File Systems 4 5 Disk Scheduling (2) In general, unless there are request queues, disk scheduling does not have much impact Important for servers, less so for PCs Modern disks often do the disk scheduling themselves Disks know their layout better than OS, can optimize better Ignores, undoes any scheduling done by OS © 2007 Keith Marzullo and Geoffrey M. Voelker February 21, 2007 CSE 120 – Lecture 12 – File Systems 9 File Systems File systems Implement an abstraction (files) for secondary storage Organize files logically (directories) Permit sharing of data between processes, people, and machines Protect data from unwanted access (security) © 2007 Keith Marzullo and Geoffrey M. Voelker February 21, 2007 CSE 120 – Lecture 12 – File Systems 10 6 Files A file is data with some properties Contents size owner last read/write time protection etc, , , , , . A file can also have a type Understood by the file system » Block, character, device, portal, link, etc. Understood by other parts of the OS or runtime libraries » Executable, dll, souce, object, text, etc. A file’s type can be encoded in its name or contents © 2007 Keith Marzullo and Geoffrey M. Voelker February 21, 2007 CSE 120 – Lecture 12 – File Systems 11 Windows encodes type in name » .com, .exe, .bat, .dll, .jpg, etc. Unix encodes type in contents » Magic numbers, initial characters (e.g., #! for shell scripts) Basic File Operations Unix creat(name) NT CreateFile(name, CREATE) open(name, how) read(fd, buf, len) write(fd, buf, len) sync(fd) seek(fd, pos) close(fd) CreateFile(name, OPEN) ReadFile(handle, …) WriteFile(handle, …) FlushFileBuffers(handle, …) SetFilePointer(handle, …) CloseHandle(handle, …) © 2007 Keith Marzullo and Geoffrey M. Voelker February 21, 2007 CSE 120 – Lecture 12 – File Systems 12 unlink(name) DeleteFile(name) CopyFile(name) MoveFile(name) 7 File Access Methods Some file systems provide different access methods that specify different ways for accessing data in a file Sequential access – read bytes one at a time, in order Direct access – random access given block/byte number Record access – file is array of fixed- or variable-length records, read/written sequentially or randomly by record # Indexed access – file system contains an index to a particular field of each record in a file, reads specify a value for that field and the system finds the record via the index (DBs) © 2007 Keith Marzullo and Geoffrey M. Voelker February 21, 2007 CSE 120 – Lecture 12 – File Systems 13 What file access method does Unix, NT provide? Older systems provide more complicated methods Directories Directories serve two purposes For users they provide a structured way to organize files , For the file system, they provide a convenient naming interface that allows the implementation to separate logical file organization from physical file placement on the disk Most file systems support multi-level directories Naming hierarchies (/, /usr, /usr/local/, …) Most file systems support the notion of a current © 2007 Keith Marzullo and Geoffrey M. Voelker February 21, 2007 CSE 120 – Lecture 12 – File Systems 14 directory Relative names specified with respect to current directory Absolute names start from the root of directory tree 10 Protection File systems implement some kind of protection system Who can access a file How they can access it More generally… Objects are “what”, subjects are “who”, actions are “how” A protection system dictates whether a given action performed by a given subject on a given object should © 2007 Keith Marzullo and Geoffrey M. Voelker February 21, 2007 CSE 120 – Lecture 12 – File Systems 19 be allowed You can read and/or write your files, but others cannot You can read “/etc/motd”, but you cannot write it Representing Protection Access Control Lists (ACL) For each object, maintain a list Capabilities For each subject, maintain a list of subjects and their permitted actions of objects and their permitted actions /one /two /three Alice rw - rw Bob w - r Subjects Objects Capability © 2007 Keith Marzullo and Geoffrey M. Voelker February 21, 2007 CSE 120 – Lecture 12 – File Systems 20 Charlie w r rw ACL 11 ACLs and Capabilities The approaches differ only in how the table is represented What approach does Unix use? Capabilities are easier to transfer They are like keys, can handoff, does not depend on subject In practice, ACLs are easier to manage Object-centric, easy to grant, revoke To revoke capabilities, have to keep track of all subjects that have the capability a challenging problem © 2007 Keith Marzullo and Geoffrey M. Voelker February 21, 2007 CSE 120 – Lecture 12 – File Systems 21 – ACLs have a problem when objects are heavily shared The ACLs become very large Use groups (e.g., Unix) File System Layout How do file systems use the disk to store files? File systems define a block size (e g 4KB) . ., Disk space is allocated in granularity of blocks A “Master Block” determines location of root directory Always at a well-known disk location Often replicated across disk for reliability A free map determines which blocks are free, allocated U ll bit bit bl k th di k © 2007 Keith Marzullo and Geoffrey M. Voelker February 21, 2007 CSE 120 – Lecture 12 – File Systems 22 sua y a map, one per oc on e s Also stored on disk, cached in memory for performance Remaining disk blocks used to store files (and dirs) There are many ways to do this 12 Disk Layout Strategies Files span multiple disk blocks How do you find all of the blocks for a file? 1. Contiguous allocation » Like memory » Fast, simplifies directory access » Inflexible, causes fragmentation, needs compaction 2. Linked structure » Each block points to the next, directory points to the first © 2007 Keith Marzullo and Geoffrey M. Voelker February 21, 2007 CSE 120 – Lecture 12 – File Systems 23 » Good for sequential access, bad for all others 3. Indexed structure (indirection, hierarchy) » An “index block” contains pointers to many other blocks » Handles random better, still good for sequential » May need multiple index blocks (linked together) Unix Inodes Unix inodes implement an indexed structure for files Also store metadata info (protection, timestamps, length, ref count…) Each inode contains 15 block pointers First 12 are direct blocks (e.g., 4 KB blocks) Then single, double, and triple indirect 0 (Metadata) © 2007 Keith Marzullo and Geoffrey M. Voelker February 21, 2007 CSE 120 – Lecture 12 – File Systems 24 … 12 13 14 1 … … … (1) (2) (3)
Docsity logo



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