Operating system: Deadlock//program coupling

Source: Internet
Author: User

Deadlock: If there is a set of threads, each of which is waiting for an event to occur, and this event can only be emitted by another thread inside the reorganization threads, we call this group of threads a deadlock.

The four conditions that a deadlock occurs:

1. The condition of deadlock occurs is limited.

2. Hold the wait, that is, when a thread requests a new resource, the resource it originally obtained is not released.

3. Cannot preempt.

4. Cyclic wait conditions.

Deadlock response:

1. Allow deadlocks to occur

1) pretending not to see and ignore

2) After the deadlock occurs, try to solve it.

2. Deadlocks are not tolerated

1) Avoid problems through thoughtful consideration in life.

2) eliminate the deadlock by eliminating the necessary conditions for the deadlock to occur.

On the deadlock can really ignore, because sometimes to eliminate the deadlock to spend time and energy is too big, rather than if the deadlock occurs directly restart, but there is a deadlock after the way he repaired, that is, to check the deadlock, and then to repair him, but we can also through the deadlock to prevent the transmission of deadlocks.

1. Prevention of dynamic deadlocks: The advantage is that there is no need to wait for a deadlock to occur, but to reject a resource request that will cause the deadlock to occur before the deadlock occurs.

The disadvantage is that the calculation is too cumbersome. (with banker algorithm)

2. Static prevention of deadlocks:

1) Eliminate resource monopoly conditions

2) Elimination of retention and request conditions

3) Eliminate non-preemption conditions

4) Eliminate cyclic wait conditions





Coupling (coupling), also known as coupling degree, is a measure of the degree of association between modules. The strength of the coupling depends on the complexity of the interface between modules, how the module is called, and how much data is transferred through the interface. The coupling degree between modules refers to the dependencies between modules, including control relationships, call relationships, and data transfer relationships. The more connections between modules, the stronger the coupling, and the lower the independence of the module. In software design, coupling degree and cohesion are usually used as the standard to measure the independence degree of the module. One of the criteria for partitioning a module is cohesion-poly-low coupling.

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.