Banker's Algorithm Simulation

Specification There should be 3 separate pop-up GUI windows(input window, animation window and status window) on your monitor although they might be on top of each other, giving the illusion of only one window.

Animation Window

There are two major parts in the animation window. The top panel consists of four little windows, indicating how many resources of each kind are left. Here different resources are represented by different colors (A-red, B-green, C-cyan, D-blue). The bottom panel consists of five little windows, representing the five processes. Resources allocated to each process are drawn inside each window, the color representation is the same as the top panel.

Input Window

The right table (Allocated) represents the resourced being allocated to each process at the time being. The left one (Available) represents the total number of resources that the system has.P4). There are two 5x4 tables in the top part of this window. The right one (Requested) is the initial . The left table (MAX) represents the maximum resource required by each process (P0 . There are two 1x4 tables in the middle.All text areas in this window are editable. you can enter any number between 0 and 9.

In an operating system. requesting by a process. etc. "Resume". deadlock is a dangerous state that can cause poor system performance. once a process gets a certain resource it will not give it up voluntarily). deadlock is a state in which two or more processes are "stuck" in a circular wait state. Therefore. All deadlocked processes are waiting for resources held by other processes. will not take resources held by a process away from it). safty check result.     Click "Start" to start the animation. Click "Resume" to resume the animation. a just-executed program must . like initializing. Status Window The status window tells you what the program is doing. Banker's Algorithm The Banker's Algorithm is a strategy for deadlock prevention. and "Quit". "Stop". After you choose the process and the request for that process. One reason this algorithm is not widely used in the real world is because to use it the operating system must know the maximum amount of resources that every process is going to need at all times. Because most systems are non-preemptive (that is. for example. you may hit the "Update" button which will update the program about the parameters you have just entered. and employ a hold and wait method for dealing with system resources (that is. Beneath the tables are a group of buttons represents different processes that generates the initial request. Click "Stop" to pause the animation. Click "Quit" to close the animation window. you can pick only one of them.request that user can put in. Across the bottom panel of the input window are the available operation control buttons including "Start".

it approves the loan in question. a state of deadlock can". If. This determination is made by ``pretending'' to grant the request and then looking at the resulting post-granted request system state. After granting a resource request there will be an amount of that resource left free in the system.declare up-front that it will be needing no more than. say. the request must be approved by the banker. therefore. at any point in the reduction the banker cannot guarantee any processes will terminate because there is not enough free resource to meet the smallest request. f. If the banker can guarantee that all jobs in system will terminate. Each time that a process needs a particularnon-sharable resource. We demanded that each of these other processes state the maximum amount of all system resources they needed to terminate up-front so. The banker is a conservative loaner. 400K of memory. "". Source: there are altogether three files that build up banker's algorithm. it can then take the resource held by that process and add it to the free pool. Every time that a process makes a request of for a resource to be ``loaned'' the banker takes a careful look at the bank books and attempts to determine whether or not a deadlock state could possibly arise in the future if the loan request is approved. This is called an unsafe" defines the algorithm as a whole (much like a driver for the algorithm). The Banker's Algorithm seeks to prevent deadlock by becoming involved in the granting or denying of system resources. on the other hand. Technical Support: . we know how much of each resource every process is allocatedand has claim to. Further. there may be other processes in system. while safty check and some other funtionalities are defined by "managementData. Functions related to each single process are defined in "simpleProcess. In this case the loan request in question is denied and the requesting process is usuallyblocked. At this point the banker can look at the (hopefully) now larger free pool and attempt to guarantee that another process will terminate by checking whether itsrequest can be met. If the banker has enough free resource to guarantee that even one process can terminate. The operating system would then store the limit of 400K and use it in the deadlock avoidance calculations.

2000 . James Chen Algorithm Animation project Multimedia (CS 8302) UT Dallas Summer.GUI input window animation window status window Class heirarchy driver banker's algorithm managementData simpleProcess GUI listener GUI data Go to applet Z.

Master your semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master your semester with Scribd & The New York Times

Cancel anytime.