Final Review Information
Topics Covered:
- Kernel C Programming. Pointers, kmalloc, casting void* as other things, arrays, structures with pointers included, binary arithmatic, macros, stuff we covered when talking about kernel modules
- /proc including read and write functions
- Writing kernel modules
- Generic OS topics like memory management, block devices, filesystems, process management
- Something from the FreeBSD driver demo (3-5 point question)
Here are a few sample questions:
- Suppose a computer has 1gb of RAM, and no swap space, and two processes each call malloc and request 600mb. Both requests are granted. One process then uses all 600mb. After this, the other process attempts to use all 600mb. What will happen next?
- Why do many filesystems use a B-tree to store information that must be looked up?
- Why does the page cache have two levels?
- Declare a function that takes a pointer to a function as an argument. The argument should be a pointer to a function that takes an integer and a float, and returns a char*
- Inside a proc_read function, 4000 characters are available to return to the user, in an array called buf. "buf" is declared as char buf[8000], but only contains 4000 characters. The user will call the function with less than 4000 characters available in the userspace buffer. Complete the following function to return no more than the user buffer can hold.
ssize_t proc_read(struct file *filp, char *user_buffer, size_t ubuf_size, loff_t *offp){
copy_to_user(user_buffer, buf, 4000); // Oh no! This will overfill the user's buffer!
return 4000;
}
Format
The test will have some short answer and some programming problems. It will be on paper, in MLH 310. One page of multiple choice, followed by short answer and programming. All programming questions will be answerable without too many lines of code.
Notes
Ten pages of notes are allowed, 8.5 by 11 two sided.