23

Ostrich Algorithm

 4 years ago
source link: https://en.wikipedia.org/wiki/Ostrich_algorithm
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Incomputer science, the ostrich algorithm is a strategy of ignoring potential problems on the basis that they may be exceedingly rare. It is named for theostrich effect which is defined as "to stick one's head in the sand and pretend there is no problem". It is used when it is more cost-effective to allow the problem to occur than to attempt its prevention.

Contents

Use with deadlocks [ edit ]

This approach may be used in dealing withdeadlocks in concurrent programming if they are believed to be very rare and the cost of detection or prevention is high. For example, if each PC deadlocks once per 10 years, the one reboot may be less painful than the restrictions needed to prevent it.

A set of processes isdeadlocked if each process in the set is waiting for an event that only another process in the set can cause. Usually the event is release of a currently held resource and none of the processes can run, release resources, and be awakened.

The ostrich algorithm pretends there is no problem and is reasonable to use if deadlocks occur very rarely and the cost of their prevention would be high. TheUNIX andWindows operating systems take this approach.

Although using the ostrich algorithm is one of the methods of dealing withdeadlocks, other effective methods exist such as dynamic avoidance,banker's algorithm, detection and recovery, and prevention.

Trade-offs [ edit ]

Although efficient, using the Ostrich algorithm trades correctness for convenience. Yet since the algorithm directly deals with extreme cases it is not a large trade-off. In fact, the simplest and most used method to recover from a deadlock is a reboot.

Some algorithms with poor worst-case performance are commonly used because they only exhibit poor performance on artificial cases that do not occur in practice; typical examples are thesimplex algorithm and the type-inference algorithm forStandard ML. Issues likeinteger overflow in programming languages with fixed-width integers are also frequently ignored because they occur only in exceptional cases that do not arise for practical inputs.

References [ edit ]

Notes [ edit ]


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK