How does Julia Async Task Scheduler work?

It’s also worth noting that there are two different ways to spawn new tasks:

  1. @async which will always run the task on the same hardware thread as the current task, and will only make progress when the current task blocks and yields back to the scheduler;
  2. @spawn which creates a task that can be run on any hardware thread, so it can make progress while the current task is still working if there are other threads available.

You can synchronize both with @sync.

7 Likes