Readers/Writer Lock Probes
Readers/writer locks enforce a policy of allowing
multiple readers or a single writer — but not both — to be in
a critical section. These locks are typically used for structures that are
searched more frequently than they are modified and for which there is substantial
time in the critical section. If critical section times are short, readers/writer
locks will implicitly serialize over the shared memory used to implement the
lock, giving them no advantage over adaptive locks. See rwlock(9F) for more
details on readers/writer locks.
The probes pertaining to readers/writer locks are in Table 11–4. For each probe, arg0 contains
a pointer to the krwlock_t structure that represents the
adaptive lock.
Table 11-4 Readers/Writer Lock Probes
rw-acquire
| Hold-event probe that fires immediately after a readers/writer lock
is acquired. arg1 contains the constant RW_READER if
the lock was acquired as a reader, and RW_WRITER if the
lock was acquired as a writer.
|
rw-block
| Contention-event probe that fires after a thread that has blocked on
a held readers/writer lock has reawakened and has acquired the lock. arg1 contains the length of time (in nanoseconds) that the current thread
had to sleep to acquire the lock. arg2 contains the constant RW_READER if the lock was acquired as a reader, and RW_WRITER if
the lock was acquired as a writer. arg3 and arg4 contain
more information on the reason for blocking. arg3 is non-zero
if and only if the lock was held as a writer when the current thread blocked. arg4 contains the readers count when the current thread blocked.
If both the rw-block and rw-acquire probes
are enabled, rw-block fires before rw-acquire.
|
rw-upgrade
| Hold-event probe that fires after a thread has successfully upgraded
a readers/writer lock from a reader to a writer. Upgrades do not have an associated
contention event because they are only possible through a non-blocking interface, rw_tryupgrade(9F).
|
rw-downgrade
| Hold-event probe that fires after a thread had downgraded its ownership
of a readers/writer lock from writer to reader. Downgrades do not have an
associated contention event because they always succeed without contention.
|
rw-release
| Hold-event probe that fires immediately after a readers/writer lock
is released. arg1 contains the constant RW_READER if
the released lock was held as a reader, and RW_WRITER if
the released lock was held as a writer. Due to upgrades and downgrades, the
lock may not have been released as it was acquired.
|
|