22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "runtime/mutex.hpp"
28 #include "runtime/osThread.hpp"
29 #include "utilities/events.hpp"
30 #ifdef TARGET_OS_FAMILY_linux
31 # include "mutex_linux.inline.hpp"
32 # include "thread_linux.inline.hpp"
33 #endif
34 #ifdef TARGET_OS_FAMILY_solaris
35 # include "mutex_solaris.inline.hpp"
36 # include "thread_solaris.inline.hpp"
37 #endif
38 #ifdef TARGET_OS_FAMILY_windows
39 # include "mutex_windows.inline.hpp"
40 # include "thread_windows.inline.hpp"
41 #endif
42
43 // o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o
44 //
45 // Native Monitor-Mutex locking - theory of operations
46 //
47 // * Native Monitors are completely unrelated to Java-level monitors,
48 // although the "back-end" slow-path implementations share a common lineage.
49 // See objectMonitor:: in synchronizer.cpp.
50 // Native Monitors do *not* support nesting or recursion but otherwise
51 // they're basically Hoare-flavor monitors.
52 //
53 // * A thread acquires ownership of a Monitor/Mutex by CASing the LockByte
54 // in the _LockWord from zero to non-zero. Note that the _Owner field
55 // is advisory and is used only to verify that the thread calling unlock()
56 // is indeed the last thread to have acquired the lock.
57 //
58 // * Contending threads "push" themselves onto the front of the contention
59 // queue -- called the cxq -- with CAS and then spin/park.
60 // The _LockWord contains the LockByte as well as the pointer to the head
61 // of the cxq. Colocating the LockByte with the cxq precludes certain races.
|
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "runtime/mutex.hpp"
28 #include "runtime/osThread.hpp"
29 #include "utilities/events.hpp"
30 #ifdef TARGET_OS_FAMILY_linux
31 # include "mutex_linux.inline.hpp"
32 # include "thread_linux.inline.hpp"
33 #endif
34 #ifdef TARGET_OS_FAMILY_solaris
35 # include "mutex_solaris.inline.hpp"
36 # include "thread_solaris.inline.hpp"
37 #endif
38 #ifdef TARGET_OS_FAMILY_windows
39 # include "mutex_windows.inline.hpp"
40 # include "thread_windows.inline.hpp"
41 #endif
42 #ifdef TARGET_OS_FAMILY_bsd
43 # include "mutex_bsd.inline.hpp"
44 # include "thread_bsd.inline.hpp"
45 #endif
46
47 // o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o
48 //
49 // Native Monitor-Mutex locking - theory of operations
50 //
51 // * Native Monitors are completely unrelated to Java-level monitors,
52 // although the "back-end" slow-path implementations share a common lineage.
53 // See objectMonitor:: in synchronizer.cpp.
54 // Native Monitors do *not* support nesting or recursion but otherwise
55 // they're basically Hoare-flavor monitors.
56 //
57 // * A thread acquires ownership of a Monitor/Mutex by CASing the LockByte
58 // in the _LockWord from zero to non-zero. Note that the _Owner field
59 // is advisory and is used only to verify that the thread calling unlock()
60 // is indeed the last thread to have acquired the lock.
61 //
62 // * Contending threads "push" themselves onto the front of the contention
63 // queue -- called the cxq -- with CAS and then spin/park.
64 // The _LockWord contains the LockByte as well as the pointer to the head
65 // of the cxq. Colocating the LockByte with the cxq precludes certain races.
|