Update concurrency slides
This commit is contained in:
+11
-9
@@ -18,8 +18,9 @@ You'll likely encounter it at work:
|
|||||||
|
|
||||||
Performance Benefits
|
Performance Benefits
|
||||||
|
|
||||||
- I/O versus CPU bound applications.
|
|
||||||
- Typically outweigh gains from optimized data structures and algorithms.
|
- Typically outweigh gains from optimized data structures and algorithms.
|
||||||
|
- I/O versus CPU bound applications.
|
||||||
|
|
||||||
- Hardware limitations.
|
- Hardware limitations.
|
||||||
- Rate of single core performance improvement is slowing.
|
- Rate of single core performance improvement is slowing.
|
||||||
- More cores.
|
- More cores.
|
||||||
@@ -113,9 +114,9 @@ Computers can "simultaneously" work on:
|
|||||||
|
|
||||||
* 15. How?
|
* 15. How?
|
||||||
|
|
||||||
- Operating System's *Scheduler*
|
Combination of:
|
||||||
- Hardware
|
- Operating System *Scheduler*
|
||||||
- /Interrupts/
|
- Hardware (/interrupts/)
|
||||||
|
|
||||||
* 17. Cooperative Scheduling
|
* 17. Cooperative Scheduling
|
||||||
[[file:images/cooperative-scheduling.jpg]]
|
[[file:images/cooperative-scheduling.jpg]]
|
||||||
@@ -131,7 +132,7 @@ Computers can "simultaneously" work on:
|
|||||||
|
|
||||||
* 21. Concurrency versus Parallelism
|
* 21. Concurrency versus Parallelism
|
||||||
|
|
||||||
- Parallelism :: performing computations at the same moment.
|
- Parallelism :: performing computations at the same time.
|
||||||
- Multiple cores.
|
- Multiple cores.
|
||||||
- Multiples computers.
|
- Multiples computers.
|
||||||
- Kind of like having multiple cooks in a kitchen.
|
- Kind of like having multiple cooks in a kitchen.
|
||||||
@@ -150,7 +151,7 @@ A little more nuance.
|
|||||||
- Process :: a program in execution.
|
- Process :: a program in execution.
|
||||||
- Start off with one thread.
|
- Start off with one thread.
|
||||||
- Can /fork/.
|
- Can /fork/.
|
||||||
- Inter-Process Communication
|
- Communicate via inter-process communication (IPC).
|
||||||
|
|
||||||
- Thread :: sequence of instructions that can be managed independently by scheduler.
|
- Thread :: sequence of instructions that can be managed independently by scheduler.
|
||||||
- Share resources ∴ less resource intensive.
|
- Share resources ∴ less resource intensive.
|
||||||
@@ -169,7 +170,7 @@ Press ~H~ to show threads.
|
|||||||
* 25. Languages and Runtimes
|
* 25. Languages and Runtimes
|
||||||
|
|
||||||
- ~C~, ~C++~, ~Rust~ allow for fine-grained control of processes and threads.
|
- ~C~, ~C++~, ~Rust~ allow for fine-grained control of processes and threads.
|
||||||
#+begin_src C
|
#+begin_src C :output raw
|
||||||
int main() {
|
int main() {
|
||||||
fork();
|
fork();
|
||||||
|
|
||||||
@@ -179,7 +180,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
* 26. nodejs
|
* 26. JavaScript
|
||||||
- Single-threaded (for application code).
|
- Single-threaded (for application code).
|
||||||
- Runtimes implement concurrency via an event loop.
|
- Runtimes implement concurrency via an event loop.
|
||||||
|
|
||||||
@@ -199,7 +200,8 @@ Source: https://freethreads.net/2019/01/23/go-runtime-scheduler-design-internals
|
|||||||
- Sequential versus Concurrent Steps
|
- Sequential versus Concurrent Steps
|
||||||
- Compare with recipes.
|
- Compare with recipes.
|
||||||
- Concurrency versus Parallelism
|
- Concurrency versus Parallelism
|
||||||
- Multiple cooks.
|
- Parallelism: multiple cooks, simultaneously /doing/.
|
||||||
|
- Concurrency: one or more cooks, simultaneously /dealing/ with many tasks.
|
||||||
- Operating System Scheduler
|
- Operating System Scheduler
|
||||||
- Processes and Threads
|
- Processes and Threads
|
||||||
- Languages and Runtimes
|
- Languages and Runtimes
|
||||||
|
|||||||
Reference in New Issue
Block a user