L2 Threads
L2 Threads
• Orchestration
• Structuring communication
• Adding synchronization to preserve dependencies if necessary
• Organizing data structures in memory
• Scheduling tasks
• Poll: PollEv.com/ccris
Should line 20 declare and initialize a
thread?
4 different ways:
1-2 Thread with a function
6-16 Thread with a function
object (callable type)
24-25 Thread with a function
object
30-33 Thread with a lambda
expression (local function
instead of a callable object)
16
• Make sure to
join the thread
even when
there is an
exception!
Objects can also be allocated using malloc() and deallocated using free() (or similar
functions), but the techniques described for new and delete apply to those also
Source: https://www.stroustrup.com/resource-model.pdf
• Reference
• C++ Concurrency in Action, Second Edition
• Chapters 2, 3.1
• Appeal in Edurec after Tue, 5pm if you still don’t have a tutorial slot
allocation
• Explain the reason for your appeals for a specific slot
• Assignment teams: you can switch teams from one assignment to another
• You do not need to register your team (for now)