Top Banner
Chapter 11 File Systems and Directories
19

Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

Jan 19, 2016

Download

Documents

Melinda Briggs
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

Chapter 11

File Systems and Directories

Page 2: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

Chapter Goals• Files, directories, and file systems

• Text and Binary files

• Disk-scheduling algorithms

11-2

Page 3: 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

Page 4: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

File Systems

• How do we make this:

5-18

• Look like this?

Page 5: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

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

Page 6: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

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

Page 7: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

The Disk – A Physical View

• Data is stored in blocks• One file may be spread across several blocks

5-18

Page 8: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

Directory Trees - A Logical View

11-8

Page 9: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

File Types

11-9

Page 10: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

2 File Types1) Text2) Binary

•Depends on:

–Are the bytes ASCII Characters or not?

11-10

Page 11: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

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

Page 12: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

Disk Scheduling

11-12

Page 13: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

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

Page 14: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

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

Page 15: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

Disk Scheduling

• How should we move the head to service requests?

Figure 5.5 The organization of a magnetic disk

5-18

Page 16: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

Disk Scheduling Algorithms

• First-Come, First-Served (FCFS)

• Shortest-seek-time-first (SSTF)

• Scan (aka Elevator Algorithm)

11-16

Page 17: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

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

Page 18: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

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.

Page 19: Chapter 11 File Systems and Directories. Chapter Goals Files, directories, and file systems Text and Binary files Disk-scheduling algorithms 11-2.

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