[Insight-developers] design issue

Joshua Cates cates@poblano.sci.utah.edu
Mon, 15 Apr 2002 12:41:19 -0600 (MDT)


Hi all,

I'm soliciting feedback on a design issue.

In our SparseFieldLevelSetImageFilter we manage lists of small data
objects (call them LevelSetNodes).  These lists must grow and shrink
dynamically. Because the filter is multithreaded, allocating and freeing
LevelSetObjects as they are needed is not an option.  It's one of those
cases where a naive implementation could actually be slower in a
multithreaded environment because of mutex locks.

So what we do is to pre-allocate a "store" of objects for each thread from
which that thread borrows to grow its lists.  This allows us to operate in
a distributed memory mode.  Each thread has a private reserve of memory
that will not be touched by other threads, eliminating the need for mutex
locks. Blocking only occurs when a thread runs out of memory and has to
enlarge its store.  I am planning to encapsulate this functionality into
an itk::DataObject subclass.

Questions are these:

Have other developers come up with different solutions to this same
problem?

If so, what memory management objects might already exist in Itk (or STL)
to help?

Would other developers find this "itkObjectStore" class useful?

Josh.



______________________________
 Josh Cates
 School of Computer Science
 University of Utah
 Email: cates@cs.utah.edu
 Phone: (801) 587-7697
 URL:   www.cs.utk.edu/~cates