Resource management (computing): Difference between revisions

Content deleted Content added
merge
rework
Line 7:
==Controlling access==
 
Resource management includes both preventing [[resource leak]]s (theThe act of refusing to release a resource when a process has finished using it) andis dealingknown withas a [[resource contentionleak]], (whenand is an issue in sequential computing. multipleMultiple processes wish to access a limited resource) can be an issue in [[concurrent computing]], and is known as [[resource contention]].
 
Resource management seeks to control access in order to prevent both of these situations.
 
===Resource leak===
{{main|resource leak}}
 
Resource leaks are an issue in sequential computing, while resource contention is an issue in [[concurrent computing]].
 
Formally, resource management (preventing resource leaks) consists of ensuring that a resource is released if and only if it is successfully acquired. This general problem can be abstracted as "''before,'' ''body,'' and ''after''" code, which normally are executed in this order, with the condition that the ''after'' code is called if and only if the ''before'' code successfully completes, regardless of whether the ''body'' code executes successfully or not. This is also known as a ''code sandwich,'' and occurs in various other contexts,{{sfn|Elder|Jackson|Liblit|2008|p=3}} such as a temporary change of program state, or [[Tracing (software)|tracing]] entry and exit into a [[subroutine]]. However, resource management is the most commonly cited application.