Prev | Current Page 293 | Next

Carl Reynolds and Paul Tymann

"Schaum's Outline of Principles of Computer Science"

The application developer can impose their own ordering on
the shared resources of the application (files, timers, data-base tables, etc.) and insure that threads or processes
within the application access the resources in order. Doing so can insure that the application never deadlocks.
Deadlock avoidance
Since deadlock prevention is not, in general, practical, another approach is to have the operating system
maintain a vigilance that will avoid situations where deadlock is possible. In 1965, Edgar Dijkstra published the
???banker??™s algorithm??? for deadlock avoidance.
The banker??™s algorithm behaves as a banker might in considering whether to grant loans. If granting a new
loan would put the bank at risk of failing, should too many borrowers make demands on the bank??™s resources,
the banker will deny the loan. Thus does the banker avoid difficulty.
The banker??™s algorithm requires that each process declare at the start the maximum number of resources of
each type (e.g., how many printers, how many tape drives, etc.) it will require over the course of its execution.
Then, whenever a process requests exclusive access to new resources, the OS simulates granting the request, and
checks to see that there is some way for all processes to complete, even assuming that each process immediately
requests its maximum requirement of all resources.


Pages:
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
Władysławowo noclegi pity pozycjonowanie bilety lotnicze świnoujście noclegi