You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/concurrency-primitives.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -213,28 +213,28 @@ When multiple processes try to access a precious resource you might want to cons
213
213
214
214
Three processes are trying to access a shared resource at the same time but only one at a time will be granted access and the next process have to wait until the resource gets available again (availability is one as indicated by the semaphore counter).
215
215
216
-
R1, R2 & R3 will request access of the precious resource concurrently so this could be one possible outcome:
216
+
P1, P2 & P3 will request access of the precious resource concurrently so this could be one possible outcome:
217
217
218
218
```
219
-
R1 >> Availability: 1
220
-
R2 >> Availability: 1
221
-
R2 >> Started | Availability: 0
222
-
R3 >> Availability: 0
219
+
P1 >> Availability: 1
220
+
P2 >> Availability: 1
221
+
P2 >> Started | Availability: 0
222
+
P3 >> Availability: 0
223
223
--------------------------------
224
-
R1 >> Started | Availability: 0
225
-
R2 >> Done | Availability: 0
224
+
P1 >> Started | Availability: 0
225
+
P2 >> Done | Availability: 0
226
226
--------------------------------
227
-
R3 >> Started | Availability: 0
228
-
R1 >> Done | Availability: 0
227
+
P3 >> Started | Availability: 0
228
+
P1 >> Done | Availability: 0
229
229
--------------------------------
230
-
R3 >> Done | Availability: 1
230
+
P3 >> Done | Availability: 1
231
231
```
232
232
233
-
This means when R1 and R2 requested the availability it was one and R2 was faster in getting access to the resource so it started processing. R3 was the slowest and saw that there was no availability from the beginning.
233
+
This means when P1 and P2 requested the availability it was one and P2 was faster in getting access to the resource so it started processing. P3 was the slowest and saw that there was no availability from the beginning.
234
234
235
-
Once R2 was done R1 started processing immediately showing no availability.
236
-
Once R1 was done R3 started processing immediately showing no availability.
237
-
Finally, R3 was done showing an availability of one once again.
235
+
Once P2 was done P1 started processing immediately showing no availability.
236
+
Once P1 was done P3 started processing immediately showing no availability.
237
+
Finally, P3 was done showing an availability of one once again.
0 commit comments