CPSC 431, Fall 2016
Information About the First Test


The midterm for this course will be given in class on Friday, October 14. It will cover Chapters 1 through 5 from the textbook. The required readings from those chapters included: All if Chapter 2; from Chapter 3, sections 3.1 and 3.2; from Chapter 4, sections 4.2 through 4.6; and from Chapter 5, sections 5.2, 5.3, 5.4 and 5.7. In addition to the textbook, we have covered parts of the C programming language and the Pintos operating system (including semaphores).

There are not likely to be a lot of questions on the test that ask you to write actual, syntactically correct C code, but there might be some short questions to test your understanding of pointers (including the unary operators & and *, the -> operator for accessing structure members through pointers, the nature of arrays in C and their relationship to pointers, and malloc and free).

You might be asked to write pseudocode for things like using locks and condition variables, creating threads or processes, switching threads, or handling an interrupt. However, the majority of the test will be essay-type questions including definitions, short-answer questions, and longer essays.


Here are some of the things that you should know...

processes, and how they differ from programs
multiprocessing
kernel mode and user mode
how the kernel protects itself and protects user processes from each other
memory protection (basic ideas):
   "base and bound" registers (old version)
   paged memory and virtual memory (modern version)
privileged instructions (in machine language)
user mode to kernel mode transitions:
   hardware interrupts
   processor exceptions
   syscalls
kernel mode to user mode transitions:
   return from interrupt or syscall
   starting a new process
   "upcalls" such as signals in Unix
interrupts
   where interrupts come from
   the timer interrupt
   interrupt vector, containing addresses of interrupt handlers
   saving register values (especially the stack pointer and program counter)
   enabling and disabling interrupts
   returning from interrupt
   how an interrupt handler (or syscall) can return to a different thread
implementing secure system calls using a kernel stub and a user stub
why the kernel needs to validate all arguments to system calls


the Unix process and file APIs:
   process PIDs; parent and child processes
   fork(); how it creates a new process and how its return values work
   the wait system call; waiting for a child process to exit
   the exec system call; the execvp(cmd,args) function in Linux
   fundamental file operations:  open, close, read, write
   random access files; seek() and tell() in Linux
   
threads
TCB (thread control block)
thread states: READY, RUNNING, BLOCKED, DYING (names can vary)
how a thread is suspended by saving and later restoring its state
state transitions; what transitions are possible, why they can occur
the basic thread API:
   thread_create, specifies a function for the thread to execute
   thread_yield
   thread_exit
   thread_join
preemptive multitasking; time slices
the ready list and the scheduler
blocking a thread; how a thread gets unblocked
blocking I/O; why threads block for I/O
processes and threads
kernel threads vs. user threads (in user processes)
every thread has its own stack; user threads in the same process share memory
how a process differs from a thread

thread synchronization
race conditions; shared data
critical sections 
mutual exclusion
semaphores; the UP and DOWN operations on a semaphore; DOWN is a blocking operation
mutual exclusion locks (mutexes)
acquiring and releasing locks; acquiring a lock is a blocking operation
what is "mutual" about mutual exclusion
condition variables
the wait, signal, and broadcast operations on a condition variable
how a condition variable is associated with a lock
blocking bounded queue; how it uses locks and condition variables
the idea of "atomic" actions, and why they are essential for synchronization
implementing synchronization on a uniprocessor by enabling/disabling interrupts
why enabling/disabling interrupts doesn't suffice on a multiprocessor
multiprocessor spin locks
using an atomic test-and-set operation to implement spin locks

About the C programming language:
   the files, separate compilation, and #includes
   defining and using structs
   pointers, operations on pointers (*, &, ->, type-casting)
   pointer types such as  void*, int*, and struct thread *
   arrays and their relation to pointers
   malloc and free
   segmentation faults