#parallel question
1 messages · Page 1 of 1 (latest)
soo 8 actors -> under heartbeat does work for 5ms
should all execute at same time righttt
Ask hao, he is good with parallel stuff
so am confused on how it would load balance
i bothered him too much already
Why not try it?
as in ask him or
so it would have to put the 8 at
4 each core
question is, would it run one after another? all at same time?
that could be out of context 
@lime cedar ik u hate me already but is this still true?
and is it main thread + 2 ? or its main thread + 1
it depends on how you're implementing it
imagine simple heartbeat:ConnectParallel
on each actor
then just loop that does some stuff for exacly 5ms
timed
It is genuine multi threading, each actor when executing is executing in a different luau VM on a different thread
Its main thread + 2 iirc
It can only execute 2 at the same time, the other actors will wait until a thread frees up for them to execute on
Roblox has a good image that describes this on their docs
https://create.roblox.com/docs/scripting/multithreading
makes sense
i was told that
heartbeat:ConnectParallel
i also delayed
if main thread does something under heartbeat
so only after main is done, it will fire heartbeat in parallel
is that true
I don't know that case, you'd have to test it yourself
its 2 worker threads main runs in one on the worker thread
So main + one
Hao is this true or I misunderstood u
I hardly can tell what am seeing
But I assume 2 bars mean 2 threads cores whatever
there isnt really a main thread, it just bounces beetween workers
What happends if I got like
while loop under actor but not desynced
And heartbeat connect parallel
With code that takes 10ms
Does it stop loop, do parallel fully and resume
Or it constantly jumps between both
one of them will run first
So while loop would prevent heartbeat from firing?
the while looo will run until it yields or stops
then the parallel stuff gets a chance to run
thne once thats done the while looo resumes running
firing late?
I understood (prob wrong); from your messages
That if you got main thread doing stuff under heartbeat
Then heartbeat in actors will fire after that code is ran
yea
So technically
If I want to run some code, under heartbeat, on main + parallel at same Time, without dropping fps from 60
I should be fine if I;
Use heartbeat and stepped, stepped to detect exact start of frame, then have heartbeat run untill that
But on main thread I'd need to task spawn heartbeat to not prevent parallel from firing
seems server has 2 workers, client has 3? not sure if server workers scale to server size
I'd have sub 10 so doesn't rly affect me
So just 2 workers it is
So wait
If only 2 workers
Would it be better to run:
Heavy logic in: parallel (one) and main
Or have 2 actors doing heavy work and main, main doing barely anything (just some remotes, etc)
Assuming same workload, just split to either actor and main, vs 2 actors
if you're going to have actors, it seems a waste not to have 2 threads doing heavy work concurrently
Am bit confused
If 2 workers
Then really main thread lives on one, actor on another
So using both no?
yes, but the main thread would still be idle >90% of the time since you're not running any heavy work on it
if a thread is idle, the scheduler can assign a second actor to it
@dusty gorge you can test this out by using the microprofiler and debug lib as well
It's heavy math every frame
So it will not be idle
I just want heavy math on both workers
oh, I see. then yes, one actor is fine
I just assumed the main thread didn't have any heavy math
if i was to do 2 actors + main, then just 2 actors handle it, main doing close to nothing, as i asume roblox would automacly put them on seperate thread
but if one actor + main, thats 1 per worker then both gonna do heavy math
so just either is fine?
or 2+main/1 + main has advantage
