Pool (computer science)

From Wikipedia, the free encyclopedia
Jump to: navigation, search

In computer science, a pool is a set of initialised resources that are kept ready to use, rather than allocated and destroyed on demand. A client of the pool will request an object from the pool and perform operations on the returned object. When the client has finished with an object (or resource), it returns it to the pool rather than destroying it.

Pooling of resources can offer a significant performance boost in situations where the cost of initializing a class instance is high, the rate of instantiation of a class is high, and the number of instances in use at any one time is low. The pooled resource is obtained in predictable time when creation of the new objects (especially over network) may take variable time.

However, these benefits are mostly true for objects which are expensive with respect to time, such as database connections, socket connections, threads and large graphic objects like fonts or bitmaps. In certain situations, simple object pooling (which hold no external resources, but only occupy memory) may not be efficient and could decrease performance.[1]

Special cases of pools are connection pools, thread pools, and memory pools. Pool can also refer to a design pattern for implementing them in object-oriented languages, such as the object pool pattern.

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.