Operating Systems Final
Winter 2010
Due Thursday at 5:00pm
Paper under Lab 1 2010 or pdf via submit
The exam is takehome, open book and notes. Please do not use Google and the
web to answer these questions except directed below through the class web
pages. Your answers to these questions should all be
outcomes of the experience with the lab projects you've been working on.
Even if you have not done the labs, you are encouraged to answer the questions
if you have studied the labs are confident you understand. But don't guess.
Although I have tried to be clear and specific, I suspect that it may turn
out not be entirely clear what I am asking in some of the
questions below, so for this exam I'm allowing some collaborative work.
You must write up answers to these questions independently, but you
may collaborate with other OS classmates to better understand the
questions.
- Lab 2 Shell (Nutt Lab 2):
- Briefly outline the basic structure of a simple shell program.
- What system calls in a shell implementation are essential?
- When a Unix process spawn a child process, explain where and how the
child process gets its code and data.
- Can a child and parent easily share variables? Explain how or explain
why not.
- How do you pass arguments to the child process (eg, shell command line
arguments)?
- How does a shell know when a command is done?
- Lab 3 Observing Linux Behavior through the proc File System (Nutt Lab 1)
- What is the purpose of the Linux proc file system?
- What information in general does the proc file system display?
- The proc files act like read only files, but what are they really?
- This lab asked you to write a C program to read, format, and display
information that you extract from existing proc files. What does your
program read and display?
- Lab 4 Kernel Timers (Nutt Lab 3)
- Briefly describe how the linux kernel Linux keeps track of the passage
of time while it is booted up and running.
- How do Linux machines keep track of time when they are not booted?
- What is the granularity of accuracy of the Linux kernel clock?
- Describe each of the three per-process timers and what time they keep
track of.
- Where does Linux keep per-process time information?
- When is per-process time information updated by the kernel?
- What is a Unix signal?
- How are Unix signals used in this lab to implement a process timer?
- Briefly describe how to set up a Unix signal handler.
- What does your signal handler do in this lab?
- What processes did you time?
- Were your results meaningful? Explain how you determined your timing
results were meaningful.
- Lab 5 Kernel Modules (Nutt Lab 4)
- What is a kernel module and for what good reason do they exist in Linux?
- What is the interface we used in the proc file kernel module? There is a
generic name and a specific structure name.
- Where specifically (in what file) do you find the interface definition?
- How does a kernel module interact with an interface to supply new kernel
functionality? (By this I mean how do you as a programmer connect your
functions into the kernel)?
- What specific proc file functions did you supply in your proc file module?
- Explain the purpose of each function you supplied in your proc file
module.
- What system calls correspond to the proc file functions you supplied
for the your proc file module?
- List the steps you need to go through to create and install a kernel
module. Be brief but specific.
- What kernel module code gets executed when you install a kernel module?
- How do you remove a kernel module from the kernel?
- What kernel module code gets executed when you remove a kernel module?
- How does the Linux system know your module is kernel code with kernel
priviledges and not just some user code?
- What do your proc file module system calls return and where do the
results go?
- How does your proc module read signify an end of file to the caller?
- If you wrote a test program to use your proc file module, what proc
file system calls does your test program call? Does your test program
use more system calls than you actually provide in your module? Where is
the code for the other module system calls?
- Lab 5 Kernel Modules (Syscall Examples)
In the process of adding system calls to the kernel in Lab 6 below, we
learned from the Linux Kernel Module Programmer's Guide that is is possible
to do a system call as a kernel module. The following questions are specifically
about doing system calls as modules as opposed to hard-coding system calls
in the main kernel source tree as described in Lab 6 System Calls below.
You may want to do the Lab 6 questions first. You also may want
to skip this section if you did not do a system call as a
module. Ordinarily you do not install new system calls using kernel modules
unless you are just experimenting or testing.
- List the steps you need to go through in order to add a system call
using a kernel module. Be specific. You may refer to your Lab 6 answer
below for common steps.
- If you have not already done so in the previous questions, identify and
discuss what is different about the process of adding a system call
as a module as opposed to hard-coding a system call as in Lab 6 below.
- Describe a significant problem with adding a system call using a
kernel module.
- Lab 6 System Calls - Hard-coded in the Kernel (Nutt Lab 5)
- What is a system call?
- How do you as a programmer usually access a system call?
- How do system calls initiated from user mode in user space safely
switch to kernel mode and kernel space for processing?
- Why can't system calls be ultimately referenced by name when switching
from user space to kernel space?
- What facility does Linux provide to simulate system calls by name and
with appropriate typing? (Note: this facility is usually used only in the
library functions that encapsulate system calls).
- What kernel file contains the table of all system calls?
- What is the name of the table of all system calls in the Linux kernel?
- How is the table of system calls organized?
- How does the kernel associate a system call instance with the proper
kernel code?
- Specifically, how do you pass data in from user space to the kernel
data space? Identify at least two ways and their restrictions if you can.
- Specifically, how do you pass data from the kernel space back into the
user space? Identify at least two ways and their restrictions if you can.
- When building your hard-coded kernel system call, what C source code
files did you need to modify in the Kernel?
- How did you compile your kernel code? Be specific.
- How did you modify the kernel Makefile to locate your kernel object
code for linkage?
- What did your new kernel system call do?
- How did you test your kernel system call? Explain how you know your
system called worked.
- Lab 7 and 8 Event Queues (Nutt Lab 8)
Event Wait Queues are a facility available in the 2.4 kernel, but they are
not supplied to the user-level system progammer. This lab guides you through
adding Event Queues as a user level synchronization facility.
- What synchronization facilities does the Linux 2.4 system provide for
user level system programmers? You can use the web links from the OS page
to research this.
- What synchronization facilities does the Linux 2.4 kernel provide for
kernel programmers? Again, use the web links from the OS web page to
research this if you need to.
- What are wait queues used for in the kernel?
- Describe briefly how you used the kernel event queues to provide event
queues for user level system programmers through your system calls.
- In your event queue design, how many event queues did you allow
users to have?
- What system calls did you add to the kernel to provide an event queue
facility?
- Briefly describe what each of your system calls do.
- Explain clearly how your event queue facility can be used as a
synchronization facility by system programmers.
- Describe an example program illustrating how your event queues
can be used.
- How did you test your event queue system calls?
- Explain how you know your event queue system calls worked.
- Lab 9 Device Drivers (Nutt Lab 10)
This lab asks you to build a fifo device driver.
- What is the interface used in device driver modules? There is a generic
name and a specific structure name.
- Where specifically (in what file) do you find the interface definition
for device drivers?
- What specific device driver functions did you supply
in your device driver module?
- Explain the purpose of each function you supplied in your device driver
module.
- What data structure did you use for your fifo buffer?
- What synchronization and mutual exclusion did you provide for your
fifo buffer?
- The following questions relate to your fifo design.
- What is your intended multi-process access to your fifo? That is, do
you allow one writer and one reader, multiple writers and multiple readers, or
some other option?
- What is your synchronization design. Do you block writers and readers?
Do you block just readers or just writers? Do you block neither readers or
writers? Do you allow one writer and multiple readers? Explain.
- What happens when your writers try to write more than there is fifo
space available in your fifo buffer?
- What happens when your readers read more than the size of your fifo
buffer?
- How does your fifo close down? For example, does the writer indicate an
end of file to the reader? Do the writer and/or reader close their end of
the fifo when the reader and/or writer close the fifo?
- Elaborate briefly on the design of your fifo behavior with these
questions in mind.