Skip to content

Commit 8326e36

Browse files
committed
Update notes
1 parent 4d07b93 commit 8326e36

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

images/latency_5.png

37.1 KB
Loading

notes/performance-in-multithreading.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ There are two main criteria for performance in multithreaded applications:
66
2. **Throughput** - The amount of tasks completed in a given period. Measured in _tasks/time_ unit.
77

88

9-
## Latency
9+
# Latency
10+
11+
**How can we make a task multithreaded?**
1012

1113
Suppose we have a single task which can be completed by a single thread sequentially within time T
1214

@@ -24,16 +26,16 @@ and theoretically we want to achieve the latency of `T/N` (`N` = number of sub-t
2426
Therefore, we want to do a theoretical reduction in latency by `N` = Performance improvement by a factor of `N`.
2527

2628

27-
### Few important questions
29+
## Few important questions
2830

2931
- `N = ?` | How many subtasks/threads to break the original task into?
3032
- Does breaking original task and aggregating results come for free?
3133
- Can we always break any task in multiple subtasks?
3234

3335

34-
#### N = ?
36+
### N = ?
3537

36-
![Latency](../images/latency_4.png)
38+
![N = ?](../images/latency_4.png)
3739

3840
On a general purpose computer : `N` should be as close as possible to the number of CPU cores (`N = number of cores`)
3941

@@ -63,4 +65,9 @@ We cannot run all the threads 100% in parallel, but we can get close to that!
6365

6466
**References:**
6567
- https://www.hp.com/us-en/shop/tech-takes/what-is-hyperthreading
66-
- https://www.intel.com/content/www/us/en/gaming/resources/hyper-threading.html
68+
- https://www.intel.com/content/www/us/en/gaming/resources/hyper-threading.html
69+
70+
71+
### Inherent cost of Parallelization and Aggregation
72+
73+
![Inherent cost of Parallelization and Aggregation](../images/latency_5.png)

0 commit comments

Comments
 (0)