-
Notifications
You must be signed in to change notification settings - Fork 19
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
Introduction to Threading submission #57
base: main
Are you sure you want to change the base?
Conversation
I have one suggestion: Please review the first code example provided in the PR file. I have attached a screenshot of my CLI showing the output, and I have also written the output in the shell. You can choose whichever approach you prefer, and we can proceed with that, deleting the alternative entry. |
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.
Hi @dakshdeepHERE! :) I gave some feedback on your article. Looks pretty good so far! :) (Note: I'm not a maintainer. Just a friendly contributor who wanted to help you. 😄).
Co-authored-by: Christine Belzie <[email protected]>
Co-authored-by: Christine Belzie <[email protected]>
Co-authored-by: Christine Belzie <[email protected]>
Hey @CBID2 I never knew we were allowed to review others code and suggest changes. This is a good practice imo to help maintainers. Maybe I would do some code reviews too if they are from my tech stack from next time. |
Oh of course we can @dakshdeepHERE! It's a common practice in open source! :) I wrote a FreecodeCamp article on how to review people's code. Check it out! 😊 |
@CBID2 yes I do that in other repo owned by my friend but I thought it's against the TOS here. |
I don't think it is @dakshdeepHERE. |
Co-authored-by: Christine Belzie <[email protected]>
Co-authored-by: Christine Belzie <[email protected]>
Co-authored-by: Christine Belzie <[email protected]>
Hey @yangc95 I have few more optional codes that I wanted to add but I didn't as the article already is above 300 lines. If you want I can add them. But I think the code samples of creating threads for the functions and message between threads are enough for basic understanding of threads. |
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.
@dakshdeepHERE Thanks for your patience!
I conducted a review and left comments. Please let me know if you need anything clarified! In addition. The comments are a bit open-ended due to the nature of a tutorial article which you'll notice.
Let me know once you've addressed any requested changes 🙂
- "learn-python" | ||
- "paths/threading" | ||
--- | ||
|
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.
Could we place links here, it should look like:
...more links
(space here between links and images)
[image1]: image link
Then in the content, you'd just mention the link like [this]
A `thread` is a path of execution within a process, which can contain multiple threads. It is also known as a lightweight process. The goal of threading is to achieve parallelism by dividing a process | ||
into multiple threads. For example, in a browser, multiple tabs can be different threads. MS Word uses multiple threads: one to format the text and another to process inputs, etc. |
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 `thread` is a path of execution within a process, which can contain multiple threads. It is also known as a lightweight process. The goal of threading is to achieve parallelism by dividing a process | |
into multiple threads. For example, in a browser, multiple tabs can be different threads. MS Word uses multiple threads: one to format the text and another to process inputs, etc. | |
A `thread` is a path of execution within a process, which can contain multiple threads. It is also known as a lightweight process. The goal of threading is to achieve parallelism by dividing a process into multiple threads. For example, in a browser, multiple tabs can be different threads. MS Word uses multiple threads; one thread may format the text while another another processes inputs. |
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.
Elegant definition! Could we also include a short definition on processes here? Also, what about concurrency v parallelism
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.
Also, make sure to place focus on what this tutorial will accomplish in the intro
|
||
## Process vs Thread | ||
|
||
| S.N. | Process | Thread | |
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.
Can we swap out S.N for something more meaningful or remove it
|
||
**`Thread`** is an execution unit that consists of its own program `counter`, a `stack`, and a set of `registers`. `Program counter` keeps track of which instruction to execute next, the system registers which hold its current working variables, and a stack that contains the execution history. | ||
|
||
**A thread comprises of:** |
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.
Would work well as a numbered list
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.
It'd also be good to have a short explanation on what each is
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.
Would work well as a numbered list
Haha I'm so used to this listing that I've literally stopped using the numbered list
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.
It'd also be good to have a short explanation on what each is
Got it
|
||
## Multithreading | ||
|
||
- A `thread` is a path which is followed during a program’s execution. |
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 would be good for Docs formatting. As this is an article, can we use paragraph format unless we're creating some itemized list or specifically listing out parts of some kind
- `Data dependency` – sometimes the data required by one thread (T1) might be produced by another (T2). Thus, T1 can not run before T2. Therefore, it becomes difficult for programmers to code. | ||
- `Testing and debugging` – Multiple threads running in parallel on multiple cores poses another challenge in the testing of applications. | ||
|
||
## Syntax |
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.
## Syntax | |
## Creating a thread |
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.
Let's turn the content below into a step-by-step tutorial and slowly add in code w/ explanations
|
||
Remember to link your program with the `pthread` library by adding `-pthread` to the compiler command during the compilation process. | ||
|
||
## Examples |
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.
Use meaningful headings which explain the step the learner is going to go into next
Co-authored-by: Christine Yang <[email protected]>
Co-authored-by: Christine Yang <[email protected]>
Co-authored-by: Christine Yang <[email protected]>
@yangc95 Thank you for the amazing review I will get started with the changes. I'm totally blown away by the range of your knowledge in computer science after reading your comments in this entry. Devs like you always motivate me. Thanks for the correction. |
@dakshdeepHERE Hiya! Just pinging you on this as a light reminder 🙂 hope your studies are going along! |
Description
This article have detailed information about what exactly threads are. What are the difference between threads and process. How to implement threads using C and Pthread lib.
Type of Change
Checklist
main
branch.Fixes #31