CppCon 2021 has ended
Back To Schedule
Friday, October 29 • 1:30pm - 2:30pm
Combining Co-Routines and Functions into a Job System

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
Every game engine today should have a job system that harvests the power of the available CPU cores. Additionally, C++20 has introduced co-routines, which can schedule other tasks and suspend until these tasks have finished. Due to this suspension, the thread the co-routine is running on is free to serve other jobs.
Using co-routines in a job system results in easy to read code, local variables do not go out of scope until the co-routine returns.
However, there is a price to pay. Co-routines demand to use their own machinery for suspension and synchronizing them with other co-routines. Mixing in functions, lambdas or functors that do not have access to this machinery proves to be a demanding task, especially if they should interact and synchronize with co-routines.
This talk presents the Vienna Game Job System (VGJS), a C++20 based job system that seamlessly combines co-routines with functions, lamdas and functors. Co-routines can synchronize with functions, and vice-versa. This way, programmers can always choose which form of job is appropriate - either create a co-routine (which incurs some overhead due to allocations from the heap and the co-routine machinery), or run a function, a functor, etc., with generally better performance.
Additionally, VGJS allows to create tagged jobs to be run later, e.g., if a game in the game loop goes sequentially through phases, and specific jobs should be run in them. VGJS also allows for collecting performance trace files to be visualized in Chrome, and supports memory resources to be used for its allocations.
The talk will also show performance differences between co-routines, functions, and fibers (co-routines that do not return).

ALL TALK SESSIONS CAN BE ACCESSED FROM THE MAIN LOBBY: https://cppcon.digital-medium.co.uk/

avatar for Helmut Hlavacs

Helmut Hlavacs

Professor, University of Vienna
Dr. Helmut Hlavacs is Full Professor for Computer Science at the University of Vienna, Austria (ORCID: orcid.org/0000-0001-6837-674X). Dr. Hlavacs has a PhD in Mathematics (2001), and an MSc in Mathematics (1993). He also was awarded a Habilitation in the area of Applied Computer... Read More →

Friday October 29, 2021 1:30pm - 2:30pm MDT