Sections | Notes | Code |
|
Design Review is graded as follows:
Locking mechanism
1 point. Describe lock implementation with spinlock in pseudo code format
Data structure
1 point. Explain briefly which fields in the mbox_t structure correspond to which fields in textbook's example readers-writers implementation in Figure 2-27 at page 117. What differences do you see between that example and the one you are going to build.
Interrrupt
1 point. What does keyboard_init do? Explain the possible problems that can occur in keyboard getchar and putchar because of interrupts IRQ0 and IRQ1. What is a solution?
Process Management
1 point. Give the formula of the sector number in the image to read the program directory from, in readdir. Then give the formula of start and end locations of the process (inside memory) to be loaded by loadproc.
Communication
1 point. As we mentioned before, since messages are variable sized, a single mbox_recv call can allow several mbox_send operations to execute rather than one. Argue on how to achieve that.
For 1 point extra credit:
Kill
Implement a UNIX-like kill command, so that the user can type "kill" in the shell and kill a process specified by its pid. Note: It's okay to not be able to kill a thread, because our threads are linked statically with the kernel. You should take care of locks and condition variables that a process being killed owns. If a process is killed while executing a system call, killing the process has to be delayed until the system call ends; this ensures no locks are held by that process.
For 1 point extra credit:
Memory Relcaimation
After process exits or gets killed (if you implement kill), you should free all the memory the process uses, and the PCB entry as well, so that the next newly started process can reuse this memory. You can use any cheap management algorithm, such as First Fit (Section 4.2.2 in textbook). Also, you can have fixed-size PCB table in your kernel, so that the user can create no more than this number of processes. Note: You must implement your own memory manager and a malloc-like function. You can't use the standard malloc() function in C library, because we are not linking against any standard libraries.
Normally, the implementation of mbox.c depends on thread.c primitives and the implementation of keyboard.c depends on mbox.c. To make your life a little bit easier, we will give you the solution object files of those four source files that you will be modifying, namely, given/mbox.o, given/keyboard.o, given/thread.o, and given/kernel.o. You can use these given object files to test your program incrementally in any order you like.