Threads vs. continuations

"Martin v. Löwis" martin at
Tue Feb 19 23:23:12 CET 2008

> I've been doing some thinking, and I've halfway convinced myself of
> the following statement: that threads as implemented by Python (or
> Java) are exactly equivalent to one-shot continuations in Scheme.  Am
> I right?

No. In case of threads, progress can be made in an overlapping
(concurrent), in case of Java even parallel fashion. In particular,
if a thread blocks in a blocking operating system call (e.g. a network
receive operation), other threads can continue. I believe this is not
possible with continuations in Scheme.

In more detail, threads as provided by the operating system underly
a system scheduler: they can be preempted, they have priorities,
and they may voluntarily block. All this is not possible with

IOW, threads are more expressive than continuations.


More information about the Python-list mailing list