Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cpr E 308 Spring 2004 Real-time Scheduling Provide time guarantees Upper bound on response times –Programmer’s job! –Every level of the system Soft versus.

Similar presentations


Presentation on theme: "Cpr E 308 Spring 2004 Real-time Scheduling Provide time guarantees Upper bound on response times –Programmer’s job! –Every level of the system Soft versus."— Presentation transcript:

1 Cpr E 308 Spring 2004 Real-time Scheduling Provide time guarantees Upper bound on response times –Programmer’s job! –Every level of the system Soft versus hard real-time –Streaming mp3 player versus air-traffic controller

2 Cpr E 308 Spring 2004 Real-time Scheduling Is this set of processes schedulable? –A: once every 100ms, 20ms CPU time –B: once every 200ms, 80ms CPU time –C: once every 100ms, 50ms CPU time If schedulable, still have to draw up a schedule for the processes

3 Cpr E 308 Spring 2004 CPU Scheduling: Summary FCFS Shortest job first, shortest remaining job next Round robin – context switch overhead Priority scheduling –Multi-level queues –Lottery Scheduling Real-time schedule - schedulability

4 Cpr E 308 Spring 2004 Deadlocks Can occur when multiple processes want multiple resources simultaneously Is this a deadlock? –Too many people, too few chairs –Two processes, A and B Process A in memory, blocking on a mutex Process B not in memory, holding the mutex Let’s be more precise

5 Cpr E 308 Spring 2004 Deadlock (a)A potential deadlock. (b) an actual deadlock. What are the resources here?

6 Cpr E 308 Spring 2004 Four Conditions for Deadlock Mutual exclusion each resource assigned to 1 process or is available Hold and wait process holding resources can request more No preemption previously granted resources cannot be forcibly taken away Circular waiting must be a circular chain of 2 or more processes each is waiting for resource held by next member of the chain

7 Cpr E 308 Spring 2004 Approaches to Deadlocks Ignore the problem (!!) Detection and recovery Avoidance – Banker’s algorithm Prevention – impose an order on the resources

8 Cpr E 308 Spring 2004 Recap for midterm Introductory Material What belongs in the OS, what doesn’t? Basic Understanding of Hardware, Memory Hierarchy

9 Cpr E 308 Spring 2004 Recap (2) What’s a process? –Unix Process Creation (fork) –Shell Assignment (fork and exec) Address Space –Stack, heap, data and text regions What data items go where? –What do fork() and exec() do to the address space

10 Cpr E 308 Spring 2004 System Calls How are they handled? –How are they different from regular function calls? –Changing from user to supervisor mode and back Some important system calls (including wait())

11 Cpr E 308 Spring 2004 Multiprogramming What is it? Process Context (compare with thread context) Process Context Switch How are interrupts involved?

12 Cpr E 308 Spring 2004 Threads When are they useful? When are they not useful? Difference from processes Basic thread operations – creation, joining, exiting, etc What do different threads in a process share, what don’t they share?

13 Cpr E 308 Spring 2004 Mutual Exclusion and Synchronization What’s the problem with writing to shared variables simultaneously? Why do we need critical sections? –What is atomicity? Mutual Exclusion Problem – Clear definition

14 Cpr E 308 Spring 2004 Mutex solutions Software Solutions –Peterson’s solution Hardware Support –TSL instruction Disabling Interrupts –Advantages and disadvantages –Doesn’t work for multiprocessors – why?

15 Cpr E 308 Spring 2004 Beyond Mutexes Semaphores Producer and Consumer Readers and Writers Dining Philosophers – Deadlocks

16 Cpr E 308 Spring 2004 Threads Implementations User and Kernel threads, pros and cons Process Scheduling –FCFS, Shortest Job First, etc. –Round robin scheduling –Priority Scheduling –Lottery Scheduling


Download ppt "Cpr E 308 Spring 2004 Real-time Scheduling Provide time guarantees Upper bound on response times –Programmer’s job! –Every level of the system Soft versus."

Similar presentations


Ads by Google