CSE 120 Lecture Notes - Lecture 13: Page Cache, Flash Memory, File Descriptor

44 views5 pages
File Systems (cont.)
Goals:
1. Archival storage - keep FOREVER, including prev. Versions
2. Support various storage technologies (i.e. different types of disks)
How to best achieve & balance
- Performance
- Reliability
- Security
Note: increasing one may decrease another!
Storage Abstraction
-hide complexity of device
-model as array of blocks of data (numbered, fixed size)
-randomly addressable by block #
-generally a multiple of disk size
-simple interface
-read(block #, mem_addr)
-write(block #, mem_addr)
Typical Implementation Structure
-”superimpose” a structure in the array of blocks
-3 regions:
1. File System Metadata - data about the ENTIRE file system
2. File Metadata - data about a particular file
3. Data Blocks - file contents
File System Metadata
-starts at 0
-if we know how to access FSM, we know how to access the other parts!
-which we know b/c it starts at 0!
-sizes
-files in use, files free
-how many blocks in EACH region, and how many are FREE
-free lists (or bitmaps)
-file control blocks
-data blocks
File Metadata
-occupies a certain # of “storage” blocks in our abstract storage device
-file control block: small amount of metadata for a file
-EACH block has a FCB
-typically, many FCBs fit into 1 storage block
-in each FCB:
Unlock document

This preview shows pages 1-2 of the document.
Unlock all 5 pages and 3 million more documents.

Already have an account? Log in
- attributes - type of file, size, permissions
- references to data blocks (i.e. disk block “map”)
Example of FCB
-Name is a number (i.e. index) -to the OS, not the User
Ex:
Number: 88
Size: 4096 bytes
Permissions: rw-r--r--
Data blocks: set of indexes into storage array
-what about file name?
Keeping Track of Allocated Blocks
1. Contiguous blocks - pointer & number
Pointer: first data block
Number: how many contiguous blocks for the file?
-SINGLE sequence
2. Non-contiguous blocks - pointer per block
Can get astronomically big if we have MANY blocks for a file!
Advantage: we can allocate blocks anywhere!
Disadv: have to record each location
3. Extents - array of “extents” - pointer & number
Ex: 2 contiguous regions of blocks: 2 & 3
-may need a lot of space if we have many contiguous blocks all over the place!
Example: UNIX v.7 Block Map
13 pointers:
- 10 are direct pointers (point to data block w/ data)
- This data block does not have file content, but actual pointers to data blocks WITH data
If block size was 1 KB, and we had 4-byte pointers, we could have 256 addressable DBs
Special Indirect Pointers: point to a data block that has pointers in them!
- 1 singly-indirect: references n data blocks
If block size was 1 KB, and we had 4-byte pointers, we could have 256 addressable DBs
Special Indirect Pointers: point to a data block that has pointers in them!
- 1 doubly-indirect: references n2 DBs
256 pointers to singly-indirect blocks → 256 x 256 x 1KB = 64MB
- 1 triply-indirect: references n3 DBs
256 x 256 x 256 x 1KB = 16GB
Can now reference a file that is UP to 16GB with JUST 13 pointers!
Reasoning: there are MANY small files, and VERY FEW large files
Keeping Track of Free Blocks
Unlock document

This preview shows pages 1-2 of the document.
Unlock all 5 pages and 3 million more documents.

Already have an account? Log in

Get OneClass Notes+

Unlimited access to class notes and textbook notes.

YearlyBest Value
75% OFF
$8 USD/m
Monthly
$30 USD/m
You will be charged $96 USD upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.