Operating System-process/thread internal communication-Critical Zone (Critical Regions)

Source: Internet
Author: User

Operating System-process/thread internal communication-Critical Zone (Critical Regions)
I. Introduction to the critical section to solve this problem is to prevent multiple processes from entering the shared area at the same time. In other words, Mutual Exclusion is required between processes for this shared area ). The root cause of the problem is that process B enters the shared area before process A returns from the shared area. In most cases, variables are not shared between two processes. Shared variables are only used in some steps. In program design, you can design the shared variable access program separately, this part of the program is called the Critical Regions ). If the two processes always have only one process entering this critical area, the conditional competition between processes will be solved. To achieve the above results, the following conditions are required: no two processes enter the critical area at the same time and do not require the CPU speed or quantity to be blocked. Wait processes outside the critical area will Block other processes, for example, process A is in the critical zone. When process B accesses the critical zone, process B is blocked outside the critical zone, at this time, Process B should not Block other processes. No Process will be permanently blocked out of the critical section. 2. The demonstration diagram of the critical section shows that Process A enters the critical area T2 at T1 time, process B tries to enter the critical area because A is in the critical area, so B is Block T3 time A leaves the critical area, B enters the critical area time T4 time, b. What are the benefits of using the concept of critical area when leaving the critical area? If process A and process B do not use shared resources for most of the time, process A and process B can be executed in parallel during this time. Only access to critical areas can be parallel. Maximize the parallel operation of processes and efficiently use shared data. 3. Summarize the abstract critical area to exclusive the critical area.

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.