One, atomic operation
It ensures that atomic instructions are executed atomically ---- execution process is not interrupted.
1.1 atom integer operation
Atomic_t type can only process data for the integers atomic operation.
- First, let only atomic function receives the operand type atomic_t, atomic operations can be ensured only with this particular type of data, and will not be used by others.
- Use atomic_t type ensure that the compiler does not, the corresponding values access optimization.
- When implementing atomic operations on different architectures, use can mask the differences therebetween atomic_t
atomic_t type defined in the file <linux / types.h> in
typedef struct { volatile int counter; } atomic_t;
Second, the spin lock
Third, read - write spinlock
Fourth, the semaphore
Fifth, read - write semaphores
Sixth, mutex
Seven, complete variable
Eight, BLK: big kernel lock
Nine, order lock
Ten, disable preemption
Eleven, the order and the barrier