Better HN
topnewbestaskshowjobs
Log inSign up

FixedPoint

5 karma · joined Mar 31, 2011 (15y ago) · 2 submissions

Submissions

comment 15y ago · link · parent

Quoting Robert Harper: 'Concurrency is concerned with nondeterministic composition of programs (or their components).' [1]

Threads can be a very efficient way of introducing non-determinism (preferable to incurring IPC overhead). Writing correct code then boils down to controlling interactions between threads. Actor architectures can be very helpful in such settings. Key to safe implementations are type-enforced isolation and immutability. More experimentally, STMs offer the promise of high-level composition of actors. My 2p.

[1] http://existentialtype.wordpress.com/2011/03/17/parallelism-...

comment 15y ago · link · parent

I am sorry, but event-based programming is the wrong way to tackle the problem of scaling up blocking I/O code. Event-based programming more or less forces one to write in CPS style, which soon becomes a nightmare to reason about. I speak from the experience of having written several thousand lines of such code.

A better solution is to pick a language that has light-weight threads (Haskell, Erlang, ...), and let the language handle the events (and call-stacks!) under the hood. Cf the caffeine/percolator paper (even though they do end up using heavy-weight Java threads).