Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  A system has n resources R0,...,Rn-1,and k pr... Start Learning for Free
A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.The implementation of the resource request logic of each process Pi is as follows: 
if (i % 2 == 0) {
      if (i < n) request Ri
      if (i+2 < n) request Ri+2
}
else {
      if (i < n) request Rn-i
      if (i+2 < n) request Rn-i-2
}
In which one of the following situations is a deadlock possible?
  • a)
    n=40, k=26
  • b)
    n=21, k=12
  • c)
    n=20, k=10
  • d)
    n=41, k=19
Correct answer is option 'B'. Can you explain this answer?
Verified Answer
A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.The i...
Option B is answer
No. of resources, n = 21
No. of processes, k = 12
Processes {P0, P1....P11}  make the following Resource requests:
{R0, R20, R2, R18, R4, R16, R6, R14, R8, R12, R10, R10}
For example P0 will request R0 (0%2 is = 0 and 0< n=21). 
Similarly, P10 will request R10.
P11 will request R10 as n - i = 21 - 11 = 10.
As different processes are requesting the same resource, deadlock
may occur. 
View all questions of this test
Most Upvoted Answer
A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.The i...
The implementation of the resource request logic of each process Pi can be described as follows:

1. If i is an even number (i % 2 == 0):
- Process Pi requests resource Ri.
- If resource Ri is available, the process is granted the resource and continues its execution.
- If resource Ri is not available, the process waits until it becomes available.

2. If i is an odd number (i % 2 != 0):
- Process Pi requests resource R(i-1).
- If resource R(i-1) is available, the process is granted the resource and continues its execution.
- If resource R(i-1) is not available, the process waits until it becomes available.

This logic ensures that even-numbered processes request the resource with the same index, while odd-numbered processes request the resource with the index one less than their own.
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.The implementation of the resource request logic of each process Pi is as follows:if (i % 2 == 0) { if (i < n) request Ri if (i+2 < n) request Ri+2}else { if (i < n) request Rn-i if (i+2 < n) request Rn-i-2}In which one of the following situations is a deadlock possible?a)n=40, k=26b)n=21, k=12c)n=20, k=10d)n=41, k=19Correct answer is option 'B'. Can you explain this answer?
Question Description
A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.The implementation of the resource request logic of each process Pi is as follows:if (i % 2 == 0) { if (i < n) request Ri if (i+2 < n) request Ri+2}else { if (i < n) request Rn-i if (i+2 < n) request Rn-i-2}In which one of the following situations is a deadlock possible?a)n=40, k=26b)n=21, k=12c)n=20, k=10d)n=41, k=19Correct answer is option 'B'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.The implementation of the resource request logic of each process Pi is as follows:if (i % 2 == 0) { if (i < n) request Ri if (i+2 < n) request Ri+2}else { if (i < n) request Rn-i if (i+2 < n) request Rn-i-2}In which one of the following situations is a deadlock possible?a)n=40, k=26b)n=21, k=12c)n=20, k=10d)n=41, k=19Correct answer is option 'B'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.The implementation of the resource request logic of each process Pi is as follows:if (i % 2 == 0) { if (i < n) request Ri if (i+2 < n) request Ri+2}else { if (i < n) request Rn-i if (i+2 < n) request Rn-i-2}In which one of the following situations is a deadlock possible?a)n=40, k=26b)n=21, k=12c)n=20, k=10d)n=41, k=19Correct answer is option 'B'. Can you explain this answer?.
Solutions for A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.The implementation of the resource request logic of each process Pi is as follows:if (i % 2 == 0) { if (i < n) request Ri if (i+2 < n) request Ri+2}else { if (i < n) request Rn-i if (i+2 < n) request Rn-i-2}In which one of the following situations is a deadlock possible?a)n=40, k=26b)n=21, k=12c)n=20, k=10d)n=41, k=19Correct answer is option 'B'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.The implementation of the resource request logic of each process Pi is as follows:if (i % 2 == 0) { if (i < n) request Ri if (i+2 < n) request Ri+2}else { if (i < n) request Rn-i if (i+2 < n) request Rn-i-2}In which one of the following situations is a deadlock possible?a)n=40, k=26b)n=21, k=12c)n=20, k=10d)n=41, k=19Correct answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.The implementation of the resource request logic of each process Pi is as follows:if (i % 2 == 0) { if (i < n) request Ri if (i+2 < n) request Ri+2}else { if (i < n) request Rn-i if (i+2 < n) request Rn-i-2}In which one of the following situations is a deadlock possible?a)n=40, k=26b)n=21, k=12c)n=20, k=10d)n=41, k=19Correct answer is option 'B'. Can you explain this answer?, a detailed solution for A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.The implementation of the resource request logic of each process Pi is as follows:if (i % 2 == 0) { if (i < n) request Ri if (i+2 < n) request Ri+2}else { if (i < n) request Rn-i if (i+2 < n) request Rn-i-2}In which one of the following situations is a deadlock possible?a)n=40, k=26b)n=21, k=12c)n=20, k=10d)n=41, k=19Correct answer is option 'B'. Can you explain this answer? has been provided alongside types of A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.The implementation of the resource request logic of each process Pi is as follows:if (i % 2 == 0) { if (i < n) request Ri if (i+2 < n) request Ri+2}else { if (i < n) request Rn-i if (i+2 < n) request Rn-i-2}In which one of the following situations is a deadlock possible?a)n=40, k=26b)n=21, k=12c)n=20, k=10d)n=41, k=19Correct answer is option 'B'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.The implementation of the resource request logic of each process Pi is as follows:if (i % 2 == 0) { if (i < n) request Ri if (i+2 < n) request Ri+2}else { if (i < n) request Rn-i if (i+2 < n) request Rn-i-2}In which one of the following situations is a deadlock possible?a)n=40, k=26b)n=21, k=12c)n=20, k=10d)n=41, k=19Correct answer is option 'B'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev