Computer Science 490.002 Topical Paper Presentation #12 Mark Pfeffer Pooling P a t t e r n P o o l i...

5
Computer Science 490.002 Topical Paper Presentation #12 Mark Pfeffer Pooling Pattern Pooling – Page 1 Pooling by Michael Kircher, Prashant Jain

Transcript of Computer Science 490.002 Topical Paper Presentation #12 Mark Pfeffer Pooling P a t t e r n P o o l i...

Page 1: Computer Science 490.002 Topical Paper Presentation #12 Mark Pfeffer Pooling P a t t e r n P o o l i n g – P a g e 1 by Michael Kircher, Prashant Jain.

Computer Science 490.002Topical Paper Presentation #12Mark Pfeffer

Pooling

Patte

rn Po

olin

g –

Page 1

Poolingby

Michael Kircher, Prashant Jain

Page 2: Computer Science 490.002 Topical Paper Presentation #12 Mark Pfeffer Pooling P a t t e r n P o o l i n g – P a g e 1 by Michael Kircher, Prashant Jain.

The ProblemAccessing 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.

Patte

rn Po

olin

g –

Page 2

Friends, we need a Pool!

Page 3: Computer Science 490.002 Topical Paper Presentation #12 Mark Pfeffer Pooling P a t t e r n P o o l i n g – P a g e 1 by Michael Kircher, Prashant Jain.

The Pooling PatternResource 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

Patte

rn Po

olin

g –

Page 3

Page 4: Computer Science 490.002 Topical Paper Presentation #12 Mark Pfeffer Pooling P a t t e r n P o o l i n g – P a g e 1 by Michael Kircher, Prashant Jain.

Real-World ApplicationConsider Dynamic Memory AllocationUser – 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.

Patte

rn Po

olin

g –

Page 4

Page 5: Computer Science 490.002 Topical Paper Presentation #12 Mark Pfeffer Pooling P a t t e r n P o o l i n g – P a g e 1 by Michael Kircher, Prashant Jain.

Pattern AnalysisA 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.

Patte

rn Po

olin

g –

Page 5