push
[des2015.git] / natanael / ex06 / ExplanationEx06.txt
1 ex06a
2 There are task 0, task 1, and task 2. Since we give the highest priority to task 2, then task 2 is started first until it finishes. After that, it continues to the lower priority, in this case: task 1. Task 0 has the lowest priority, that is why it runs at the end.
3
4 ex06b
5 The output is different with the output from ex06a. Since task 1 and task 2 have the same priority, task 1 is running first because it was first queued in the waiting queue of the scheduler. We can see from the looping that task 1 is created and started first rather than task 2. Finally, task 0 runs at the end as it has the lowest priority.
6
7 ex06c
8 On the half-way execution of the highest priority task (task 2), there are another two tasks (task 0 and task 1) which are set to have higher priority. So, these two tasks are run immediately. After task 0 and task 1 finish, it will automatically continue to finish the task 2.
9
10 ex06d
11 There are task 0, task 1, and task 2.
12 From the output, we can see that at the first time task 2 has the highest priority. On its half-way execution, task 2 is modified to be the lowest priority. So, task 2 is delayed. Then the execution will continue to the next highest priority, in this case: task 1.
13 On its half-way execution of task 1, there is another task that has higher priority, in this case: task 0. So, the execution will continue to run task 0.
14 In conclusion, execution of a low-priority task is interrupted when a high-priority task is ready to execute.