Episode 19: Concurrency Pt. 2

Topics covered
Popular Clips
Episode Highlights
Singletons
and explore the intricacies of singletons and the double-check locking pattern, particularly in Java. Michael highlights the potential pitfalls of using singletons, noting that they can erode architecture and are akin to global variables 1. He explains that while double-check locking can optimize resource acquisition, it is problematic in Java due to the language's bytecode and virtual machine design 2. Alexander warns against using double-check locking in Java, as it can lead to unpredictable behavior 1.
Please don't use double check locking in Java because it will not work.
---
The discussion underscores the importance of understanding language-specific constraints when implementing concurrency patterns.
Active Objects
Active objects play a crucial role in concurrent programming by encapsulating threads and managing asynchronous computations. describes how active objects use input queues protected by locks to handle multiple computation requests simultaneously 3. This pattern allows active objects to remain reactive while processing previous inputs, making them suitable for worker threads that perform asynchronous tasks. However, Michael cautions that queues can introduce jitter in real-time systems, suggesting architects minimize their use in critical paths 3.
Active objects have typically an input queue, which is of course protected by a log.
---
The design of active objects highlights the balance between responsiveness and resource management in concurrent systems.
Synchronization
Synchronization is essential in concurrent programming to manage access to shared resources. explains the use of locks and monitor objects to protect shared data, emphasizing the importance of careful lock management to avoid deadlocks 4. He notes that while monitor objects simplify synchronization in Java, they can be cumbersome and error-prone if not handled correctly. Michael adds that reactive design patterns, such as the reactor pattern, can achieve high performance without the overhead of concurrency in single CPU systems 4.
Always beware of the overhead associated with concurrency.
---
These techniques illustrate the trade-offs between simplicity and complexity in designing concurrent applications.
Related Episodes
Episode 29: Concurrency Pt.3
Answers 383 questions

Episode 12: Concurrency Pt. 1
Answers 383 questions

Episode 44: Interview Brian Goetz and David Holmes
Answers 383 questions

SE-Radio Episode 348 Riccardo Terrell on Concurrency
Answers 383 questions

Episode 21: Error Handling Pt. 2
Answers 383 questions

Episode 25: Architecture Pt. 2
Answers 383 questions
Episode 41: Architecture Patterns (Architecture Pt. 4)
Answers 383 questions

Episode 63: A Pattern Language for Distributed Systems with Henney and Buschmann
Answers 383 questions

Episode 215: Gang of Four – 20 Years Later
Answers 383 questions
Episode 18: Resource Management
Answers 383 questions

Episode 51: Design By Contract
Answers 383 questions

Episode 22: Feedback
Answers 383 questions

Episode 89: Joe Armstrong on Erlang
Answers 383 questionsEpisode 1: Patterns
Answers 383 questions

Episode 68: Dan Grossman on Garbage Collection and Transactional Memory
Answers 383 questions














