3 ms·
Bell Labs and CSP Threads
- kazinator 11y agoThe problem with flow-based programming is the debugging. If that if you put a breakpoint on some message-processing code in a thread and examine the backtrace, it ends in up in some "read next message and dispatch" loop. Thereafter, the trail runs cold. Where did the incorrect message come from? Oh, the "left neighbor". What's it doing now? Something no longer related to what it was doing when that message was produced; it's sitting in its own loop, blocked on receiving the next message. Spaghetti algorithms emerge. Some crucial behavior is implemented using ad-hoc messages involving several distant threads. "If we inject this new message type here, then massage it here, then finally process it over there, we can achieve such and such a scenario". The message is then like the data equivalent of a rampant goto, not to mention that the plumbing is a giant global variable. The approach is good for eliminating deadlocks, though. No module calls into another module where it has to acquire that module's locks.