mattbasta
mattbasta

Reputation: 13709

Lua Lanes and multi-core support: Can it be done?

Lua Lanes says that it enables multi-core support through multithreading. Isn't this incorrect? Don't you need to use multiple processes to take advantage of multiple cores? Does Lua Lanes do this?

Perhaps I'm misinterpreting what they're saying. Here's the passage from their site:

Lua Lanes is a Lua extension library providing the possibility to run multiple Lua states in parallel. It is intended to be used for optimizing performance on multicore CPU's and to study ways to make Lua programs naturally parallel to begin with.

Thanks

Upvotes: 2

Views: 2663

Answers (2)

Michal Kottman
Michal Kottman

Reputation: 16753

It depends on the operating system, but most current operating systems (Windows, Linux/*nix, ...) distribute tasks onto cores/CPUs by threads, not by processes. So a single process with multiple threads can be run on multiple cores.

Lanes uses real OS threads, not the lightweight Lua threads - coroutines, so the scheduler can actually distribute it onto multiple cores.

Upvotes: 10

9000
9000

Reputation: 40884

As far as I can tell, they run multiple Lua machines inside one multi-threaded OS process. They use Lindas for Lua shared data and IPC, but this does not involve OS-level IPC and other multi-process overhead.

Note that I conclude this after skimming your link, not after trying to run lanes, etc. I may be dead wrong.

Upvotes: 2

Related Questions