|
1 | 1 | # Parallelism vs Concurrency
|
2 | 2 |
|
3 | | -Parallelism means running two operations at the same time. For example, your program got two threads to run and your machine |
| 3 | +Parallelism means running multiple operations at the same time. For example, your program got two threads to run and your machine |
4 | 4 | has two core. So you can run those threads in parallel.
|
5 | 5 |
|
6 | | -A Parallel programming doesn't mean to be concurrent. Concurrency means running chunks of a program as individual |
7 | | -executing tasks and producing right result. |
| 6 | +A Parallel program doesn't mean to be concurrent. A program that needs to be run sequentially is hard to make parallelize. |
| 7 | +Concurrency is all about breaking the code into sub program that can potentially run at the same time and at the end produce same |
| 8 | +result as if it would run as single unit. So, we cannot parallelise a concurrent program. |
8 | 9 |
|
9 | 10 | ## Synchronous program example
|
10 | 11 |
|
@@ -46,5 +47,5 @@ func printStr(str string) {
|
46 | 47 |
|
47 | 48 | ```
|
48 | 49 |
|
49 | | - |
| 50 | +In this concurrent program, there's 2 go routine, 1 main and another one that is declared. |
50 | 51 |
|
0 commit comments