COMP 3000 Operating Systems
File Systems and Storage Management (part 3)
Lianying Zhao
Device Files (a.k.a. Special Files)
• They represent physical or virtual hardware devices • Backed up by underlying drivers (i.e., kernel code)
• Identified by a major number and a minor number
• Character devices
• Accessed at the granularity of characters (bytes) • Not addressable (hence a stream)
• Block devices
• Accessed at the granularity of blocks • Addressable
Size = 0?
COMP 3000 (Winter 2021)
2
Superblocks
• Metadata about the whole file system
• Primary and backup superblocks
• The dumpe2fs command
• View superblock information
• Must be a block device (where a file system resides)
COMP 3000 (Winter 2021) 3
Blocks on a File System
• inode
• Contains all meta data except the (file) name
• Directory (also inode)
• Contains the mapping between file names
and inodes (dentries)
• Also a special inode (with an inode number)
• data
• Superblocks
COMP 3000 (Winter 2021) 4
Physical and Logical Sizes
• Logical size:
• The actual size of the file • MS Windows: “Size”
• Physical size:
• The amount of allocated space on disk • MS Windows: “Size on disk”
• “Holes” in a file
COMP 3000 (Winter 2021) 5
COMP 3000 Operating Systems
Misc.
COMP 3000 (Winter 2021) 6
Memory Allocation
• First off, there’s static allocation (data areas of the initial address space)
• A process’s initial memory layout already has: .data, .bss, etc.
• The stack is dynamic, but managed by libc and the generated
assembly
• Usually you don’t explicitly ask for memory from the stack
• Then, what if more space is needed at runtime?
• Imagine there exists a role called “allocator”
• It must maintain some data structures so that it knows what has been allocated and how much
COMP 3000 (Winter 2021) 7