Supporting some form of concurrency is becoming increasingly popular in languages these days - often by providing threads. These slides (1) make the (well-known but worth-repeating) point that thread programming is hard and (2) suggest the solution is roll-your-own time slicing(!).
A discussion on c.l.f mentioned the Equeue (event queue) package for OCaml, which supports this approach and also gave some interesting details about concurrency in E:
[...] each site in a distributed system
is called a `vat'. The vats run in parallel and can only communicate
via `eventual sends' (this is like a normal function or method call
except that they return `promises' that should eventually resolve to
values)[...]. Internally,
each vat is single-threaded and proceeds by a series of `game moves'
(the idea being that each of these moves preserves consistency, so
that they can be viewed as micro-transactions). The remarkable thing
about E programs is that *they never block*
(Yes, you can still get a form of contention with unresolved promises; that was also discussed in the thread).
Posted to Software-Eng by andrew cooke on 5/26/01; 1:45:27 AM
|