chapter 11 file systems and directories. chapter goals files, directories, and file systems text and...
TRANSCRIPT
Chapter 11
File Systems and Directories
Chapter Goals• Files, directories, and file systems
• Text and Binary files
• Disk-scheduling algorithms
11-2
File Systems
11-3
File Systems
• How do we make this:
5-18
• Look like this?
File Systems
• File – A named collection of related data– A sequence of bytes
• File system – The logical view that an operating system provides– Physically, information on the disk is scattered
• Directory or Folder – A named group of files
11-5
Directory Trees
• Directory tree – A logical view of a file system; – uses a tree structure to represent organization of a file
system
• Root The directory at the highest level
11-6
The Disk – A Physical View
• Data is stored in blocks• One file may be spread across several blocks
5-18
Directory Trees - A Logical View
11-8
File Types
11-9
2 File Types1) Text2) Binary
•Depends on:
–Are the bytes ASCII Characters or not?
11-10
Text and Binary Files
• Text file – Each byte represents an ASCII character
• Binary file– Each byte or group of bytes represents something
other than a character– The specific meaning of the format of bytes must
be understood by the program using the file
11-11
Disk Scheduling
11-12
Disk Scheduling
• The File System is a shared resource • Many programs ask the operating system for
access to the disk
• Disk scheduling The technique that the operating system uses to determine which disks access requests to satisfy first
11-13
Disk Scheduling
• The File System must be accessed in an efficient manner
• As a computer deals with multiple processes over a period of time, a list of requests to access the disk builds up
11-14
Disk Scheduling
• How should we move the head to service requests?
Figure 5.5 The organization of a magnetic disk
5-18
Disk Scheduling Algorithms
• First-Come, First-Served (FCFS)
• Shortest-seek-time-first (SSTF)
• Scan (aka Elevator Algorithm)
11-16
FCFS
11-17
• First-Come, First-Served
• Requests are serviced in the order they arrive in the list, without regard to the current position of the heads
• Problem: Inefficient – The disk heads are moving too much
SSTF
11-18
• Shortest-seek-time-first (SSTF)
• The closest item in the list is services first
• Problem: Starvation – New requests may be closer than older requests, so older requests never get serviced.
Scan
• Scan (aka Elevator Algorithm)• Like an elevator• Travels from top to bottom, servicing requests along
the way• Problems?? Problems may exist for special cases.
11-19