50 likes | 218 Views
Computer Science 490.002 Topical Paper Presentation # 12. Pattern Pooling – Page 1. Mark Pfeffer. Pooling. Pooling by Michael Kircher, Prashant Jain. The Problem. Pattern Pooling – Page 2.
E N D
Computer Science 490.002 Topical Paper Presentation #12 Pattern Pooling – Page 1 Mark Pfeffer Pooling Pooling by Michael Kircher, Prashant Jain
The Problem Pattern Pooling – Page 2 Accessing resources is sometimes unpredictable. When a system has to access a large number of resources, this unpredictability can quickly get out of hand. How do we tame resource acquisition, and bend it to our will, without compromising performance and stability? • We need a mechanism which will allow us fast, easy access to resources. Something that • improves performance, • offers predictability, • and stability, • is simple, • and promotes reuse of resources. Friends, we need a Pool!
The Pooling Pattern Pattern Pooling – Page 3 • Resource User • Acquires and uses resources • Releases unused resources to the pool Resource Pool • Acquires resources eagerly and lazily • Recycles resources returned by users Resource Environment • Initially owns resources Resource • Any reusable entity • Acquired from Environment by Pool • Used by Resource User
Real-World Application Pattern Pooling– Page 4 • Consider Dynamic Memory Allocation • User – The Program • Gets memory from the Heap • Returns unused memory to the Heap Pool – The Heap • Manages program memory Environment – The OS • Manages the Heap Resource – Main Memory With the Heap system, the program does not have to petition the OS every time it needs to allocate memory for a dynamic variable/object. Program performance is improved, and the system becomes more stable since the OS does not have to constantly allocate and free RAM.
Pattern Analysis Pattern Pooling – Page 5 A useful pattern for managing a large number of resource-hungry Users, though it seems best suited for system level operations. The prevalence of Garbage Collection in modern languages somewhat diminishes the utility of Pooling. It is obviously still a necessary pattern, though, since the problems it solves are most apparent in environments like operating systems, and web servers. There are some real world examples of Pooling, and many specializations that illustrate situations where the pattern is most applicable. Most notably Database Connection Pooling, and Thread Pooling. These have clear advantages over the alternative, improving performance and predictability, contributing to system stability, and being scalable.