Here is an interesting talk from Naughty Dog

http://www.gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine

They move Fibers between threads.

A rough overview:

You create task A that depends on task B. The task is submitted as a fiber and executed by a thread. Now task A has to wait for task B to finish so you hold the fiber and put it into a queue, you also create an atomic counter that tracks all dependencies, once the counter reaches 0 you know that all dependencies have finished.

Now you put task A into a queue and execute a different task. Once a thread completes a task it looks into the queue and checks if there is one task that has a counter of 0, which means it can continue to execute that task.

Now move that fiber/task onto a free thread and you can continue to execute that fiber.

What is the current state of fibers in D? I have asked this question on SO https://stackoverflow.com/questions/36663720/how-to-pass-a-fiber-to-a-thread

Reply via email to