How heavy are threads compared to procedure calls?

Charles D Hixson charleshixsn at earthlink.net
Tue May 23 14:00:49 PDT 2006


I realize that they aren't exactly identical, but I have a project in
mind that should, logically, be done via forked processes...thousands of
forked processes.  This is obviously impractical.  I could do two
different redesigns:  one, based around threads, would still involve the
creation of immense numbers of threads.  The other, based around
procedure calls, would be theoretically a much poorer model.  (Well, a
neural net *IS* a bunch of processes that execute relatively
independently...)

Typically people decompose a neural net into collections of arrays, but
I would prefer to model each "cell" as an object.  This is obviously a
poor match of the design of the algorithm to the structure of the
processor, but I suspect that there will be details revealed in the
operation that will only be detected if each cell is an object.  So
that's what I need.

The question is, just how inefficient would it be to model each "firing"
of a neuron as the spawning of a thread.  If I can do it this way then
the "cells" can operate pseudo-simultaneously.  If I can't, I'll need to
 add a separate buffer and a bunch of code to emulate synchronous
operation.  Messy.  Necessary?



More information about the Digitalmars-d-learn mailing list