Operating System Labs, Fall and Winter 2009-10

Student Originated Software
http://grace.evergreen.edu/sos/


Use Refresh on your browser to get the most recent update of class pages.
lab1     lab2     lab3     lab4     lab5f     lab5w     lab6     lab7     lab8     lab9    

Handouts and Notes

Lab 1 - C Programming Warmup, Due Tuesday Week 3

Lab 2 - Nutt Lab 2 - Shell, Due Tuesday Week 4

Lab 3 - Nutt Lab 1 - Observing Linux Behavior, Due Tuesday Week 6

Lab 4 - Nutt Lab 3 - Kernel Timers, Due Tuesday Week 8

Lab 5 - Nutt Lab 4 - Kernel Modules, Due Tuesday Week 10

Note For this lab you will need to have root access to your system and be able to compile kernel modules.


Winter Quarter

Lab 5 - Nutt Lab 4 - Kernel Modules: Second Chance with the 2.4 Kernel

If you haven't succeeded with the Kernel Module lab yet then now's your second chance.

Follow the instructions above to complete the lab, but here is a substantial platform of code that will get you most of the way. This code is meant for the slackware2.4 vdi kernel image given in the VM_image handout directory and intended for use in virtualbox. The LKMPG for Linux 2.4 is still essential reading. All the handout code is stripped-down variations of the code in the LKMPG guide.

Lab 6 - Nutt Lab 5 - System Calls

Note For this lab I recommend using the Slackware 2.4 kernel vdi available in the kernel images handout directory.

Note We'll go through the process of building a new kernel in class. The steps are outlined below.

Lab 7 - Nutt Lab 8 - Event Queues for Synchronization - Design and Prototype

Get started reading the Nutt lab 8. Start looking at the source code files in Linux 2.4 and comparing them with the source code in Nutt. Also, start thinking about how you would design your event queue synchronization system. We'll do this lab in two parts - (a) a user level design and prototype for this Lab 7 and (b) A kernel implementation for our Lab 8.

I recommend you start working on the Lab 8 kernel implementation at the same time you are developing your queue design and prototype code. Your explorations of how to do the kernel version of Nutt lab 8 will inform how you want to do your prototype code. For instance, you will need to determine the scope of your prototype and exploring the kernel code might give you a better sense of how much you need to prototype.

At one extreme you might develop an event queueing data structure with the four specified system calls plus the scheduling and synchronization needed to run your prototype in multi-process mode. In this extensive prototype you might write a test harness that had a parent process set up and manage your event queues while generating many children to use the event queue concurrently.

On the other hand, you might discover that you don't need or want to prototype the entire multi-processing code, and decide to just test out your queueing data structure and system functions in single thread mode. In this approach you are trusting that you can figure out how to correctly and effectively use the built-in kernel scheduling and synchronization mechanisms when you get to working on the Lab 8 kernel code.

Keep in mind that you goal in building a prototype is to work through the design and implementation in a "safe" user mode programming environment so you can freely explore your design ideas and simplify your coding efforts when you get to the kernel. With goal in mind, the better you understand the kernel code you will be writing, the more directly you can determine what prototype code you need to write.

By the way, it is conceivable and even possible to skip the prototype stage and go straight to kernel programming to solve the problem. In the real world this is guttsy and risky - you might end up with nothing to show for your efforts because the problem was more difficult than you expected. On the other hand, it is also possible that you'll spend all the effort to build a prototype and discover that the kernel programming was very simple after all and maybe you didn't need any prototype code.

Lab 8 - Nutt Lab 8 - Event Queues for Synchronization - Kernel Implementation

Start working through the sample code and reproducing the experiments in order. To follow the journal of each experiment you will need to read the Notes file in each tar directory. To make sense of the notes you must read the notes in date order blocks (dated blocks of comments run from bottom to top in each notes file).

Work with each experiment until you understand the code and how the code is intertwined with the kernel. Some of the code uses kernel macros (usually in CAPS). Where are these macros defined and what do they do? The code makes kernel calls. Where are the kernel functions defined in the 2.4 kernel and what do they do? What kernel data structures are being used and how?

Change the code to make it yours. Take out my comments and put in yours. Reformat the code order to suit your preferences. Experiment with adding you own code extensions. Write real test programs for the modules, that is, other C programs that call the new system calls from C code. Try to break the code and propose improvements.

Extend the code to solve the problem specified in the Nutt lab 8. This will require you to support more than one event queue and have two new system calls to provide dynamic creation and deletion of wait queues. At this point you will hopefully be able to use some of your Lab 7 prototype code for that already creates and manipulates the queues according the specification for Nutt lab 8.

Lab 9 - Nutt Lab 10 - Device Driver Modules

Start this lab by working through the Linux Kernel Module Programming Guide (LKMPG) Chapter 4 on Device Drivers. Use the 2.4 Kernel version and reproduce the code so you can verify a simple working device driver module. Play with the code to make it yours, for example, make modifications to change the read function, add a write function. Pull code from your proc module and try it in the context of a device driver - are there any significant differences?

After you get your version of the LKMPG device driver working, go on to the Nutt Lab 10 and build the FIFO pseudo device defined in that lab. Be sure to write a good test program and, of course, produce a nice text file writeup to include in your directory that you tar and submit.