Suggested Exercise 5 Sarah Diesburg Operating Systems CS
Suggested Exercise 5 Sarah Diesburg Operating Systems CS 3430
Kernel Projects n What are the basic steps to configure, compile, and install a new kernel? 1. 2. 3. 4. 5. make oldconfig make menuconfig make modules_install make install
Kernel Projects n When is the read function triggered in a /proc module? When someone reads from that virtual /proc file. n E. g. using ‘cat’ or read() in a program n n When is the write function triggered in a /proc module? When someone writes to that virtual /proc file. n E. g. using ‘echo’ or write() in a program n
Kernel Projects n What does a kthread function do and where does it run? When we create a new thread, we need to give it some code to run n Thread starts at the top of the kthread function, thread dies when it reaches the end n What does kthread_should_stop() do? n
Kernel Projects n What kinds of variables do we need to protect with a mutex? Anything global or shared (but not the mutex itself). n What did we need to protect in Project 3? n
Hierarchical Name Space n To access the data content of /pets/cat. jpg n The system needs to perform the following disk I/Os 1. Read in the file header for the root directory ‘/’ n Stored at a fixed location on disk /
Hierarchical Name Space n To access the data content of /pets/cat. jpg n The system needs to perform the following disk I/Os 2. Read the first data block for the root directory n Lookup the directory entry for pets / pets
Hierarchical Name Space n To access the data content of /pets/cat. jpg n The system needs to perform the following disk I/Os 3. Read the file header for pets / pets
Hierarchical Name Space n To access the data content of /pets/cat. jpg n The system needs to perform the following disk I/Os 4. Read the first data block for the pet directory n Lookup the directory entry for cat. jpg / pets cat
Hierarchical Name Space n To access the data content of /pets/cat. jpg n The system needs to perform the following disk I/Os 5. Read the file header for cat. jpg / pets cat
Hierarchical Name Space n To access the data content of /pets/cat. jpg n The system needs to perform the following disk I/Os 6. Read the data block for cat. jpg / pets cat
Hierarchical Name Space n So how many disk I/Os do we need to resolve the path? n Depends what resolving means 5 to resolve the path (everything but reading the file) n 6 if resolving includes reading the first file data block n
How would you design your file system differently? n If you have infinite number of CPUs? n If you have infinite memory size? n If you have infinite disk storage? n If you have infinite network bandwidth?
File System Components n Disk layout n Naming n Protection n Reliability
Infinite Number of CPUs n Use naming schemes that take a lot of computational power n E. g. , relational, contextual, content-based n Hash data block locations n Maybe encryption for extra security
Infinite Memory Size n Load (cache) all file to data mappings into memory on boot
Infinite Disk Storage n Make extra copies for reliability n Make extra copies for speed n Contiguous or segment-based allocation n No longer need to worry about external fragmentation
Infinite Network Bandwidth n Automatic remote copy n Store metadata locally (accessed more often), store data remotely (accessed less often)
How would you design a file system n for only large files? n for only small files? n if memory capacity == disk capacity
For large files n Multi-level indexed allocation n Hash allocation – change to one block won’t affect rest
For small files n Indexed allocation n Small segmented allocation
Memory capacity = Disk capacity n Cache all metadata and files as they are being used
- Slides: 22