1 Overview Assignment 10: hints Deadlocks & Scheduling Assignment 9: solution Scheduling
2 A10 Ex1 – Deadlocks Give a real-life example of deadlock. Is it possible to have a deadlock with one process/thread only? Hint: think of types of locks
3 A10 Ex2 – Synchronization Primitives Assumption: OS with only a yield() system call Your task: give a pseudo-code implementation of lock, unlock, wait, and notify Hint: keep track of the threads and their state
4 A10 Ex3 – Scheduling Implement a scheduler simulator Input: comma separated list of [time, priority] Output: average turnaround and response time for First come first served Shortest job first Longest response ratio Highest priority first Round Robin (Hood)
5 Overview Assignment 10: hints Deadlocks & Scheduling Assignment 9: solution Scheduling
6 A9 Ex1 - Scheduling 5 jobs arrive at the same time Process turnaround time: the time elapsed from the submission of the job until the job was done JobTimePriorityRRPrioFCFSSJF A B C D E Avg
7 A9 Ex2 - Multithreading Difference between kernel threads and user-space threads User level threads: Managed by an application (customizable) No preemption, cooperative Only one CPU Kernel threads: Managed by kernel User-space Kernel-space more expensive
8 A9 Ex3 - Processes Process: has its own address space Thread: shares the address space with some other thread/s Context switch: Threads: save PC, SP, FP, regs Processes: save PC, SP, FP, regs, PT Coroutines: save PC, SP, FP