[whatwg] WebWorkers vs. Threads

>>
>>
>> --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
>
Sorry about the misinformation. I've been working on Lua programs with 
thousands of coroutines running and never noticed any artifacts or 
delays to indicate the execution wasn't truly parallel. What I don't 
understand is why it doesn't appear to block other coroutines on IO but 
since that's not relevant to creating threaded workers I'll leave that 
mystery for future research.

I thought Lua had an implementation of automated locking to use as a 
reference but since it doesn't I have nothing more to offer on the 
subject. Without knowing the internals of existing JS implementations I 
have no idea what would be involved to provide automated locking and 
whether it is impossible or just difficult.

Shannon



 

Received on Tuesday, 12 August 2008 02:51:55 UTC