49
APPENDIX B Running the Sample System
Figure Bo Priority Inversion
Since the serial driver in sample 2 is implemented based on polling, is does not cause priority
inversion. During the serial device transmission wait time, however, only loop processing is
executed, preventing any other task from being executed. The transmission rate of the serial
interface has been set to 9600 pbs, wasting about 1 ms as the character output interval when
characters are output continuously. Since the sample programs require set_flg and cwa_flg
processing time of about 62
µ
s in total, allowing for task switching for processing.
The sample programs handle only two processing tasks, a_tsk and b_tsk. The programs are
meaningless if the tasks result in mixed output. That is why the serial driver based on polling is
acceptable in the same program. If any other processing task is executed, however, the serial
driver based on polling cannot use remaining time efficiently. (If the driver processing speed is
so fast that task switching takes longer for processing. the driver must be based on polling.)
To practice programming, use sample 1 to write a program which uses a system call with tasks
and handlers. Also, try writing a program which does not cause priority inversion without
changing the serial driver. Note that there are more than one solution. If your program is a
solution, the character string output by each task will appear continuous as shown in figure Bp or
Bq.
Execution state
Event flag
Priority 4
set_flg
When only one of the two tasks waiting for the same object is released from the wait state,
b_tsk
a_tsk
Priority 5
WAIT
WAIT
Priority 4
a_tsk
WAIT
b_tsk
Priority 5
WAIT
wait state
the FCFS causes the task with a lower priority to enter the execution state.
*
Содержание F2MC-16L Series
Страница 2: ... ...
Страница 4: ... ...
Страница 10: ...vi ...
Страница 12: ...viii ...
Страница 44: ...32 CHAPTER 4 Program Reference for the Standard I O Library ...
Страница 53: ...41 APPENDIX B Running the Sample System Figure Be Project Member List ...
Страница 54: ...42 APPENDIX Figure Bf Set Configuration File Dialog Box ...
Страница 64: ...52 APPENDIX Figure Cb Sample System Memory Map Continued ...
Страница 65: ...53 INDEX INDEX The index follows on the next page This is listed in alphabetic order ...
Страница 68: ... ...