Holding locks while performing time consuming or blocking operations can severely degrade system performance and result in starvation. Furthermore, deadlock may can result if too many interdependent threads block indefinitely. Blocking operations include network, file, and console I/O (for example, invoking a method such as Console.readLine()
), and object serialization. Deferring a thread indefinitely also constitutes a blocking operation.
...