1## About 2 3**Cross-platform, fiber-based, multi-threaded task scheduler designed for video games.** 4 5**Written under the influence by great GDC talk "Parallelizing the Naughty Dog engine using fibers" by Christian Gyrling** 6 7Compiled and worked on : **Clang 3.4, GCC 4.8.2, MSVC 2010/2012/2015/2017, XCODE 6.4** 8 9## Commercial games using Task Scheduler 10 11- Skyforge (PC, PS4, X1) 12 13## Build status 14 15Linux + OS X 16 17 18Windows 19 20 21## Usage examples 22 23Minimal example 24```c++ 25#include <MTScheduler.h> 26 27// Declare simple task 28struct SimpleTask 29{ 30 MT_DECLARE_TASK(SimpleTask, MT::StackRequirements::STANDARD, MT::TaskPriority::NORMAL, MT::Color::Blue); 31 32 void Do(MT::FiberContext&) 33 { 34 // ... do thing here ... 35 } 36}; 37 38int main() 39{ 40 // Create scheduler 41 MT::TaskScheduler scheduler; 42 43 // Declare tasks 44 static const int TASK_COUNT = 1000; 45 SimpleTask tasks[TASK_COUNT]; 46 47 // Run everything 48 scheduler.RunAsync(MT::TaskGroup::Default(), &tasks[0], MT_ARRAY_SIZE(tasks)); 49 50 // Wait and help to execute unfinished tasks 51 scheduler.WaitAll(1000) 52 53 return 0; 54} 55``` 56 57You can find a lot of usage examples in the test folder: 58https://github.com/SergeyMakeev/TaskScheduler/tree/master/SchedulerTests/Tests 59 60## Useful reading (in random order): 61 62Parallelizing the Naughty Dog engine using fibers by Christian Gyrling 63 64http://www.swedishcoding.com/wp-content/uploads/2015/03/parallelizing_the_naughty_dog_engine_using_fibers.pdf 65 66id Tech 5 Challenges 67From Texture Virtualization to Massive Parallelization by J.M.P. van Waveren 68 69http://s09.idav.ucdavis.edu/talks/05-JP_id_Tech_5_Challenges.pdf 70 71Doom3 BFG Source Code Review: Multi-threading by Fabien Sanglard 72 73http://fabiensanglard.net/doom3_bfg/threading.php 74 75How Ubisoft Develops Games for Multicore - Before and After C++11 by Jeff Preshing 76 77http://www.youtube.com/watch?v=X1T3IQ4N-3g 78 79Killzone Shadow Fall: Threading the Entity Update on PS4 by Jorrit Rouwe 80 81http://www.slideshare.net/jrouwe/killzone-shadow-fall-threading-the-entity-update-on-ps4 82 83Killzone Shadow Fall Demo Postmortem by Michal Valient 84 85http://www.guerrilla-games.com/presentations/Valient_Killzone_Shadow_Fall_Demo_Postmortem.pdf 86 87Infamous Second Son : Engine Postmortem by Adrian Bentley 88 89http://adruab.net/wp-images/GDC14_infamous_second_son_engine_postmortem.pdf 90 91Multithreading the Entire Destiny Engine - GDC 2015 by Barry Genova 92 93http://www.gdcvault.com/play/1022164/Multithreading-the-Entire-Destiny (members only) 94http://chomikuj.pl/dexio21/GDC+2015/GDC+Vault+-+Multithreading+the+Entire+Destiny+Engine,4690817362.mp4%28video%29 95 96 97Intel Threading Building Blocks - Scheduling Algorithm 98 99https://www.threadingbuildingblocks.org/docs/help/reference/task_scheduler/scheduling_algorithm.htm 100 101CILK/CILK++ and Reducers 102 103http://www.slideshare.net/yunmingzhang/yunming-zhang-presentations 104 105Task Scheduling Strategies by Dmitry Vyukov 106 107http://www.1024cores.net/home/scalable-architecture/task-scheduling-strategies 108 109Implementing a Work-Stealing Task Scheduler on the ARM11 MPCore 110 111http://www.rtcgroup.com/arm/2007/presentations/211%20-%20Implementing%20a%20Work-Stealing%20Task%20Scheduler.pdf 112 113Lost Planet graphics course for 3D game fan of Nishikawa Zenji 114 115http://game.watch.impress.co.jp/docs/20070131/3dlp.htm 116 117Dragged Kicking and Screaming: Source Multicore by Tom Leonard 118 119http://www.valvesoftware.com/publications/2007/GDC2007_SourceMulticore.pdf 120 121Games: Playing with Threads by Ben Nicholson 122 123http://www2.epcc.ed.ac.uk/downloads/lectures/BenNicholson/BenNicholson.pdf 124 125Work Stealing by Pablo Halpern 126 127https://github.com/CppCon/CppCon2015/tree/master/Presentations/Work%20Stealing 128 129Enki Task Scheduler by Doug Binks 130 131http://www.enkisoftware.com/devlogpost-20150822-1-Implementing_a_lightweight_task_scheduler.html 132 133http://www.enkisoftware.com/devlogpost-20150905-1-Internals_of_a_lightweight_task_scheduler.html 134 135Molecule Engine blog - Job System 2.0 by Stefan Reinalter 136 137http://blog.molecular-matters.com/2015/08/24/job-system-2-0-lock-free-work-stealing-part-1-basics/ 138 139http://blog.molecular-matters.com/2015/09/08/job-system-2-0-lock-free-work-stealing-part-2-a-specialized-allocator/ 140 141http://blog.molecular-matters.com/2015/09/25/job-system-2-0-lock-free-work-stealing-part-3-going-lock-free/ 142 143Molecule Engine blog - Building a load-balanced task scheduler by Stefan Reinalter 144 145http://blog.molecular-matters.com/2012/04/05/building-a-load-balanced-task-scheduler-part-1-basics/ 146 147http://blog.molecular-matters.com/2012/04/12/building-a-load-balanced-task-scheduler-part-2-task-model-relationships/ 148 149http://blog.molecular-matters.com/2012/04/25/building-a-load-balanced-task-scheduler-part-3-parent-child-relationships/ 150 151http://blog.molecular-matters.com/2012/07/09/building-a-load-balanced-task-scheduler-part-4-false-sharing/ 152 153Do-it-yourself Game Task Scheduling by Jerome Muffat-Meridol 154 155https://software.intel.com/en-us/articles/do-it-yourself-game-task-scheduling 156 157Acquire and Release Semantics by Jeff Preshing 158 159http://preshing.com/20120913/acquire-and-release-semantics/ 160 161Lockless Programming Considerations for Xbox 360 and Microsoft Windows 162 163https://msdn.microsoft.com/en-us/library/windows/desktop/ee418650(v=vs.85).aspx 164 165C/C++11 mappings to processors by Peter Sewell 166 167https://www.cl.cam.ac.uk/~pes20/cpp/cpp0xmappings.html 168 169Memory Ordering in Modern Microprocessors, Part I by Paul E. McKenney 170http://www.linuxjournal.com/node/8211/print 171 172Memory Ordering in Modern Microprocessors, Part II by Paul E. McKenney 173http://www.linuxjournal.com/node/8212/print 174 175Barrier Litmus Tests and Cookbook by ARM 176https://developer.arm.com/documentation/genc007826/latest 177https://documentation-service.arm.com/static/5ece8d6a56a54774bd17a1f4 178 179