October 2017
Intermediate to advanced
354 pages
9h 28m
English
This interface is an implementation of sleeping reader-writer exclusion, which serves as an alternative for spinning ones. Reader-writer semaphores are represented by struct rw_semaphore, declared in the kernel header <linux/rwsem.h>:
struct rw_semaphore { atomic_long_t count; struct list_head wait_list; raw_spinlock_t wait_lock; #ifdef CONFIG_RWSEM_SPIN_ON_OWNER struct optimistic_spin_queue osq; /* spinner MCS lock */ /* * Write owner. Used as a speculative check to see * if the owner is running on the cpu. */ struct task_struct *owner; #endif #ifdef CONFIG_DEBUG_LOCK_ALLOC struct lockdep_map dep_map; #endif };
This structure is identical to that of a mutex, and is designed to support optimistic spinning with ...