05 Threads
05 Threads
05 Threads
CS 241
Spring 2021
By
Marwa M. A. Elfattah
Main Reference
Operating System Concepts, Abraham Silbrschatz,
10th Edition
Threads &
Concurrency
Concurrency vs. Parallelism
Parallelism implies a system can perform more
than one task simultaneously
Concurrency supports more than one task making
progress
• On a single processor, CPU schedulers were
designed to provide the illusion of parallelism by
rapidly switching between processes, thereby
allowing each process to make progress. Such
processes were running concurrently, but not in
parallel.
Thus, it is possible to have concurrency without
parallelism.
Concurrency vs. Parallelism
Concurrent execution on single-core system:
𝟏
𝑺𝒑𝒆𝒆𝒅 𝒖𝒑 ≤
(𝟏 − 𝒔)
𝑺+
𝑵
Amdahl’s Law
IF: S is serial portion, and N processing cores
𝟏
𝑺𝒑𝒆𝒆𝒅 𝒖𝒑 ≤
(𝟏 − 𝒔)
𝑺+
𝑵