Download presentation
Presentation is loading. Please wait.
1
February 5, 2004 Adrienne Noble
Week 5 Midterm Review February 5, 2004 Adrienne Noble
2
Questions? Important dates: Midterm – Tomorrow!
Project 2b – Due Wednesday, Feb 11 Homework 5 – Due Wednesday, Feb 11
3
Project 2a Hints Start by figuring out what’s happening in the code
Where is the process finding/handling new requests? Understand threadpools Make sure you leave sufficient time to do the experiment and write-up
4
What is an OS? Software layer to abstract away from hardware resources
“all the code you didn’t write” to implement your application
5
Architectural Support
Architectural features supporting the OS Protected instructions Kernel mode vs. user mode Interrupts and Exceptions Timer, set-and-set, memory protection, I/O operations, interrupts/exceptions Access to I/O devices, page table pointers, manipulate “mode” bits Interrupts caused by hardware devices Exceptions are caused by software
6
OS Components Processes Memory I/O Secondary storage File systems
Protection Accounting Shells GUI Networking
7
Types of OS Monolithic design Layering Microkernels
Hardware, kernel, page manager, console manager, device managers, job managers
8
Processes A process consists of… States of a process Fork, clone, exec
Running, ready, blocked How to get between states Fork, clone, exec Address space, code, data, stack/SP, PC, general purpose registers, OS resources (files, network connections, etc) Running-> blocked = exception Running-> ready = interrupt Ready-> running = dispatch Blocked-> ready = interrupt
9
Threads A thread consists of… Kernel versus User Threads
Context switching – what do you need to do? Simplethreads package Stack (a portion of the process’s stack), SP, PC, register values Big difference is that kernels need to interrupt for every context switch
10
Synchronization Reasons synchronization is needed
What is a critical section? Understand the following Mutex Semaphore Monitor (Mesa and Hoare) Condition Variable Test-and-set instruction Bounded buffer, reader/writers problems Critical section solution: mutual exclusion, progress, bounded waiting (no starvation), performance
11
Sleeping Barber Problem
Barbershop Requirements Barber sleeps if no customers waiting Customers leave if no chairs available Waiting customers can’t leave until haircut is done
12
Deadlock Reducing graphs Banker’s algorithm
Pretend you granted the request Pretend all other legal requests are made Can the graph still be reduced? Banker’s algorithm: pretend all possibly requests have been made… is graph still reducible?
13
Scheduling Preemptive versus non-preemptive Goals of scheduling
Scheduling Algorithms FIFO SJF Round Robin Priority What do most real systems use? Goals: max CPU utilization, max throughput, min average response time, min average waiting time, avoid starvation Combine algorithms!
14
Throughput vs Waiting Time
Thread Arrival Time Burst Time A 10 B 1 5 C 3 2 FIFO Throughput: A: (10-0) = 10 B: (15-1) = 14 C: (17-3) = 14 ( )/3 = 12.66 FIFO Waiting Time: A: 0 B: (10-1) = 9 C: (15-3) = 12 ( )/3 = 10.33
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.