Design Patterns Singleton Midterm
Home > Preview
The flashcards below were created by user
on FreezingBlue Flashcards.
clients access a Singleton instance solely through getInstance
- Double Check Locking Pattern
- 1.Check if it needs modification
- 3.Check again
- 4.If needs modification again - do so
What happens if the thread switch occurs between the allocation and the initialization?
the other thread could start using the singleton object before the initialization has completed.
Compiler Memory Barriers
- prevent compiler from reordering code
- doesn't stop CPU from reordering
- prior to 2005
Hardware Memory Barriers
- prevent CPU from reordering
- combined with compiler memory barriers
- since 2005, compiler/CPU barrier are used
used to force one process to complete its operation before another process can act on that variable
What would you like to do?
Home > Flashcards > Print Preview