Basic synchronization mechanism of the kernel:
Key features of the preemption kernel: a process running in the kernel state that may be replaced by another process during kernel functions execution.
Kernel preemption: Linux 2.6 Allows users to configure the kernel to be very enabled when compiling
Process critical section: the code that accesses a critical resource (a shared resource that only allows one process to use at a time) in each process is called a critical section.
Optimize the barrier: Ensure that the compiler does not confuse the assembly instructions placed before the primitive operation and the assembly instructions placed after the primitive language.
Memory Barrier: The operation before the primitive is completed before the operation of the primitive language begins.
Spin Lock: A special kind of lock that works in a multiprocessor environment. If the kernel control path discovers that the lock is locked by a kernel control path running on another CPU, it rotates around and executes repeatedly until the lock is released. Because many kernel resources lock only 1 milliseconds of time, they do not waste much time.
Sequential Lock: The Read and write of a spin lock has the same priority. In sequential locks, the write is given a higher priority. Even when reading the right time, it is also allowed to write, the advantage is that the writer does not have to wait for the reader, shortcomings when the reader repeatedly read multiple data, the same, to confirm the effective.
Semaphore: 1, kernel signal, used by kernel control path, 2, System V IPC semaphore, used by user state process.
Kernel semaphores: Similar to spin locks, kernel semaphores protect large resource kernel control paths that cannot be accessed and the corresponding processes are suspended. In addition, 1, only the function can sleep to obtain the kernel signal, 2, interrupt handler and the delay function can not use the kernel semaphore.
The high degree of concurrency of the system depends on:
1. Number of I/O devices running concurrently
2, the effective work multi-CPU number
Large kernel Lock:
Deep understanding of Linux kernel-kernel synchronization