LIVE Course for free

Rated by 1 million+ students
Get app now
JEE MAIN 2024
JEE MAIN 2025 Foundation Course
NEET 2024 Crash Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
62 views
in Computer by (30.0k points)
closed by

Consider the following policies for preventing deadlock in a system with mutually exclusive resources.

I. Processes should acquire all their resources at the beginning of execution. If any resource is not available, all resources acquired so far are released

II. The resources are numbered uniquely, and processes are allowed to request for resources only in increasing resource numbers

III. The resources are numbered uniquely, and processes are allowed to request for resources only in decreasing resource numbers

IV. The resources are numbered uniquely. A process is allowed to request only for a resource with resource number larger than its currently held resources

Which of the above policies can be used for preventing deadlock?
1. Any one of I and III but not II or IV
2. Any one of I, III, and IV but not II
3. Any one of II and III but not I or IV
4. Any one of I, II, III and IV

1 Answer

0 votes
by (25.6k points)
selected by
 
Best answer
Correct Answer - Option 4 : Any one of I, II, III and IV

Concept:

A deadlock will not occur if one of the following four conditions doesn’t occur :

  • Mutual exclusion: it prevents simultaneous access to a shared resource.
  • Hold and wait: Process is holding a resource that may be required by other processes.
  • Circular wait: It means there are processes which are waiting for other processes to finish.
  • No pre-emption: If a process that is holding some resources requests another resource and that  resource cannot be allocated to it, then it must release all resources that are currently allocated to it.


Explanation:

Option 1:

Processes should acquire all their resources at the beginning of execution. If any resource is not available, all resources acquired so far are released. If this is allowed , then hold and wait will never occur. So, deadlock will not occur.

Option 2:

The resources are numbered uniquely, and processes are allowed to request for resources only in increasing resource numbers. It violates circular wait .

Option 3:

The resources are numbered uniquely, and processes are allowed to request for resources only in decreasing resource numbers. It also violates circular wait.

Option 4:

The resources are numbered uniquely. A process is allowed to request only for a resource with resource number larger than its currently held resources. It also violates circular wait.

So, all options are needed to prevent deadlock. 

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...