INTRODUCTION

TO

OPERATING SYSTEMS

Lecture 7: RESOURCE ALLOCATION (2)

CHRIS STAFF
Dept. of Computer Science and Artificial Intelligence
University of Malta

Next Lecture: Process Scheduling (1)


Lecture Outline

Aims and Objectives
Preventing Deadlock (by denying one of the conditions)
Deadlock Detection
Recovering from Deadlock
Deadlock Avoidance


Aims and Objectives


Preventing Deadlock (by denying one of the conditions)


Deadlock Detection

Representing Circular Wait.

When to update state graph


Recovering from Deadlock


Deadlock Avoidance

Dijkstra's Banker's Algorithm

Example, using 12 tape decks

                        Current                          Maximum            
                         Loan                            Need               
                                                                            
Process(1)                 1                               4                  
Process(2)                 4                               6                  
Process(3)                 5                               8                  
                                                                            
Available                                 2                                     

Case A

Process(2) requests and obtains 2 remaining decks. Process(2) can run to completion, releasing all 6 decks providing sufficient resources for the other processes to complete - safe state

Case B

Process(1) requests one deck. State unsafe because there are not enough resources to guarantee completion of all processes - request denied.

Advantages of the Banker's Algorithm

Disadvantages


Summary


Next Lecture...

Process Scheduling (1)