W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2008

[whatwg] WebWorkers vs. Threads

From: Aaron Boodman <aa@google.com>
Date: Mon, 11 Aug 2008 10:43:29 -0700
Message-ID: <278fd46c0808111043k282418c5qb7a22c0773e6a99d@mail.gmail.com>
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

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:04 UTC