On 11 Aug 2008, at 18:43, Aaron Boodman wrote:
On Sun, Aug 10, 2008 at 5:54 PM, Shannon <[EMAIL PROTECTED]> 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).
The description you quoted from lua-users.org is correct. The
primary implementation of Lua is 100% portable ISO C, it therefore
does _not_ use OS threads for coroutines. I think there may be
extensions/modifications produced by other parties that provide that.
David Jones
Ravenbrook Limited