Question
Assume that we have the simple task of writing some important information into two files on the disk. However, these files are shared by other
Assume that we have the simple task of writing some important information into two files on the disk. However, these files are shared by other programs as well. If we use the following strategy to update the files: Lock A Lock B Write information to A and B Release the locks This coding can result in deadlocks if other tasks are also writing to these files. For example, If another task locks B first, then locks A, and if both tasks try to do their job at the same time a dead-lock occurs. Similarly, Process A can wait for a lock held by task B which is waiting for a lock held by task C which is waiting for a lock held by task A. A circular wait results in a deadlock. How this deadlock condition can be avoided. Write the solution and pseudo-code of provided solution.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started