answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: Is it possible to prevent deadlock using priority inheritance?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the difference between inheritance and packages?

Inheritance is a means where a class borrows ("inherits") functionality from a base class, usually as a means of code reuse; the subclass will often add additional functionality or modify the behavior of the base class. Packages are simply a way of organizing code into namespaces, such that: Only classes that are actually part of the application logic are included, to prevent conflicts from classes that have the same name, and to logically organize code so that similar functionality can be grouped together.


What is deadlock and solution to it?

A deadlock occurs in multi-threaded applications whenever a thread attempts to acquire a lock that can never be unlocked. Locks are necessary in order to prevent concurrent threads from accessing a shared resource while that resource is being modified. Once a thread acquires a lock, all others must wait until the lock is released. In order to prevent any unnecessary waiting, it is vital that each thread acquire a lock immediately before operating upon a shared resource, and to immediately release that lock as soon as it has finished with the resource. Sometimes it is necessary to operate upon two (or more) resources. Ideally, those resources would be combined into a single resource with just one lock, but it is not unusual to have independent resources that are only occasionally dependant upon each other, so it makes sense to keep them as independent as possible and apply the dependency only when it is actually needed. When we need to create a dependency to perform an operation it is vital that all the independent locks be applied in the same sequence, regardless of which order the operations must be performed. This means that we may end up holding onto locks far longer than is strictly necessary, but it is the only way to prevent a deadlock. For example, if we have two threads, A and B, and two resources, X and Y, such that A acquires X followed by Y while B acquires Y followed by X, then we could easily end up in the situation where A acquires X while B acquires Y. A is now waiting for B to release Y, but B is waiting for A to release X. They are deadlocked. Had they both acquired X and Y in the same order, the deadlock would have been avoided. Another situation where a deadlock often occurs is when a recursive function acquires a lock but doesn't release that lock before calling itself. The new instance cannot lock the resource because it is already locked, thus the function has deadlocked itself. The solution to that problem is to use a recursive lock rather than an ordinary lock, thus allowing a single thread to acquire the lock as often as required. Once a recursive lock is acquired, each subsequent lock by the same thread increments an internal counter while each unlock decrements that counter. When the count is zero the lock is released.


What should you do to prevent possible security issues with the htmlpassword tag?

Use post method and send it over https port. Do not store a password in a browser if it involves sensitive data


Why are pillars there on a arch bridge?

To spread the force being exerted on them from the weight they hold up over as wide an area as possible to help prevent damage


How can one prevent basement flooding?

To prevent basement flooding it is important to divert as much water as possible away from the building by ensuring that the ground slopes away from the walls and that guttering downpipes are connected to drains leading away from the building. In addition the purchase of a sump pump will ensure that should water begin to build up, it can be quickly dispersed.

Related questions

Is semaphore synchronize critical resources to prevent deadlock?

yes


What is the difference between deadlock preventation and dead lock detection?

The difference is exactly what you have just stated: deadlock prevention is used to stop deadlocks before they happen (to prevent them), while deadlock detection is used to figure out when a process has deadlocked (to detect it).


Why Bankers algorithm to avoid deadlock is called so?

It is called that so that the algorithm will prevent such a financial situation.


What setting can you configure to prevent a GPO's settings from being overwritten by another GP that is applied later in an inheritance process?

GPO Inheritance


How do you prevent deadlock in Linux?

Deadlock is not really anything a user has to worry about. Deadlock is merely what happens when two objects want to make the use of each other's resource, but won't release the resource they have until they get the resource they want. How this is usually prevented is to have an object drop ANY resource it no longer needs before trying to get a new resource. This is just one approach, as it doesn't stop deadlock if both objects need the resource they have but need a resource the other object needs.


Why should everyone in an organisation give high priority to computer and network security?

to prevent hackers, to prevent the spreading of viruses etc


What would you use to prevent GPOs linked to parent containers from affecting child containers?

Inheritance blocking


Do inheritance taxes prevent the rich from controlling too much money?

hmm...didn't stop me :D


Is it safe to drive a car with a loose battery cable?

No, tighten it to prevent sparks and a possible fire.No, tighten it to prevent sparks and a possible fire.


How do you prevent dust from accumulating?

its not possible


Does Inheritance taxes prevent the rich from controlling too much money?

Inheritance tax is charged to everyone whether they are rich or poor. It is just another way for the government to collect tax, it is not created to penalize the rich in particular.


Is deadlock possible in C?

Yes. When two threads attempt to lock the same two resources but in a different order, it's possible for both threads to lock just one of those resources and thus block the other thread from locking the other resource. Both threads are waiting for each other thread to release the other resource. To prevent this, whenever a thread locks multiple resources, always lock them in the same order.