🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.The lock will be released automatically
  2. B.It causes a race condition
  3. C.Every other thread that needs the lock is blocked for the whole slow operation
  4. 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 →