✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Can deadlock occur? Justify your answer.
void thread1() {
lock(resource1);
lock(resource2);
// work
unlock(resource2);
unlock(resource1);
}
void thread2() {
lock(resource1);
lock(resource2);
// work
unlock(resource2);
unlock(resource1);
}
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!