[whatwg] WebWorkers vs. Threads

On Sun, Aug 10, 2008 at 5:54 PM, Shannon <shannon at arc.net.au> wrote:
> * each coroutine gets a real OS thread (if available).

<snip>
Coroutines in Lua are not operating system threads or processes.
Coroutines are blocks of Lua code which are created within Lua, and
have their own flow of control like threads. Only one coroutine ever
runs at a time, and it runs until it activates another coroutine, or
yields (returns to the coroutine that invoked it). Coroutines are a
way to express multiple cooperating threads of control in a convenient
and natural way, but do not execute in parallel, and thus gain no
performance benefit from multiple CPU's. However, since coroutines
switch much faster than operating system threads and do not typically
require complex and sometimes expensive locking mechanisms, using
coroutines is typically faster than the equivalent program using full
OS threads.
</snip>

--http://lua-users.org/wiki/CoroutinesTutorial

Is this description incorrect? It seems at odds with what you said
about Lua coroutines getting an OS thread (if one is available).

- a

Received on Monday, 11 August 2008 10:43:29 UTC