Jump to content

Study Help


Guest Ret.Maj.Xander=US=

Recommended Posts

Guest Ret.Maj.Xander=US=
Many of you know I have finals going on and although I pride myself in knowing a lot about technology there are many things still new to me that I dont fully understand. I was just wondering if anyone out there can explain what the Banker's Algorithm is in clear English. I'm also a little confused on with deadlock detection. I'm almost positive we will have a question on the final about it. I've uploaded the lecture slides to be more helpful for those who don't quite understand what I'm talking about. [url]http://www.scribd.com/doc/30874714/lecture24-25-26[/url] I would appreciate help with understanding this better. I know there are a few people out there with good tech backgrounds, I just hope this falls into one of your fields.
Link to comment
Share on other sites

Guest RET.CW5.Ward

Its up to the military member if they choose to speak of how many kills they have.

Link to comment
Share on other sites

Guest RET.CW4.ThievingSix=US=
Bankers algorithm is basically a way of dealing with deadlocks. Here is an example of a deadlock straight from Wikipedia. [size=14][U][B]Deadlock[/B][/U][/SIZE] [QUOTE=Wikipedia]Client applications using the database may require exclusive access to a table, and in order to gain exclusive access they ask for a lock. If one client application holds a lock on a table and attempts to obtain the lock on a second table that is already held by a second client application, this may lead to deadlock if the second application then attempts to obtain the lock that is held by the first application.[/QUOTE] Basically this is a diagram of whats happening [IMG]http://www.teratrax.com/articles/images/block_to_deadlock.gif[/IMG] In event 1: A1 gains a lock on T1. In event 2: A2 gains a lock on T2. In event 3: A1 attempts to gain access to a second table T2. In event 4: A2 attempts to gain access to a second table T1. At the end of this sequence there is a deadlock, both applications hold a lock on 1 table and are requesting access the second, which of course cannot happen. There are 4 main conditions of a deadlock. 1. [B]Mutual exclusion[/B] - One resource cannot be used by more than 1 process at once 2. [B]Hold and wait[/B] - Processes already holding resources may request new resources 3. [B]Preemption[/B] - No resource can be removed from a process holding it, it can only be released the explicit action of that process. 4. [B]Circular wait[/B] - two or more processes form a circular chain where each process waits for a resource that the next process in the chain holds. There are ways of preventing and avoiding a deadlock Wikipedia explains that well. However it's often unlikely that a deadlock prevention or avoidance will be the solution. [size=14][U][B]Deadlock Detection[/B][/U][/SIZE] Now onto deadlock detection, basically an algorithm such as the Wait-die algorithm analyses how much time the process has been active and how many resources it already holds. This information is then used in the following way. [IMG]http://www.cs.colostate.edu/~cs551/Figures/WaitDie.gif[/IMG] "Client process 1" has been holding "B" for 11 minutes and now wants to hold "A" which has been active for 7 minutes. "Client process 2" has been holding "A" for 7 minutes and now wants to hold B which has been active for 11 minutes. The situation is a deadlock. However with the information gained on time the algorithm decides that "Client process 1" has been holding "B" for a greater amount of time and assumes that more work has been completed and so it restarts or rolls back "Client Process 2". This may not always be the case. [size=14][U][B]Bankers algorithm - A method of avoidance[/B][/U][/SIZE] Alright moving onto the bankers algorithm, sometimes called the Dijkstra solution. It is a method of avoidance. [QUOTE=Wikipedia]The algorithm prevents deadlock by denying or postponing the request if it determines that accepting the request could put the system in an unsafe state (one where deadlock could occur). When a new process enters a system, it must declare the maximum number of instances of each resource type that may not exceed the total number of resources in the system.[/QUOTE] Basically what this means is that when a process starts it tells the OS the maximum amount of resources it will need. The OS then allocates "X" number of resources to the process out of the total resources on the OS and the process can only obtain "X" amount of resources. This can be expressed by; 1.request<=max - Request must be under max resources allocated, other wise an error will return 2.request<=available - Request waits for resources to become available 3 pieces of information are required for this algorithm to work. 1. How much of each resource each process could possibly request 2. How much of each resource each process is currently holding 3. How much of each resource the system has available In summary a deadlock is a situation wherein two or more competing actions are waiting for the other to finish, and thus neither ever does. An example of a deadlock detection method is a Wait-Die algorithm. A bankers algorithm is a way of avoiding a deadlock by allocating a certain amount of resources to a certain process. I hope this helped, this is what i understand of deadlock detection and the bankers algorithm based on what i remember from school last year and some research on the net, correct me if im wrong though you probably know way more than me.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...