[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Erlang Style Cocurrency in Lua
- From: Benjamin Tolputt <btolputt@...>
- Date: Wed, 14 Jan 2009 09:55:05 +1100
Timothy Baldridge wrote:
> Actually I looked into it, but unfortunately it doesn't go far enough.
> The scheduling is still co-operative. So it is possible for one
> process to hog all the processing. Secondly, as far as I can tell the
> VM is still limited to a single CPU which basically limits the
> usefulness of the implementation. On top of all that we still would
> need to modify the Lua syntax to allow for Erlang style message
> It's a cool hack, but doesn't go far enough to be useful.
Well, if it were me doing this (and I know it's not), I would look into
combining LuaLanes with ConcurrentLua on top of an "X VM instructions
then automatically yield" hack (there are a couple around I have seen).
LuaLanes uses multiple threads (and multiple Lua states) with
communication between the threads through established "channels". With a
little work you could load ConcurrentLua on top of each "lane" (i.e.
thread) which would get you pretty close on what you want (syntax
extensions aside). Processes would be stuck on the thread they were
created on, but depending on your overall requirements - this may be a
One thing to remember is that Erlang's super-scalable concurrency works
for a number of reasons, but one of them is the fact that there is no
"state sharing". between processes. I do not even want to think about
debugging an application where 10K threads can all share read/write
objects without locking...
Mob: 0417 456 505
This email and any files transmitted with it are confidential to the
intended recipient and may be privileged. If you have received this
email inadvertently or you are not the intended recipient, you may not
disseminate, distribute, copy or in any way rely on it. Further, you
should notify the sender immediately and delete the email from your
computer. Whilst we have taken precautions to alert us to the presence
of computer viruses, we cannot guarantee that this email and any files
transmitted with it are free from such viruses.