File Allocation and Directory Implementation Techniques in Operating Systems - Prof. Jeffr, Study notes of Operating Systems

Various file allocation methods such as contiguous, linked, indexed, and hybrid multi-level index, along with their advantages and disadvantages. It also covers free space management techniques like bit vectors, linked lists, and run length encoding. The document concludes with implementing directories using linear lists and hash tables.

Typology: Study notes

Pre 2010

Uploaded on 02/13/2009

koofers-user-rq3
koofers-user-rq3 🇺🇸

10 documents

1 / 10

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
CMSC 412 – S04 (lect 16)
Announcements
zReading Chapter 12
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download File Allocation and Directory Implementation Techniques in Operating Systems - Prof. Jeffr and more Study notes Operating Systems in PDF only on Docsity!

Announcements

z

Reading Chapter 12

Allocation Methods

z^

How do we select a free disk block to use? z^

Contiguous allocation–

allocate a contiguous chunk of space to a file

-^

directory entry indicates the starting block and the length of the file

-^

easy to implement, but

-^

how to satisfy a given sized request from a list of free holes?

-^

two options

  • first fit (find the first gap that fits)– best fit (find the smallest gaps that is large enough) -^

What happens if one wants to append to file?

-^

from time to time, one will need to repack files

Indexed Allocation

z^

Bring all pointers together in an

index block

-^

Each file has its own index block -

i th entry of index block points to

i th block making up the file

z^

How large to make an index block?–

To avoid a fixed maximum file size, index block must be extensible

z^

Linked scheme:–

maintain a linked list of indexed blocks

z^

Multilevel index:–

Index block can point to other index blocks (which point to indexblocks ....), which point to files

z^

Hybrid multi-level index–

first n blocks are from a fixed index

-^

next m blocks from an indirect index

-^

next o blocks from a double indirect index

Hybrid Multi-level Index (UNIX)

z

Observations– most files are small– most of the space on the disk is consumed by large files

z

Want a flexible way to support different sized– assume 4096 byte block– first 12 blocks (48 KB) are from a fixed index– next 1024 blocks (4 MB) from an indirect index– next 1024

2

blocks (4 GB) from a double indirect index

  • final 1024

3

blocks (4 TB) from a triple indirect index

directory entry

IndirectIndex

double indirect index

Performance Issues

z

FAT^ 

simple, easy to implement 

faster to traverse than linked allocation

  • random access requires following links– files can’t have holes in them

z

Hybrid indirect^ 

fast access to any part of the file 

files can have holes in them

  • more complex

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

  • 100 GB disk, 4K blocks -> 6MB per disk (0.003%)
    • 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