views:

218

answers:

2

I am looking at the advantages of threadpooling design pattern in Embedded systems. I have listed few advantages, please go through them, comment and please suggest any other possible advantages that I am missing.

  1. Scalability in systems like ucos-2 where there is limit on number of threads.
  2. Increasing capability of any task when necessary like Garbage collection (say in normal systems if garbage collection is running under one task, its not possible to speed it up, but in threadpooling we can easily speed it up).
  3. Can set limit on the max system load.

Please suggest if I am missing anything.

A: 

Thread creation/destruction may carry a large overhead and be non-deterministic. One time creation of a thread pool puts all this overhead up-front, and can improve performance by having threads ready to run at any time.

Clifford
+1  A: 

Pooling also helps avoid nasty lower level leaks that can happen when you create and destroy threads. A certain unamed embedded OS likes to lose 4K everytime a thread dies(even after the process is destroyed). On this particular OS, it is impossible to have a long running system that makes threads frequently, that is unless you use thread pooling.

James Branigan