Comprehensive Core Exam
CSCI 640, Operating Systems
Study Guide
Spring 2008
Contact: Tyson Henry trhenry@csuchico.edu
The Operating Systems (CSCI 640) portion of the Comprehensive Core Exam
(CCE) will test students on a broad range of Unix systems programming
topics. The test will offer students a choice of questions to
answer, so students will not be expected to answer questions on every exam topic.
There will be two types of questions: (1) topic questions
and (2) questions in which students solve a problem using
C/C++ or pseudo-code.
You don't have to remember the names or syntax of system calls.
If you forget the name of a function, you can comment what it
does or give it a descriptive name. For example, readdir()
returns the next item from an open directory. If you forgot the
name of the function you could write something like this:
get_next(my_directory) // return next entry in the directory
Or if you forgot the name of the fork() function, you could write:
child_pid = create_new_process()
Exam Topics (only topics in this list and problems on these topics will be on the exam)
- Memory management (run-time stack, memory heap, local variables, global variables)
- Unix Processes (creation, termination, joining, exec function)
-
POSIX Threads (Pthreads)
-
Thread Synchronization (conditional variables)
-
Files
-
Directories (opening, reading)
-
Pipes
-
Signals (handling, generating)
-
Critical Sections and Semaphores
-
Producer-Consumer Synchronization
-
Connection-Oriented Communication (sockets)
Example Topic Questions
-
What is a Unix signal?
-
How are a thread and a process different? What are advantages of threads over processes?
-
Describe the concept of a semaphore. Include a description of how they are used.
- Describe the concept of a Unix pipe. Explain how they can be used to provide producer-consumer synchronization.
- What does it mean if a set of process are deadlocked?
- Describe the waitpid() function. Mention both the blocking and non-block behavior.
- Outline the critical section problem. Give an example of a solution to this problem.
- If two 20 byte messages are sent on a socket connection, how many messages will be received at the other end?
- Draw a diagram of the memory segment of a process. Include the runtime-stack, dynamic memory, and global variables.
Example problem solving questions
-
Write code that creates a child process that performs a calculation
(such as adding two numbers). Have the parent process wait for
the child process to finish and perform a calculation using the result
of the calculation performed by the child. Clearly document how
the result is communicated from the child process to the parent
process. Assume the result of the calculation the child process
performs is a double.
- The dining philosophers problem is summarized as five
philosophers sitting at a table doing one of two things - eating or
thinking. While eating, they are not thinking, and while thinking, they
are not eating. The five philosophers sit at a circular table with a
large bowl of spaghetti in the center. A fork is placed in between each
philosopher, and as such, each philosopher has one fork to his or her
left and one fork to his or her right. As spaghetti is difficult to
serve and eat with a single fork, it must be assumed that in order for
a philosopher to eat, the philosopher must have two forks. In the case
of the dining philosopher, the philosopher can only use the fork on his
or her immediate left or right. Assuming each philosopher is
represented by a process and each fork is a limited resource, write a
code segment that uses semaphores to provide the synchronization
necessary to solve this problem. Make sure your solution does not
deadlock.
- Using Pthreads write a program that demonstrate a race condition.
- When a process terminates the parent process receives a SIGCHLD
signal. When a process terminates the operating system does not
completely delete it until the process' parent performs a wait() for
it. Write a program that forks several processes and uses the
SIGCHLD signal to make sure wait() is called for each terminated child.
Assume the parent process continually prompts the user for a word
and then prints the word until the user enters ^D (EOF). This
last assumption means that you can't have the parent block on the
wait() command, you must use the SIGCHLD signal.
Other Resources
The 640 CCE is written so that both Professor Hilzer's 640 students and my 640 sudents can succeed.
However, if you took 640 from Professor Hilzer, then you might want to
look at the exams I've given in 640 to learn how I write exams.
I would not expect students who took Professor Hilzer's course to be able to answer all the questions on my 640
exams. However, looking at the exams will give you an idea of the types of questions I ask.