thoughtarray
Doing something as "at the same time" as possible
I know beam makes a scheduler per CPU (OS thread); so theoretically I can do something at exactly the same time up to the number of CPUs I have.
What is the best way to kick them all off at the same time? Is my only option to send (via Process.send or Kernel.send) a message to a process running on each scheduler? If I do that, the messages are sent out serially. Any alternative techniques or should that be considered fast enough in this ecosystem?
I posted a similar post, but I think it was too complex to bother with.
Most Liked
benwilson512
The type of question you’re asking I think requires some definitions. There is, at the end of the day, no such thing as truly “at the same time” there is “measured to be within a time bound by an observer”. How tight does the time bound need to be? Why? Who is observing this?
schneebyte
You could check how others are doing it.
Maybe you could tell your processes to start at a specific point in time
https://www.erlang.org/doc/man/erlang#monotonic_time-0
then just have them sleep and check time repeatedly.
/one more thing
I don’t think you can choose the specific scheduler a process is on.
:erlang.system_info(:scheduler_id)
I guess if you spawn enough processes under load it should be spread out to all available schedulers.







