Download - Spansion
Transcript
CHAPTER 3 μT-REALOS FUNCTIONS 3.3 Task Synchronization Functions This section explains the task synchronization functions. ■ Task Synchronization Functions The task synchronization functions are functions for performing synchronization by directly operating task portions. Table 3.3-1 shows task synchronization functions and their corresponding systems calls. Table 3.3-1 Task Synchronization Functions and Corresponding System Calls Function System Call Name Sleep task tk_slp_tsk Wakeup task tk_wup_tsk Cancel Wakeup Task tk_can_wup Release Wait tk_rel_wai Suspend Task tk_sus_tsk tk_rsm_tsk Resume wait task tk_frsm_tsk (Force Resume Task) Delay task tk_dly_tsk Wakeup requests for a task are queued. That is, when an attempt is made to wake up a task that is not in the sleep state, the attempt is remembered. After that, when the task is to go to a sleep state, it does not enter that state. To realize this, the kernel maintains the number of wakeup requests that have been queued for each task. This is called the "wakeup request queuing count". When the task is started, this count is cleared to 0. Futhermore, suspend requests for a task are nested. That is, if a task that is already in the SUSPENDED state (including WAITING-SUSPENDED state) is placed again in the SUSPENDED state, the attempt hereof is remembered. After that, when an attempt is made to resume the task in SUSPENDED state (including WAITING-SUSPENDED state), it is not resumed. To realize this, the kernel maintains the number of requests of SUSPENDED state nested for each task. This is called the "suspend request nesting count". When the task is started, this count is cleared to 0. 30