Jump to content

Pool (computer science): Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Undid revision 875465592 by 2600:1700:4100:6200:C0AB:A12B:73FD:481A (talk) dead-url=no (also applied) makes more sense.
No edit summary
 
(14 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{Short description|Collection of ready-to-use resources}}
{{Refimprove|date=August 2015}}
{{Refimprove|date=August 2015}}


In [[computer science]], a '''pool''' is a collection of [[System resource|resources]] that are kept ready to use, rather than acquired on use and released afterwards. In this context, ''resources'' can refer to system resources such as [[file handle]]s, which are external to a process, or internal resources such as [[object (computing)|objects]]. A pool [[Client (computing)|client]] requests a resource from the pool and performs desired operations on the returned resource. When the client finishes its use of the resource, it is returned to the pool rather than released and lost.
In [[computer science]], a '''pool''' is a collection of resources that are kept in memory, ready to use, rather than the memory acquired on use or the memory released afterwards. In this context, ''resources'' can refer to [[System resource|system resources]] such as [[file handle]]s, which are external to a process, or internal resources such as [[object (computing)|objects]]. A pool [[Client (computing)|client]] requests a resource from the pool and performs desired operations on the returned resource. When the client finishes its use of the resource, it is returned to the pool rather than released and lost.{{clarify|reason=Are the pool, the client, and the server all part of the same process? Sometimes, never, or always?|date=December 2018}}


The pooling of resources can offer a significant performance boost in situations that have high cost associated with resource acquiring, high rate of the requests for resources, and a low overall count of simultaneously used resources. Pooling is also useful when the [[Latency (engineering)|latency]] is a concern, because a pool offers predictable times required to obtain resources since they have already been acquired. These benefits are mostly true for system resources that require a [[system call]], or remote resources that require a network communication, such as [[database connection]]s, [[socket connection]]s, [[Thread (computing)|threads]], and [[memory allocation]]. Pooling is also useful for expensive-to-compute data, notably large graphic objects like [[font]]s or [[bitmap]]s, acting essentially as a data [[Cache (computing)|cache]] or a [[memoization]] technique.
The pooling of resources can offer a significant response-time boost in situations that have high cost associated with resource acquiring, high rate of the requests for resources, and a low overall count of simultaneously used resources. Pooling is also useful when the [[Latency (engineering)|latency]] is a concern, because a pool offers predictable times required to obtain resources since they have already been acquired. These benefits are mostly true for system resources that require a [[system call]], or remote resources that require a network communication, such as [[database connection]]s, [[socket connection]]s, [[Thread (computing)|threads]], and [[memory allocation]]. Pooling is also useful for expensive-to-compute data, notably large graphic objects like [[font]]s or [[bitmap]]s, acting essentially as a data [[Cache (computing)|cache]] or a [[memoization]] technique.


Special cases of pools are [[connection pool]]s, [[thread pool]]s, and [[memory pool]]s.
Special cases of pools are [[connection pool]]s, [[thread pool]]s, and [[memory pool]]s.
Line 10: Line 11:
{{Main|Object pool pattern}}
{{Main|Object pool pattern}}


Pools can also be used for objects, in which context a ''pool'' refers to a [[design pattern]] for implementing pools in [[object-oriented language]]s, such as in the [[object pool pattern]]. Objects themselves hold no external resources and only occupy memory, although an already created object avoids the memory allocation required on object creation. Object pools are useful when the cost of [[object creation]] is high, but in certain situations this simple object pooling may not be efficient and could in fact decrease performance.<ref>{{cite web
Pools can also be used for objects, in which context a ''pool'' refers to a [[design pattern]] for implementing pools in [[object-oriented language]]s, such as in the [[object pool pattern]]. Objects themselves hold no external resources and only occupy memory, although an already created object avoids the memory allocation required on object creation. Object pools are useful when the cost of [[object creation]] is high, but in certain situations this simple object pooling may not be efficient and could in fact decrease performance.<ref>{{cite web
| url = https://www.ibm.com/developerworks/library/j-jtp09275/index.html
| url = https://www.ibm.com/developerworks/library/j-jtp09275/index.html
| archiveurl = https://web.archive.org/web/20111229023158/http://www.ibm.com/developerworks/java/library/j-jtp09275/index.html
| archiveurl = https://web.archive.org/web/20111229023158/http://www.ibm.com/developerworks/java/library/j-jtp09275/index.html
| dead-url = no
| url-status = live
| title = Java theory and practice: Urban performance legends, revisited
| title = Java theory and practice: Urban performance legends, revisited
| date = 2005-09-27 | archivedate = 2011-12-29 | accessdate = 2013-10-31
| date = 2005-09-27 | archivedate = 2011-12-29 | accessdate = 2013-10-31
Line 24: Line 25:
[[Category:Database management systems]]
[[Category:Database management systems]]
[[Category:Memory management]]
[[Category:Memory management]]


{{database-stub}}

Latest revision as of 13:09, 1 September 2023

In computer science, a pool is a collection of resources that are kept in memory, ready to use, rather than the memory acquired on use or the memory released afterwards. In this context, resources can refer to system resources such as file handles, which are external to a process, or internal resources such as objects. A pool client requests a resource from the pool and performs desired operations on the returned resource. When the client finishes its use of the resource, it is returned to the pool rather than released and lost.[clarification needed]

The pooling of resources can offer a significant response-time boost in situations that have high cost associated with resource acquiring, high rate of the requests for resources, and a low overall count of simultaneously used resources. Pooling is also useful when the latency is a concern, because a pool offers predictable times required to obtain resources since they have already been acquired. These benefits are mostly true for system resources that require a system call, or remote resources that require a network communication, such as database connections, socket connections, threads, and memory allocation. Pooling is also useful for expensive-to-compute data, notably large graphic objects like fonts or bitmaps, acting essentially as a data cache or a memoization technique.

Special cases of pools are connection pools, thread pools, and memory pools.

Object pools[edit]

Pools can also be used for objects, in which context a pool refers to a design pattern for implementing pools in object-oriented languages, such as in the object pool pattern. Objects themselves hold no external resources and only occupy memory, although an already created object avoids the memory allocation required on object creation. Object pools are useful when the cost of object creation is high, but in certain situations this simple object pooling may not be efficient and could in fact decrease performance.[1]

References[edit]

  1. ^ "Java theory and practice: Urban performance legends, revisited". ibm.com. 2005-09-27. Archived from the original on 2011-12-29. Retrieved 2013-10-31.