FAT, Queuing Theory

Section 11
Device Drivers, FAT, Queuing Theory,
Memory Mapped Files
April 7th, 2017
Taught by Joshua Don
FAT
• FAT stands for File Allocation Table
• It is one type of file system
•
•
•
•
•
•
Recall…
Files live on disk
Files are broken up into logical blocks (ie. 4KB)
These blocks may not be sequential on disk
Questions:
Which blocks correspond to which file?
What is the right order of blocks for the file?
How to manage directories/folders?
• The kernel needs some metadata to know the right order of the blocks for a file
• The kernel needs some way of mapping entries in a directory to subdirectories or files
Computer Science
Ion Stoica / Joshua Don
Section: 102
FAT cont.
• Files are accessed by their path (ie. /users/Josh/Desktop/test.txt)
• We map a path to a number
• The number associated with a file’s path is used as an index into a file allocation table
• The index is the index of the file’s first header block
• The i’th header block corresponds to the i’th disk data block
• The header blocks contains a pointer to the next header block for the file
• Linked list data structure
Computer Science
Ion Stoica / Joshua Don
Section: 102
FAT cont.
• Free list is a linked list of the free blocks
• Some consequences of FAT:
• Fragmentation on disk is likely (free
list is not necessarily sequential
blocks)
• Reading at the end of a file requires
traversing through all of the prior
header blocks
• Simple, so widely supported by
different OS
• 4GB file size limit in FAT32 (uses 32
bits for file size)
Computer Science
Ion Stoica / Joshua Don
Section: 102
FAT cont.
Two questions…. How do we deal with directories, and how do we map file paths to file
numbers?
• A directory is a file too!
• It contains entries for each item stored in the directory
• Each entry contains the name of the item, as well as the file number for the item
• The item can be a file or another directory
Computer Science
Ion Stoica / Joshua Don
Section: 102
Queueing Theory
Computer Science
Ion Stoica / Joshua Don
Section: 102
Queuing Theory
Computer Science
Ion Stoica / Joshua Don
Section: 102
Queuing Theory, Continued
Some formulas (listed in the discussion sheet):
Tq = Tser x ½(1+C) x u/(1 – u))
Computer Science
Ion Stoica / Joshua Don
Section: 102