lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I've tested some time ago fork() with zeromq, and it worked fine.
But there is no fork() on Windows (cygwin has some sort of emulation)

http://github.com/malkia/ufo/blob/master/samples/zmq/forked.lua

e.g. something like this:

ffi.cdef( "int fork()" )
local fid = ffi.C.fork()

if fid ~= 0 then
   print( 'parent, fid=', fid )
   -- loop for the parent
elseif fid == 0 then
   print('child')
   -- loop for the child
end


On 8/11/2012 7:55 PM, mattk wrote:
In some Redis loading tests, LuaJIT 2.0 (beta) is performing quite nicely, at
about 60% of the runtime of a similar single threaded Python script.

Using Python's multiprocessing module,
http://www.ngcrawford.com/2012/03/29/python-multiprocessing-large-files/
chunking large text files , results in a significant performance improvement
over a single process, splitting the works across cores. This is a
multi-threaded approach, but multiple Python interpreters.

I am assuming using the same approach in Lua / LuaJIT would perform even
better, but as a Lua beginner, I have not found the correct approach.
LuaLanes has been suggested. Essentially I am looking for a mechanism to
create a master list of tasks / jobs, when are then dispatched to a number
of worker processes < number of cores in the system.

Can anyone point me in the right direction?



--
View this message in context: http://lua.2524044.n2.nabble.com/Lua-pattern-similar-to-Python-multiprocessing-tp7642010.html
Sent from the Lua-l mailing list archive at Nabble.com.