vault backup: 2023-10-18 11:49:55

This commit is contained in:
Alice 2023-10-18 11:49:55 +01:00
parent 398d6cc484
commit c48541254d
3 changed files with 18 additions and 3 deletions

View file

@ -94,7 +94,8 @@
}
],
"direction": "horizontal",
"width": 328.5
"width": 328.5,
"collapsed": true
},
"right": {
"id": "d8cc89662b1baf06",
@ -185,6 +186,7 @@
},
"active": "cca189cd61cd7fe5",
"lastOpenFiles": [
"Pasted image 20231018114101.png",
"Pasted image 20231018113933.png",
"4a1s/CP/PL - Aula 5.md",
"4a1s/CP/PL - Aula 6.md",

View file

@ -2,5 +2,18 @@
## Ex 1
### a)
Running the codee:
![[Pasted image 20231018113933.png]]
Running the code (first time):
![[Pasted image 20231018113933.png]]
Running the code (second time):
![[Pasted image 20231018114101.png]]
No, since the task scheduling is dependant on the resources available (cpu cores).
### b)
Yes, since the threads do the same task (orderly printing ids) following the orderly creation of threads in the for loop.
NOTE: These threads use a fork-join architecture, aka both threads work simultaneously and when one ends, it waits for the other to finish their job to then end both threads and continuing on with the code.
### c)
It is dependant on the CPU availability in each clock cycle. A thread, when executed uses

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB