Visa som: Mobil

C++ Threads Programming

Kort om utbildningen
3 dagar
26 950 SEK exkl. moms
Nästa tillfälle: Efter överenskommelse - Distans


Writing thread based programs is one of the most difficult programming tasks you can do. Actually, the general advice is to completely avoid putting in bugs in the code. If that advice turns out to be unrealistic, the next best thing you can do is program according to a set of well-known design patterns. In this course, we focus on the latter approach.
This course has some concepts in common with the course “Threads Programming using C”, but uses C++ and C++11 to reach much farther into the land of concurrent programming.

The sections below show the course topics, but not necessarily organized into these chapters nor in the listed order.

Introduction to Threads and Processes

In this chapter we lay the groundwork for the course.

What is the difference between concurrent vs. parallel
What is thread and how is it related to a process
What is a task and what is an actor, and how are they related to threads and processes
The process virtual address space and its organization
The mechanics of a function call and why this is relevant to the understanding of a thread
A short overview of the evolution of concurrency operations

POSIX Threads

A first introduction to POSIX Threads (PThreads) and C++ threads .

Overview of the POSIX Threads API
Creating a simple thread
Initialization arguments of a thread
Configuration attributes of a threads, such as its stack size
Wrapping a thread in C++
C++11 threads and how to launch a new thread

The Critical Section Problem

Here we demonstrate the classic problem of critical sections and during which conditions it appear and how to avoid it.

The single bank account and multiple updaters problem
Understanding the problem and how to deal with it
POSIX mutex locks
Configuration attributes of mutex locks
Wrapping mutex locks in C++
C++11 mutex lock types
Recursive locks
Read/Write locks

The Race-condition Problem

Here we demonstrate the classical problem of sending data between two threads.

The producer-consumer problem
Understanding the problem and how to deal with it
POSIX condition variables
Wrapping condition variables in C++
C++11 condition variables
C++11 unique locks and multi-locks
Configuration attributes of condition variables
The minimum amount of code to safely transfer a set of data items from one thread to another thread
A shared data class

Message passing

In this chapter we discuss the general concept of message passing as opposed to the paradigm of shared data, and compare the pros and cons of each approach.

What is message passing
The pros and cons of a message passing solution
The pros and cons of a shared data solution
Design and implementation of message queue
Bi-directional message passing
Rendezvous and futures/promises
The role of smart pointers in the context of threads programming
N clients and 1 server
1 client and N servers

Deadlock and starvation

Here we discuss resource related problems such as starvation, livelock and deadlock.

What is a resource
Starvation and how to deal with it
Livelock and how to deal with it
Deadlock and how to understand it and how to prevent or detect it
What is actors concurrency and how differs it from threads concurrency
Using an Actors library
Towards the 100K concurrency problem


In this chapter we discuss the older (but sometimes important) concept of semaphores

What is semaphores
POSIX semaphores
Wrapping semaphores in C++
Memory-based semaphores
File-system based semaphores

Process creation

In this chapter we discuss process creation (fork/exec) and how to use semaphores to synchronize.

The mechanics of forking a new process
Understanding exit and wait
Zombies and daemons
How to lobotomize a process into a new process using exec
Basic synchronization of processes using semaphores

Shared memory

In this chapter we learn how to map a shared memory segment between two or more processes.

What is shared memory
Using the POSIX API for shared memory

Understanding the difference of synchronizing threads and processes and which POSIX data types can be of help in either case 
The course is deliverd in cooperation with



Informator är utbildningsföretaget som stärker din konkurrenskraft genom att underhålla, uppdatera och tillföra relevant kunskap inom IT och management där och när du behöver det. Vi har vuxit tillsammans med svensk mjukvaruindustris ledande företag och utbildat utvecklare, tekniker, projektledare och chefer sedan...

Läs mer om Informator och visa alla utbildningar.



Karlavägen 108
115 26 Stockholm

 Visa telefonnummer