-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parallelism Revisions #43
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I like this new outline, though it needs some cleaning up in a lot of places.
I'm interested in what @jurplel thinks about this at a high level since this is mostly his lecture.
Regardless, since this lecture is far away I'm going to put this on hold and say we should focus on cleaning up the earlier lectures.
## Concurrency | ||
|
||
**Problem** of handling many tasks at once | ||
|
||
|
||
## Parallelism | ||
|
||
- Work on multiple tasks at the same time | ||
- Utilizes multiple processors/cores | ||
**Solution** of working on multiple tasks at the same time | ||
|
||
</div> | ||
<div> | ||
* **Key difference:** Parallelism utilizes **multiple** workers | ||
|
||
## Concurrency | ||
--- | ||
|
||
- Manage multiple tasks, but only do one thing at a time. | ||
- Better utilizes a single processor/core | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think something went wrong with the html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Screenshot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, need closing </div>
s
* 1 core, 1 thread | ||
* When blocked on loading the webpage, update the progress bar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of our students will not really understand what "blocked on loading the webpage" means. Do you think you could come up with another example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was @jurplel’s example, reworded
His slide originally had two examples (loading webpage, image processing)
How about the second example?
One thread switches between each image region
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- As we load a webpage, take a break sometimes to update the loading progress bar
I think it is important to spell out what exactly "blocked" means here, at least the first time we bring it up
|
||
# Today | ||
- Multithreading | ||
- Interthread Communication |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inter-thread
* Divide image into eight regions | ||
|
||
* One region per thread | ||
|
||
* Easy! "Embarassingly parallel" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No newlines
Also, I think this should be explained a bit more in depth, what does "one region per thread" actually mean? We mean each thread is responsible for painting just that region and nothing else.
Say our image is more complex. | ||
|
||
* We're painting circles | ||
* Circles overlap | ||
* The _order_ we paint circles affects their color |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good example!
Maybe instead "What if our image is more complex..."
```c | ||
static int x = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment saying this is C
Of course, my focus is still on the earlier ownership lectures. Sharing this early so we have it on our radar! |
| Thread 1 | Thread 2 | | ||
|---------------|---------------| | ||
| **temp = x** | | | ||
| **temp += 1** | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errata: atomic sequence should include x = temp
Will fix
marp --preview week10/slides.md
High-level: The canonical way that message passing is explained is in the context of inter-process / inter-thread communication, so I reorged around that narrative
Also expanded the first half to step through our examples