Class MyClass has two ReentrantLock objects, myLock1 and myLock2.Suppose thread one acquires myLock1 as it enters methodX and immediately completes its CPU time slice.After thread two enters methodY, it acquires myLock2 and tries to acquire myLock1.When thread one resumes, it tries to acquire myLock2.What will happen next?
A) Thread two will acquire myLock1
B) Thread one will acquire myLock2
C) Deadlock will occur
D) Thread two will release myLock2
Correct Answer:
Verified
Q68: What happens when a thread calls the
Q69: lock objects ensure that shared data are
Q70: Why does the textbook recommend signallAll over
Q71: Class MyClass has a single ReentrantLock object,
Q72: Consider an old fashioned telephone booth that
Q74: Assume two threads share a BankAccount object
Q75: Assume three threads share a BankAccount object
Q76: The term "stale data" refers to a
Q77: What is the relationship between synchronized code
Q78: Which of the following scenarios may not
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents