Home
Flashcards
Preview
Design Patterns Singleton Midterm
Home
Get App
Take Quiz
Create
getInstance
clients access a Singleton instance solely through getInstance
DCLP
Double Check Locking Pattern
1.Check if it needs modification
2.LockĀ
3.Check again
4.If needs modification again - do so
5.Unlock
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
memory barriers
used to force one process to complete its operation before another process can act on that variable
Author
djon
ID
263054
Card Set
Design Patterns Singleton Midterm
Description
midterm
Updated
2014-02-21T01:58:36Z
Show Answers
Home
Flashcards
Preview