80 likes | 89 Views
This assignment covers the concepts of deadlocks and scheduling in operating systems. It includes examples of real-life deadlocks, explores the possibility of a deadlock with one process/thread, and provides hints for understanding types of locks. Additionally, it involves implementing lock, unlock, wait, and notify functions using pseudo-code. Lastly, it requires creating a scheduler simulator with various scheduling algorithms and calculating average turnaround and response time.
E N D
Overview • Assignment 10: hints • Deadlocks & Scheduling • Assignment 9: solution • Scheduling
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
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
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)
Overview • Assignment 10: hints • Deadlocks & Scheduling • Assignment 9: solution • Scheduling
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
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
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