[Fwd: Re: [cells-devel] Cells and Threads]

Attila Lendvai attila.lendvai at gmail.com
Wed Feb 21 09:25:04 UTC 2007


> > I have an application that is multithreaded and I would like to
> > explore how to use cells to drive the dataflow.  I've read through the
> > examples and looked over the code a bit. Seems like I could get in
> > trouble if multiple threads tried to change a cell with dependencies
> > at the same time.

i think a global read-write lock could work, which is acquired for
read whenever a cell is checked for validity and upgraded to writing
when the cell is invalid and needs recalculation. a write lock locks
out all other readers and writers, while readers can operate paralel.

interesting questions arise when the calculations themselves have to
acquire other locks in the application... then it's not trivial to
ensure the proper locking order everywhere that avoids random
deadlocks.

but at first i would just create a big-lock-of-the-world which is
acquired whenever anything is used that uses Cells in your app. but
this kills paralelism more and more as the Cells-using part of the app
is bigger and bigger.

hope i said something useful,

-- 
- attila

"- The truth is that I've been too considerate, and so became
unintentionally cruel...
 - I understand.
 - No, you don't understand! We don't speak the same language!"
(Ingmar Bergman - Smultronstället)


More information about the cells-devel mailing list