mart week 2
[des2015.git] / mart / ex03 / explanations.txt
index f53474f..941a767 100644 (file)
@@ -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.