DOC PREVIEW
UCSD CSE 120 - File Systems

This preview shows page 1-2-14-15-29-30 out of 30 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Lecture 13:Lecture 13:File SystemsFile SystemsCSE 120: Principles of Operating SystemsAlex C. SnoerenHW 3 Due 11/9, Lab 2 Due 11/14CSE 120 – Lecture 13: File Systems 2File SystemsFile 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◆ Protection◆ File System Layouts◆ File Buffer Cache◆ Read AheadCSE 120 – Lecture 13: File Systems 3Disks and the OSDisks 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 higherlevel 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 todifferent clients◆ Physical disk (surface, cylinder, sector)◆ Logical disk (disk block #)◆ Logical file (file block, record, or byte #)CSE 120 – Lecture 13: File Systems 4Physical Disk StructurePhysical Disk Structure Disk components◆ Platters◆ Surfaces◆ Tracks◆ Sectors◆ Cylinders◆ Arm◆ Heads Logically, disk broken down into sectors◆ Addressed by cylinder, head, sector (CHS)ArmHeadsTrackPlatterSurfaceCylinderSectorCSE 120 – Lecture 13: File Systems 5Disk InteractionDisk Interaction Specifying disk requests requires a lot of info:◆ Cylinder #, surface #, track #, sector #, transfer size… Older disks required the OS to specify all of this◆ The OS needed to know all disk parameters Modern disks are more complicated◆ Not all sectors are the same size, sectors are remapped, etc. Current disks provide a higher-level interface (SCSI)◆ 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 OSCSE 120 – Lecture 13: File Systems 6Disk Parameters (2006)Disk Parameters (2006) Seagate Barracuda ES (largest SATA drive available)◆ Form factor: 3.5”◆ Capacity: 750 GB◆ Rotation rate: 7,200 RPM◆ Platters: 4◆ Surfaces: 8◆ Sector size: 512 bytes◆ Cache: 16MB◆ Transfer rate: 40 MB/s (inner) – 78 MB/s (outer)◆ Average seek: 9.5 msCSE 120 – Lecture 13: File Systems 7Disk PerformanceDisk Performance Disk request performance depends upon a number ofsteps◆ 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 controllerelectronics, sending it back to the host» Depends on density (increasing quickly) When the OS uses the disk, it tries to minimize the costof all of these steps◆ Particularly seeks and rotationCSE 120 – Lecture 13: File Systems 8Disk SchedulingDisk Scheduling Because seeks are so expensive (milliseconds!), theOS tries to schedule disk requests that are queuedwaiting for the disk◆ 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)CSE 120 – Lecture 13: File Systems 9Disk Scheduling (2)Disk Scheduling (2) In general, unless there are request queues, diskscheduling 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 OSCSE 120 – Lecture 13: File Systems 10File SystemsFile Systems File systems◆ Implement an abstraction (files) for secondary storage◆ Organize files logically (directories)◆ Permit sharing of data between processes, people, andmachines◆ Protect data from unwanted access (security)CSE 120 – Lecture 13: File Systems 11FilesFiles 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◆ 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)CSE 120 – Lecture 13: File Systems 12Basic File OperationsBasic File OperationsUnix creat(name) open(name, how) read(fd, buf, len) write(fd, buf, len) sync(fd) seek(fd, pos) close(fd) unlink(name)NT CreateFile(name, CREATE) CreateFile(name, OPEN) ReadFile(handle, …) WriteFile(handle, …) FlushFileBuffers(handle, …) SetFilePointer(handle, …) CloseHandle(handle, …) DeleteFile(name) CopyFile(name) MoveFile(name)CSE 120 – Lecture 13: File Systems 13File Access MethodsFile Access Methods Some file systems provide different access methodsthat 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-lengthrecords, read/written sequentially or randomly by record #◆ Indexed access – file system contains an index to a particularfield of each record in a file, reads specify a value for that fieldand the system finds the record via the index (DBs) What file access method does Unix, NT provide? Older systems provide more complicated methodsCSE 120 – Lecture 13: File Systems 14DirectoriesDirectories Directories serve two purposes◆ For users, they provide a structured way to organize files◆ For the file system, they provide a convenient naminginterface that allows the implementation to separate logical fileorganization 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 currentdirectory◆ Relative names specified with


View Full Document

UCSD CSE 120 - File Systems

Documents in this Course
Threads

Threads

14 pages

Deadlocks

Deadlocks

19 pages

Processes

Processes

14 pages

Paging

Paging

13 pages

Processes

Processes

18 pages

Threads

Threads

29 pages

Security

Security

16 pages

Paging

Paging

13 pages

Processes

Processes

32 pages

Lecture 2

Lecture 2

13 pages

Paging

Paging

8 pages

Threads

Threads

14 pages

Paging

Paging

13 pages

Paging

Paging

26 pages

Paging

Paging

13 pages

Lecture

Lecture

13 pages

Processes

Processes

14 pages

Paging

Paging

13 pages

Security

Security

17 pages

Threads

Threads

15 pages

Processes

Processes

34 pages

Structure

Structure

10 pages

Lecture 3

Lecture 3

13 pages

Lecture 1

Lecture 1

28 pages

Threads

Threads

15 pages

Paging

Paging

30 pages

Load more
Download File Systems
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view File Systems and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view File Systems 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?