1. What is the biggest performance cost in context switching?

    Storing the outgoing set of registers (program state) and loading the new set of registers (program state), since this usually requires (slow) memory access.

  2. What hardware/architecture support would you need to make context switching "free"? Explain how this support would be used by the OS.

    Storing PCBs in the processor via multiple sets of registers would make switching nearly free. The OS could then instruct the processor to switch PCBs when a new process is to be scheduled.

  3. What resources are required to create a process?

    A new PCB, address space (including page table entries for code, data, a new stack and heap), and copies of all OS bookkeeping entries (like file handles, etc.).

  4. What resources are required to create a thread? Why or how is this different than process creation?

    A thread needs just a new program counter, register set, and stack. No new memory structures or operating system resources are needed.

  5. What's the advantage of including kernel threads as well as processes in an operating system?

    Kernel threads allow scheduling on a thread level, and prevent all threads in a process from blocking when a single thread (and therefore the process) blocks.

  6. 5.4/6.4. Suppose that the following process arrive for execution at the times indicated.