[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:21:03 +1100
Timothy Baldridge wrote:
> I spent some time last year learning Erlang, and I have to say, I love
> the way it works. However, I find the syntax totally unusable for my
> everyday use.
> I have an idea for Lua after digging through its sources. I love Lua,
> it's fast, simple and brain-dead easy to extend.What I would like to
> do is add Erlang style co-currency and actor based programming models
> to Lua. Basically the idea would be to spawn a separate LuaState for
> each "process" (in the Erlang sense of the word). Then in the main
> loop of the interpreter, we could exit early after a certain number of
> OPS have been executed.
> >From here we can spawn n+1 OS threads where n is the number of CPUs.
> By cycling through the LuaStates we should be able to keep all the
> CPUs busy all the time.
> My idea is to add these extra LuaStates as "children" of the first
> state created. In this way all the existing C modules should/might
> continue to work. Granted if two processes call the same thread we may
> have issues, but hey, it's not a perfect world.
> Throw into this mix a simple ! operator so we can do:
> pid ! message
> And we would be on the road to having Erlang style co currency in Lua.
> Is anyone interested in working on this with me? I know C like the
> back of my hand, I could just use some feedback/backup in the codin
I would suggest looking into "ConcurrentLua" which starts from the same
basis as you seem to be. Google is your friend here :)
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.