Skip to content
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

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

Parallelism Revisions #43

wants to merge 12 commits into from

Conversation

jespiron
Copy link
Contributor

@jespiron jespiron commented Jan 10, 2025

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
mark-671

Also expanded the first half to step through our examples

Copy link
Member

@connortsui20 connortsui20 left a 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.

Comment on lines +26 to 39
## 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

Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot?

Copy link
Contributor Author

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

Comment on lines +92 to +93
* 1 core, 1 thread
* When blocked on loading the webpage, update the progress bar
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inter-thread

Comment on lines +135 to +139
* Divide image into eight regions

* One region per thread

* Easy! "Embarassingly parallel"
Copy link
Member

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.

Comment on lines +156 to +160
Say our image is more complex.

* We're painting circles
* Circles overlap
* The _order_ we paint circles affects their color
Copy link
Member

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..."

Comment on lines +205 to +206
```c
static int x = 0;
Copy link
Member

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

@jespiron
Copy link
Contributor Author

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** | |
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants