LuaJIT/Love multicore

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
GVovkiv
Party member
Posts: 668
Joined: Fri Jan 15, 2021 7:29 am

LuaJIT/Love multicore

Post by GVovkiv »

Just curious
How luajit/love handles cpus with severals cores and threads?
Does it's something that i should care about or luajit/love takes care of it?
Does luajit/love will properly use, for example, cpu with 8 cores? 16?
Or luajit/love will use, for example, 4 cores because it can't use more?(Like some really old games, etc)
Last edited by GVovkiv on Wed Nov 10, 2021 11:00 pm, edited 1 time in total.
User avatar
darkfrei
Party member
Posts: 1168
Joined: Sat Feb 08, 2020 11:09 pm

Re: LuaJIT/Love multicore

Post by darkfrei »

Don't use multithreading if you can make same without it :)
https://love2d.org/wiki/love.thread
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
User avatar
GVovkiv
Party member
Posts: 668
Joined: Fri Jan 15, 2021 7:29 am

Re: LuaJIT/Love multicore

Post by GVovkiv »

darkfrei wrote: Wed Nov 10, 2021 10:47 pm Don't use multithreading if you can make same without it :)
https://love2d.org/wiki/love.thread
As far as i know, lua's threads how nothing in common with cpu's cores, so if that true, i don't mean that
I just curious about how luajit/love deals with cpu with several cores, nothing more
I was never (at the moment) situation, where i really need that
And because i don't know (at the moment) C and i don't know what "google" is, I just want to ask that from someone who know how that works
thats all
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: LuaJIT/Love multicore

Post by grump »

A single core is utilized by default. You can manually create threads with love.thread.newThread. They are real threads, scheduled by the OS across available cores. You can send data safely between threads over channels, but actual memory sharing is limited and there are none of the usual synchronization primitives available.
User avatar
GVovkiv
Party member
Posts: 668
Joined: Fri Jan 15, 2021 7:29 am

Re: LuaJIT/Love multicore

Post by GVovkiv »

grump wrote: Wed Nov 10, 2021 11:10 pm A single core is utilized by default. You can manually create threads with love.thread.newThread. They are real threads, scheduled by the OS across available cores. You can send data safely between threads over channels, but actual memory sharing is limited and there are none of the usual synchronization primitives available.
Oh, so that REAL threads?
Huh, now that makes that more clear to me, thanks
User avatar
zorg
Party member
Posts: 3435
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: LuaJIT/Love multicore

Post by zorg »

Lua's "fake" threads are coroutines; löve's threads are real, and the only way to actually utilize multiple cpu cores. (well, the audio processing already happens on a separate thread anyway)
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
GVovkiv
Party member
Posts: 668
Joined: Fri Jan 15, 2021 7:29 am

Re: LuaJIT/Love multicore

Post by GVovkiv »

zorg wrote: Thu Nov 11, 2021 8:35 am Lua's "fake" threads are coroutines; löve's threads are real, and the only way to actually utilize multiple cpu cores. (well, the audio processing already happens on a separate thread anyway)
Yeah, looks like i was confused with lua's coroutines and love's threads
Maybe it should be mentioned in https://www.love2d.org/wiki/love.thread with something like "love.thread can interact with cpu's cores/threads, do not confuse it with lua's coroutines" so someone like me will be never confused with it
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 22 guests