Computer Science 284

Fall Semester 2000 Introduction to Operating Systems

Question Pool for Exam 2

CONSTANTS IN THESE QUESTIONS MAY CHANGE WHEN THE QUESTION IS INCLUDED ON THE EXAM

15% OF THE EXAM MAY BE TAKEN FROM QUESTIONS ON QUESTION POOL #1

FOR THE PURPOSE OF THIS EXAM, A 'SIGNAL' MEANS A cond_signal AND AN 'INTERRUPT' MEANS A UNIX/KERNEL TYPE signal.

What is an atomic operation?

What is a spin-lock?

What is an alternative to spin-locking?

Explain under what circumstances a spin lock might be more efficient than the alternative.

Explain under what circumstances a spin lock might be less efficient than the alternative.

Under Solaris 2 running on a uniprocessor, threads waiting for a lock always sleep rather than spin.
    Why is this true (and reasonable)?

Why is it always important to associate a 'mutex lock' variable with a 'condition' variable?

From the point of view of the calling thread, what actions occur from the time that a condition_wait() is called until the calling thread is allowed to resume execution?

What is the "lost wake-up" with respect to condition signals?

Explain what programming 'logic error' could allow a "lost wake-up" to occur.

What is a likely result of a  "lost wake-up" having occurred?

List a sequence of events that might result in a lost wake-up' if it were not programmed correctly.  Number the events 1..N and be explicit as to where/when the signal 'gets lost'.

What does it mean that "condition signals do not pend"?

What is the difference between starvation and deadlock?

Define Deadlock.

What are the necessary conditions for a deadlock to exist.

What is a critical section?

What is the difference between a mutex_t and a sema_t?

What is the difference between mutex_lock and mutex_trylock?

Explain the behavior of:
    sema_wait()
    sema_post()
    sema_init()
    sema_trywait()

Under what conditions must a sema_t be initialized?

What are the 3 possible dispositions that a process may specify with respect to an interrupt?

An interrupt will pend unless a process specifies _______________________.

Show the program parts necessary to cause a process to print a message the 1st time that the keyboard operator presses ^C (and further ^Cs would exit the program).  For the same program, what has to be changed to get the message N times and then exit on the (N+1)th time?

What is a sigset_t?  How is a variable of this type set/modified?  In what ways can a variable of this type be used after it has been assigned an appropriate value(s)?

What function is used from within a process to send an interrupt to a process?

What is the "very largest" program that could execute on a machine with a 24-bit location counter?

The address contained in a page table entry <PTE> are (physical | logical).

Define hit-ratio in a memory management context.

Given the figure presented in class, I will define some (enough) of the following to allow you to calculate values for the remainder.  You are to assume that page tables and segment tables 'fit' into one frame.


Describe the behavior of a "2-handed clock" algorithm.

Describe the differences between a global allocation scheme and the working-set model for allocation.

Why would the page-in mechanism immediately mark a newly loaded page as 'dirty'?

When reading from a pipe, what causes the kernel to send EOF to the reader?

Why can parent/child processes communicate via unnamed pipes but 2 unrelated processes can not?

If your program contains a race condition, what does that mean?

How can the code segment
    if( i < y ) cout << foobar(i,y)
be made atomic?  Answer the question by recoding the segment.

SOCKETS

What is the practical difference between a 'unix' socket and an 'internet' socket?

What are the functional differences between a 'stream' socket and a 'datagram' socket?

Why can two unrelated processes communicate via a socket but not via a pipe?  Give your answer in terms of the internal data structures that make it possible with socket but NOT with pipes.

If a server is blocked in an accept() and an incoming connection() request arrives; explain what happens at the server end.

What do each of the following do:

     socket()

     bind()

     listen()

     accept()

     connect()

     unlink()

If main() is acting as a server with the intent of fork()ing a new process each time an incoming connection is requested;
sketch out what the code surrounding the accept() would look like.

What interrupt is created when a desired frame is not currently resident in RAM?

Who does the hardware 'know' that a desired frame is not currently resident in RAM?

How does the kernel 'know' where on disk the desired information is for a non-resident frame?

What precisely does it mean if the 'dirty bit' is set for a frame?

What is 'good' vs. 'bad' program locality?

Comparing global allocation vs. working set allocation, which would be more adversely affect by a program with 'bad' locality? and WHY would that be true?