X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=mart%2Fex03%2Fexplanations.txt;h=941a767005a35d36d32924514c811dd2c055f4b8;hb=cb6632a064a7688274a0a89def28dbe5bcce5693;hp=f53474f8fd37ac531876d839cc89c7a4462fca52;hpb=6ef9df24af633025d2a8501f9ea50deedb95e1c9;p=des2015.git diff --git a/mart/ex03/explanations.txt b/mart/ex03/explanations.txt index f53474f..941a767 100644 --- a/mart/ex03/explanations.txt +++ b/mart/ex03/explanations.txt @@ -2,5 +2,14 @@ Since the first task is started first the main loop halts until it's finished. 3b. +This works because the semaphore queue is FIFO. So the first one locks the +semaphore to update the global variable, the second task also wants to do this +but he has to wait in the queue and will be the next in line. After the first +task releases the semaphore the second task locks it and the first task has to +line up in the queue again. This goes on, tasks taking turns, till the tasks +are finished. 3c. +rt_sem_v doesn't work because they are released and the first one will get the +lock. rt_sem_broadcast works because all tasks are released at the same time +and the priority is then the next measure of who goes first.