Docsity

File Systems: Free Space Management and Directories in Unix and DOS - Prof. Jeffrey K. Hol, Study notes of Operating Systems

Partial preview of the text

Download File Systems: Free Space Management and Directories in Unix and DOS - Prof. Jeffrey K. Hol and more Study notes Operating Systems in PDF only on Docsity!

Announcements

z

Reading Chapter 12

z

Project #3 is Due Thursday

z

Midterm #2 is on Tuesday

Free Space Management

z

How do we find a disk block to allocate?

z

Bit Vectors– array of bits (one per block) that indicates if a block is free– compact so can keep in memory

  • 1.3 GB disk, 4K blocks -> 78K per disk
    • easy to find long runs of free blocks

z

Linked lists– each disk block contains the pointer to the next free block– pointer to first free block is keep in a special location on disk

z

Run length encoding (called counting in book)– pointer to first free block is keep in a special location on disk– each free block also includes a count of the number of

consecutive blocks that are free

DOS Directories

z

Root directory– immediately follows the FAT

z

Directory is a table of 32 byte entries– 8 byte file name, 3 byte filename extension– size of file, data and time stamp, starting cluster number of

the file, file attribute codes

  • Fixed size and capacity

z

Subdirectory– This is just a file– Record of where the subdirectory is located is stored in the

FAT

Unix Directories

z

Space for directories are allocated in units called chunks^ – Size of a chunk is chosen so that each allocation can be

transferred to disk in a single operation

  • Chunks are broken into variable-length directory entries to

allow filenames of arbitrary length

  • No directory entry can span more than one chunk– Directory entry contains
    • pointer to inode (file data-structure)• size of entry• length of filename contained in entry (up to 255)• remainder of entry is variable length - contains file name

Unix directories - links

z

Each file has unique inode but it may have multipledirectory entries in the same filesystem to referenceinode

z

Each directory entry creates a hard link of a filenameto the file’s inode– Number of links to file are kept in reference count variable in

inode

  • If links are removed, file is deleted when number of links

becomes zero

z

Symbolic or soft link– Implemented as a file that contains a pathname– Symbolic links do not have an effect on inode reference

count

File Lookup (/usr/bin/vi)

IndirectIndex

Root inode =

usr

Directory Entry

bin

Directory Entry

vi

Directory Entry

Inode

Inode

Data Block

Magnetic Disks

Total capasity: up to 200GBCollection of platters (1-20)Rotate at 3600-10000 RPMSize - usually 2.5-3.5 inch1,000-50,000 tracks per platterTrack consists of ~100-700 sectors

zones: vary number of tracks/sector based on distance from center

Platter

Track

Sector

Track