Threading: Parallelism and Concurrency
Topic Outline
Overview of Memory Layout: Heap and Stack
- Understanding the memory layout of a process, including the heap and stack.
- Explaining the concept of the call stack and its role in thread execution.
The Concept of Thread and Thread Context
- Introducing the concept of a thread and its execution context.
- Highlighting the main differences between a process and a thread in terms of isolation, memory management, and scheduling.
Understanding Parallelism and Concurrency
- Explaining the difference between parallel and concurrent execution.
- Understanding how threads enable concurrent execution within a single process.
Introduction to Pthread Library
- Overview of the Pthread library (POSIX threads) for thread programmability.
- Covering essential functions for creating, joining, and cancelling threads using the Pthread API.
References
- Function Pointer in C
- ECE 252 Lecture 10: Threads
- ECE 252 Lecture 11: Threads and Concurrency
- Параллельное программирование. Лекция 1
- Introduction to Pthreads
Practice
Writing Multi-threaded Programs using Pthread Library
- Hands-on exercises to write multi-threaded programs using the Pthread library.
- Implementing parallel execution of tasks within a single process using threads.
Using Library Functions to Manage Threads
- Practical demonstrations of using library functions to join and cancel threads within a program.
- Understanding the role of thread synchronization and coordination.
Compilation and Linking with Pthread Library
- Understanding the compilation and linking process with the Pthread library.
- Ensuring proper integration of Pthread library functions in multi-threaded programs.
References
- Linux manual page - pthread_create(3)
- Linux manual page - pthread_join(3)
- Linux manual page - pthread_exit(3)
- Linux manual page - pthread_cancel(3)
- Linux manual page - pthread_attr_init(3)
- Linux manual page - pthread_attr_destroy(3)
- Multithreading in C
- Thread functions in C/C++