← Quiz: Process Synchronization: all 10 questions
Quiz: Process Synchronization · Question 10 of 10
Why is it a bad idea to hold a lock while doing slow I/O such as reading a file?
Why is it a bad idea to hold a lock while doing slow I/O such as reading a file?
- A.The lock will be released automatically
- B.It causes a race condition
- C.Every other thread that needs the lock is blocked for the whole slow operation
- D.Locks cannot be used with files
Answer & explanation
Correct answer: Every other thread that needs the lock is blocked for the whole slow operation
Keep critical sections short so others are not kept waiting.
Can you get the rest right without peeking?
Take the timed Quiz: Process Synchronization quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →