SergeyMakeev / TaskScheduler

Cross-platform, fiber-based, multi-threaded task scheduler designed for video games.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Cross-platform, fiber-based, multi-threaded task scheduler designed for video games.

Written under the influence by great GDC talk "Parallelizing the Naughty Dog engine using fibers" by Christian Gyrling

Compiled and worked on : Clang 3.4, GCC 4.8.2, MSVC 2010/2012/2015/2017, XCODE 6.4

Commercial games using Task Scheduler

  • Skyforge (PC, PS4, X1)

Build status

Linux + OS X Travis build status

Windows Appveyor build status

Usage examples

Minimal example

#include <MTScheduler.h>

// Declare simple task
struct SimpleTask
  MT_DECLARE_TASK(SimpleTask, MT::StackRequirements::STANDARD, MT::TaskPriority::NORMAL, MT::Color::Blue);

  void Do(MT::FiberContext&)
    // ... do thing here ...

int main()
  // Create scheduler
  MT::TaskScheduler scheduler;

  // Declare tasks
  static const int TASK_COUNT = 1000;
  SimpleTask tasks[TASK_COUNT];

  // Run everything
  scheduler.RunAsync(MT::TaskGroup::Default(), &tasks[0], MT_ARRAY_SIZE(tasks));

  // Wait and help to execute unfinished tasks

  return 0;

You can find a lot of usage examples in the test folder:

Useful reading (in random order):

Parallelizing the Naughty Dog engine using fibers by Christian Gyrling

id Tech 5 Challenges From Texture Virtualization to Massive Parallelization by J.M.P. van Waveren

Doom3 BFG Source Code Review: Multi-threading by Fabien Sanglard

How Ubisoft Develops Games for Multicore - Before and After C++11 by Jeff Preshing

Killzone Shadow Fall: Threading the Entity Update on PS4 by Jorrit Rouwe

Killzone Shadow Fall Demo Postmortem by Michal Valient

Infamous Second Son : Engine Postmortem by Adrian Bentley

Multithreading the Entire Destiny Engine - GDC 2015 by Barry Genova (members only),4690817362.mp4%28video%29

Intel Threading Building Blocks - Scheduling Algorithm

CILK/CILK++ and Reducers

Task Scheduling Strategies by Dmitry Vyukov

Implementing a Work-Stealing Task Scheduler on the ARM11 MPCore

Lost Planet graphics course for 3D game fan of Nishikawa Zenji

Dragged Kicking and Screaming: Source Multicore by Tom Leonard

Games: Playing with Threads by Ben Nicholson

Work Stealing by Pablo Halpern

Enki Task Scheduler by Doug Binks

Molecule Engine blog - Job System 2.0 by Stefan Reinalter

Molecule Engine blog - Building a load-balanced task scheduler by Stefan Reinalter

Do-it-yourself Game Task Scheduling by Jerome Muffat-Meridol

Acquire and Release Semantics by Jeff Preshing

Lockless Programming Considerations for Xbox 360 and Microsoft Windows

C/C++11 mappings to processors by Peter Sewell

Memory Ordering in Modern Microprocessors, Part I by Paul E. McKenney

Memory Ordering in Modern Microprocessors, Part II by Paul E. McKenney

Barrier Litmus Tests and Cookbook by ARM

ezoic increase your site revenue


Cross-platform, fiber-based, multi-threaded task scheduler designed for video games.

License:MIT License


Language:C++ 49.2%Language:C 48.0%Language:CSS 2.1%Language:Lua 0.7%Language:Batchfile 0.1%