Thank you Ken and Attila for your feedback. I think I have a fair
understanding of the issues now. I'm going to do some brainstorming
over exactly how I would like the threads to interact with the Cells
engine and then try some experiments with different locking strategies
and see what happens.
I'll report back on what I discover.
Best,
-- Duane
Attila Lendvai wrote:
> 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,
------------------------------------------------------------------------
_______________________________________________
cells-devel site list
[email protected]
http://common-lisp.net/mailman/listinfo/cells-devel
_______________________________________________
cells-devel site list
[email protected]
http://common-lisp.net/mailman/listinfo/cells-devel