Chapter 3 Introduction to MR308
- 14 -
In the state shown in Figure 3.5, it appears to the programmer that the key input task or its microcomputer is
halted while another task assumes execution control.
Task execution restarts at the point of last interruption as the register contents prevailing at the time of the last
interruption are recovered. In other words, task switching refers to the action performed to save the currently
executed task register contents into the associated task management memory area and recover the register
contents for the task to switch to.
To establish the real-time OS, therefore, it is only necessary to manage the register for each task and change
the register contents upon each task switching so that it looks as if a number of microcomputers exist (See
Figure 3.6).
Remote control
Task
A
ctual
Register
R0
R1
PC
Real-time OS
RegisterRegister
Key input
Task
R0
R1
PC
R0
R1
PC
Figure 3.6 Task Switching
The example presented in Figure 3.7 7 indicates how the individual task registers are managed. In reality, it is
necessary to provide not only a register but also a stack area for each task.
7 It is figure where all the stack areas of the task were arranged in the same section.