Deep understanding of Linux kernel-kernel synchronization

Source: Internet
Author: User
Tags semaphore

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.