Fujitsu F2MC-16L User Manual page 61

Hide thumbs Also See for F2MC-16L:
Table of Contents

Advertisement

Execution state
b_tsk
Event flag
wait state
Priority 5
WAIT
When only one of the two tasks waiting for the same object is released from the wait state,
the FCFS causes the task with a lower priority to enter the execution state.
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.
a_tsk
Priority 4
WAIT
Figure Bo
Priority Inversion
*
APPENDIX B Running the Sample System
b_tsk
Priority 5
WAIT
set_flg
a_tsk
Priority 4
WAIT
49

Advertisement

Table of Contents
loading

This manual is also suitable for:

F2mc-16xlF2mc-16F2mc-16hF2mc-16f

Table of Contents