This project uses a language-based technique to unify two seemingly opposite programming models for building massively concurrent network services: the event-driven model and the multithreaded model. The result is a unified concurrency model providing both thread abstractions and event abstractions. We implemented the unified concurrency model in Haskell, a pure, lazy, functional programming language. Our implementation demonstrates how to use these techniques by building an application-level thread library with support for multiprocessing and asynchronous I/O mechanisms in Linux. The thread library is type-safe, is relatively simple to implement, and has good performance. Application-level threads are extremely lightweight (scaling to 10,000,000 threads!) and our scheduler, which is implemented as a modular and extensible event-driven system, outperforms NPTL in I/O benchmarks.
This is an Erlang solution to "The Santa Claus problem",
% as discussed by Simon Peyton Jones (with a Haskell solution using
% Software Transactional Memory) in "Beautiful code".
% He quotes J.A.Trono "A new exercise in concurrency", SIGCSE 26:8-10, 1994.