Guattery Section Exam 1 Review

CSCI 315 Exam 1 Review

The questions for exam 1 will be taken from/similar to/based on the following, and on the homework and lab exercises you’ve been assigned. They cover the topics from Chapters 1 through 5.

Concepts/Definitions

You should be able to define and/or explain the following terms:

  • operating system
  • batch processing
  • multiprogramming
  • time sharing/multitasking
  • policy
  • mechanism
  • kernel
  • process
  • thread
  • PCB
  • context switch
  • system calls
  • scheduling
  • dual mode operation
  • mode bit
  • starvation
  • socket
  • remote procedure call (RPC)
  • race condition
  • critical region (critical section)
  • mutual exclusion
  • atomicity
  • busy waiting
  • test-and-set (hardware solution)
  • compare-and-swap (hardware solution)
  • spinlock
  • semaphore
  • monitor
  • two ways of inter-process communication (IPC)
    • message passing
    • shared memory
  • deadlock

Chapters 1 and 2

  • How does multiprogramming improve the performance of an operating system?
  • What is the main purpose of an operating system?
  • What is the difference between user mode and kernel mode? How does the system keep track of which mode it’s operating in?

Chapter 3

  • What are the logical segments of a process’s memory?
  • What information about processes is needed to allow multiprogramming? Where is this information stored?
  • List the states that a process may be in. Draw a diagram showing the possible transitions between theses states.
  • When do context switches happen?  What happens during a context switch? Why can frequent context switches be a problem?
  • How is a Unix process created?
  • What happens with a  call to fork() in Unix/Linux?  What is shared between the resulting processes?  What is not shared?  How do you distinguish between the parent and child processes?
  • What system call is used in Unix/Linux to have a child process run a different program from its parent?
  • What are the two main paradigms for interprocess communication?
  • Explain direct versus indirect communication in message passing systems.
  • Explain blocking (asynchronous) versus nonblocking (synchronous) communication in message passing systems.
  • How does interprocess communication (IPC) work in UNIX?
  • You should be able to sketch out code/pseudocode for using fork() in Unix, and for creating one- and two-way IPC in Unix using pipe().  That is, you should be able to show where the calls should go in a program skeleton, and you should be able to indicate other system calls that might be required such as close(), exit(), wait(), read(), write(), etc.

Chapter 4

  • Distinguish threads from processes. What benefits does using threads provide?
  • What places can thread scheduling be done? List an advantage and a disadvantage for managing threads in each of these places.
  • Explain how arguments are passed to Pthreads, the POSIX threads covered in class and lab.  What role does (void *) play in this?
  • What data is shared between Pthreads?
  • What is the purpose of join()?
  • What is parallelism?  What is concurrency?
  • What are thread pools?  What advantages can they provide versus creating a new thread whenever needed?

Chapter 5

  • Give an example (in code or pseudo-code) showing a problem that can result when two processes share a common memory location.
  • What are the three conditions that solutions to the critical section problem have to meet? You should be able to explain each one in simple terms.
  • State the pseudocode for the semaphore implementation given in the text.
  • Explain the Bounded-Buffer (producer-consumer) problem.  Sketch code for a solution to this problem using semaphores (that is, state pseudocode such as given in Figure 5.10 of the text on p. 220).
  • Explain the Dining Philosophers problem.  Assume you have the solution given in Figure 5.14 on p. 223 in the text.  What is wrong with this solution?  State a solution that avoids this problem by breaking symmetry (that is, give an asymmetric solution).
  • Assume you have a solution to the Dining Philosophers problem that prevents deadlock.  What other problem can occur?  Explain this problem (i.e., don’t just state the term for the problem, but explain what the term means.).
  • Sketch code that demonstrates how a deadlock can occur with incorrect use of semaphores.
Print Friendly