You are on page 1of 3

ANSWER THE FOLLOWING QUESTIONS: a) b) c) d) e) f) Illustrate the process of Waterfall software development life cycle (SDLC).

Illustrate the embedded system lifecycles. Illustrate the UML activity diagram of an ATM machine. Explain the meaning of A. Mutual Exclusion B. Reentrant Draw the diagram of the 5 Task states. Understand the following coding. Let say both of the task run simultaneously, the result is neither HOLLA nor GOOOD. Give two ways to solve this problem and edit the given code. for(;;) { printf(GOOOD); }

for(;;) { printf(HOLLA); }

g) Given the value of the byte OSRdygrp of as 01011010 and OSReadytbl[y] as 10110010, find the highest priority of the ready tasks. Use the table.

X- Axis 0 1 2 3 4 5 6 7 7 15 23 31 39 47 55 63 7 6 14 22 30 38 46 54 62 6 5 13 21 29 37 45 53 61 5 4 12 20 28 36 44 52 60 4 3 11 19 27 35 43 51 59 3 2 10 18 26 34 42 50 58 2 1 9 17 25 33 41 49 57 1 0 8 16 24 32 40 48 56 0

Y- Axis

Column

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

0 4 5 4 6 4 5 4 7 4 5 4 6 4 5 4 0

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7

3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 8

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 12

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15

Row

h) Study the following ready table. i) How many active tasks? ii)What is the OSRdygrp of the ready table? iii)What is the priority of the second highest task? 0 1 2 3 4 5 6 7 0 0 1 0 1 0 0 0 7 0 1 0 0 0 0 1 0 6 0 0 0 0 0 0 0 0 5 0 0 1 0 0 0 0 0 4 0 0 1 0 1 0 1 0 3 0 1 0 0 0 1 0 0 2 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0

i)

Study the following coding. And answer the following question.

Task_Start { OSTaskCreate(Task21, (void *)NULL, (void *)&TaskStk[0][TASK_STK_SIZE - 1], 11); OSTaskCreate(Task22, (void *)NULL, (void *)&TaskStk[0][TASK_STK_SIZE - 1], 21); OSTaskCreate(Task33, (void *)NULL, (void *)&TaskStk[0][TASK_STK_SIZE - 1], 31); Create_Sem(sem); Post_sem(sem); for(;;); } Task21() { for(;;){ if(tick>=3) { pend_sem(sem); for (int n=1;n<5;n++) printf(%d,n); post_sem(sem); OSTaskSuspend(11); }}} }}} }}} Task22() { for(;;){ if(tick>=5) { for (int n=1;n<4;n++) printf(%d,n); OSTaskSuspend(21); Task33() { for(;;){ if(tick>=0) { pend_sem(sem); for (int n=1;n<6;n++) printf(%d,n); post_sem(sem); OSTaskSuspend(31);

A. B.

Draw the time diagram of the source code. The result has a problem. What cause the problem? Fix it on the code and draw the new time diagram

C.

What is the time inversion time different between the original and the repaired code?

You might also like