






















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A lecture note from cse 120: principles of operating systems, focusing on file systems. It covers topics such as disks and the os, physical disk structure, disk interaction, disk scheduling, file systems, files, basic file operations, file access methods, directory internals, basic directory operations, path name translation, file sharing, protection, representing protection, and file system layout. The lecture also discusses unix and nt file systems.
Typology: Study notes
1 / 30
This page cannot be seen from the preview
Don't miss anything!























◆ Structure ◆ Performance ◆ Scheduling
◆ Files ◆ Directories ◆ Sharing ◆ Protection ◆ File System Layouts ◆ File Buffer Cache ◆ Read Ahead
Disk components ◆ Platters ◆ Surfaces ◆ Tracks ◆ Sectors ◆ Cylinders ◆ Arm ◆ Heads Logically, disk broken down into sectors ◆ Addressed by cylinder, head, sector (CHS) Arm Heads Track Platter Surface Cylinder Sector
◆ Cylinder #, surface #, track #, sector #, transfer size…
◆ The OS needed to know all disk parameters
◆ Not all sectors are the same size, sectors are remapped, etc.
◆ The disk exports its data as a logical array of blocks [0…N] » Disk maps logical blocks to cylinder/surface/track/sector ◆ Only need to specify the logical block # to read/write ◆ But now the disk parameters are hidden from the OS
◆ Seek – moving the disk arm to the correct cylinder » Depends on how fast disk arm can move (increasing very slowly) ◆ Rotation – waiting for the sector to rotate under the head » Depends on rotation rate of disk (increasing, but slowly) ◆ Transfer – transferring data from surface into disk controller electronics, sending it back to the host » Depends on density (increasing quickly)
◆ Particularly seeks and rotation
◆ FCFS (do nothing) » Reasonable when load is low » Long waiting times for long request queues ◆ SSTF (shortest seek time first) » Minimize arm movement (seek time), maximize request rate » Favors middle blocks ◆ SCAN (elevator) » Service requests in one direction until done, then reverse ◆ C-SCAN » Like SCAN, but only go in one direction (typewriter)
◆ 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)
◆ Contents, size, owner, last read/write time, protection, etc.
◆ 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.
◆ 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)
◆ 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)
◆ 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
◆ Naming hierarchies (/, /usr, /usr/local/, …)
◆ Relative names specified with respect to current directory ◆ Absolute names start from the root of directory tree
Unix Directories implemented in files ◆ Use file ops to create dirs C runtime library provides a higher-level abstraction for reading directories ◆ opendir(name) ◆ readdir(DIR) ◆ seekdir(DIR) ◆ closedir(DIR)
Explicit dir operations ◆ CreateDirectory(name) ◆ RemoveDirectory(name) Very different method for reading directory entries ◆ FindFirstFile(pattern) ◆ FindNextFile()
◆ Open directory “/” (well known, can always find) ◆ Search for the entry “one”, get location of “one” (in dir entry) ◆ Open directory “one”, search for “two”, get location of “two” ◆ Open directory “two”, search for “three”, get location of “three” ◆ Open file “three”
◆ This is why open is separate from read/write ◆ OS will cache prefix lookups for performance » /a/b, /a/bb, /a/bbb, etc., all share “/a” prefix
◆ Who can access a file ◆ How they can access it
◆ Objects are “what”, subjects are “who”, actions are “how”
◆ You can read and/or write your files, but others cannot ◆ You can read “/etc/motd”, but you cannot write it
Access Control Lists (ACL) For each object, maintain a list of subjects and their permitted actions Capabilities For each subject, maintain a list of objects and their permitted actions Charlie w r rw Bob w - r Alice rw - rw /one /two /three Subjects Objects ACL Capability