Mutex and synchronization-Overview if the running system has only one execution path from the beginning to the end, you do not need to consider the problem of mutex and synchronization. However, modern Linux systems support not only multi-process but also multi-processor (for example. Multi-symmetric processor SMP). In this environment, when multiple execution paths run concurrently to ensure secure access to shared resources, it is a problem that driver development has to face. In summary, mutual exclusion refers to the exclusive access to resources. For synchronization, proper arrangements should be made for the sequence of process execution. The so-called race mode means that multiple execution paths may perform operations on the same resource, leading to resource data corruption. We call the code snippet for accessing shared resources as the critical section, and call the cause of multiple execution paths as the parallel source. When we talk about concurrency, it refers to several execution paths that may lead to competition for access to shared resources, not necessarily the concurrency execution in a strict sense of time. In Linux, concurrency mainly comes from the following sources:
Interrupt handling pathWhen the system is executing the current process, an interruption occurs, and the concurrency between the interrupt processing function and the interrupted process is formed, in a single processor, although the interrupt handler function and the interrupted process are not in strict concurrency, the interrupt handler function and the interrupted process may form a race state. Soft Interrupt execution can also be classified as this type of concurrency.
Schedulers can be preemptible.On a single processor, concurrency between processes is caused by the preemption of the scheduler. This behavior is very similar to the concurrency between processes on a multi-processor system.
Concurrent multi-processor executionIn a multi-processor system, the process and process are strictly concurrent. Each processor can schedule and run a process independently, and multiple processes run simultaneously at the same time.
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