CS361: Operating System

Jian Huang — Spring 2012

EECS | University of Tennessee - Knoxville

Homework 1 - Processes

Due in hard copy before class on Thursday, Feb. 09.

  1. Draw the transition graph of process states and give at least one example scenario for each transition step.
  2. Describe the actions taken by a kernel to context-switch between processes.
  3. Describe the role of system call in separating user mode and kernel mode of operation.

Homework 2 - Threads

Due in hard copy before class on Tuesday, Feb. 21.

  1. Describe the step by step differences between the creation of processes and the creation of threads.
  2. Describe the step by step differences between context-switching of processes vs. context-switching threads.

Homework 3 - Scheduling

Due in hard copy before class on Thursday, March 1.

  1. Assuming you are developing a CPU scheduler for a scenario where jobs are described as tuples of (processid, arrival time, priority, CPU burst time, I/O burst time, CPU burst time, I/O burst time, ...). For each of the following algorithm, please develop a test case where the algorithm will produce the optimal result. In each case, please limit the set of processes to no more than 5.
    • first-come, first-served
    • shortest job first
    • round robin
    • priority
    • multilevel queue scheduling
    • multilevel feedback queue scheduling
  2. Why is it important for the scheduler to distinguish I/O-bound programs from CPU-bound programs?
  3. Discuss how the following pairs of scheduling criteria conflict in certain settings (give one example for each).
    • CPU utilization and response time
    • Average turnaround time and maximum waiting time
    • I/O devise utilization and CPU utilization

Homework 4 - Synchronization

Due in hard copy before class on Thursday, March 15.

  1. Explain why disabling preempt is more appropriate for single-processor system and spinlocks are more appropriate for multiprocessor system.
  2. Severs can be designed to limit the number of open connections. For example, a server may wish to have only N socket connections at any point in time. As soon as N connections are made, the server will not accept another incoming connection until an existing connection is released. Explain how semaphores can be used by a server to limit the number of concurrent connections.
  3. Show how to implement wait() and singal() semaphore operations using TestAndSet() instruction.

Homework 5 - Memory and Paging

Due in hard copy before class on Thursday, April 19.

  1. When programming on systems using demand-paging, which of the following data structure or programming techniques are better at reducing page fault rates?
    • Stack
    • Hash table
    • Sequential search
    • Binary search
    • Vector operations
  2. Assuming a process has just referenced an address in virtual memory. Please describe whether each of the following scenario can occur. If so - how, if not - why?
    • TLB miss with no page fault
    • TLB miss and page fault
    • TLB hit and no page fault
    • TLB hit and page fault
  3. Describe the differences between logical address and physical address, and describe the steps of translating a logical address to physical address (assuming a 3-level hierarchical page table). For each step, please describe whether/what hardware support is needed. What is the relationship between address translation and demand paging?

Design Project

Optional - for extra credit - due in electronic form at 9am on May 7, turn in by 5pm on April 27 for 33% bonus.

We have spent a semester learning about how a single CPU, a single bank of memory, a single disk, a single network card, etc. can be made virtual devices and be shared among hundreds of processes, where each process can afford to have the view of - I own all of these resources to myself.

In many ways, it is amazing that this design concept can be implemented in general, reliable and efficient ways. In this design project, you will tackle a problem related to the reality, and yet is very similar to operating system manages these physical devices in almost all of the fundamental ways.

The problem statement is - server S provides non-trivial services to many clients. The service would take about 30 seconds to a few minutes to complete, and service requests do not need to be synchronously fulfilled, a short wait time is acceptable. The service requests are of three inter-dependent kinds: F, C and P. F must finish before C can proceed, and P cannot take place until C is done. Services requests are made in the form of (10 F, 7 C and 20 P), or (10 F, 2 C) or simply (2 F).

The server has a finite amount of resource, at any particular time, it can serve at most RF requests of service F, RC requests of service C and RP requests of service P.

Please design an overall scheduling system that can simultaneously achieve two goals: to minimize system average per-job turn-around time and to maximize system utilization.

Please follow the Unix philosophy of separating mechanism from policy. To test whether you have achieve this goal, please consider modifying your scheduling system to achieve maximal system throughput while guaranteeing a moderate turn-around time, such as 10 minutes.

What do you need to turn in? Basic data structures used in the management modules, API for accessing each management modules by a scheduling algorithm, and test cases designed to test major classes of use cases.


Jian Huang / EECS /UTK / revised 01/2012