Multi-task execution control system4847751Abstract In a microcomputer system, having independently programmed tasks and a master control processing unit (CPU), tasks can be switched independent of the master CPU through the use of a multi-task support processor which may, for example, be connected to the microcomputer system via an input/output (I/O) port. The multi-task support processor includes a memory for storing task control programs, a data memory and task control memory, a timer, a controller for controlling multi-task operations, and a master CPU interface element. Tasks including task control commands are stored in a memory for execution by the master CPU. The master CPU, upon encountering a task control command, sends that command to the multi-task support processor which becomes activated to control the switching and communications between the tasks under the direction of the received task control command, so that tasking control may be performed independent of the master CPU. Claims What is claimed is: Description BACKGROUND OF THE INVENTION
______________________________________
Items Specifications
______________________________________
Tasks to be
8 max.Task numbers 1 through 8
registered:
Priority 8 max. Priority: l through 8
level:
Mail box: 8 max. Mail box numbers 1 through 8
Clock unit:
10 microseconds
Scheduling:
Either by the precedence or by the
time-sharing. Switches tasks by applying
an interruption from the MTSP element 1.
Number of 14 commands
commands:
Task regist-
When the system is activated, task infor-
ration: mation is registered into the MTSP element 1.
Memory When the system is activated, the initial
control: and last RAM addresses available for users
are registered into the MTSP element 1.
Control of the MTSP element 1:
Any desired address can be chosen from
addresses 0 through FFFFH at 100H intervals.
Clock: Clock sets hour, minute, and second, which
can be read as required.
______________________________________
FIG. 3 shows the flowchart describing the execution of the multi-task control performed by the MTSP element 1. In reference to this flowchart, details of the multi-task control operation are described below. When the system is activated by turning the power on, the master CPU 2 sends the initialization start command which is to be delivered to the MTSP element 1 (step n1). When the master CPU 2 outputs the initialization start command, the MTSP element 1 accepts the system configuration information from the master CPU 2 (step n2). On receipt of this information, the MTSP element 1 then registers an information needed for switching tasks into respective task control blocks (step n3). This allows those tasks to enter the executable status so that they can order themselves according to precedence. To initialize the memory control, the MTSP element 1 first sets the available RAM area to be used for the system (step n4). Next, the mail box available for synchronization and communication between tasks is generated (step n5). The MTSP element 1 then sets the time in the built-in timer before the timer is activated (step n6). Finally, the MTSP element 1 accepts the command for activating the desginated tasks (step n7). The initialization command, the system configuration information, and the task activation command, are previously stored in the initialization program of the program memory shown in FIG. 1. The initialization program can be replaced according to the contents of the designated tasks. The MTSP element 1 thus sets a variety of initial data. As soon as the master CPU 2 sends out the task activation command which is the last output from the intialization program (step n7), the task having top precedence is ready to be executed (step n8). In other words, the MTSP element 1 selects the top precedence task from all the executable tasks, and then loads the stack pointer value of the registered task into the bus register for output to the CPU. After the stack pointer value has been loaded, the MTSP element 1 generates an interrruption request signal which is sent to the master CPU 2, which then executes the interruption routines. As a result, the stack pointer value set in the MTSP element 1 is loaded into the stack pointer of the CPU 2, which then causes the initial value pre-set in the register to be popped out of the stack before rewriting the register. Finally, the designated task is executed under the control of the master CPU 2. As soon as the task execution begins, the MTSP element 1 will enter the standby state (step n9) until it receives the activated command from the designated task or until the built-in timer counts up. On receipt of the activated command (step n10), the MTSP element 1 analyzes the command (step n11) and then executes the command (step n12). There are a variety of the input commands, the details of which are described below.
______________________________________
Names Functions
______________________________________
TSPD Stops the task execution to eliminate the
task from the control of the MTSP element 1.
TRSM Activates the task execution from either the
standby or stop mode.
TPRI Changes the priority of the tasks to be
executed.
TSLI Designates the time-sharing process.
TIMR Designates the timer operation for setting
the time-out time or for keeping the timer
to stand by for a specific period of time.
CSET Sets the clock.
CGET Reads the clock.
MALC Monopolizes memory.
MREL Releases memory.
POST Transmits messages.
PEND Receives messages. Keeps standby until
receiving any message.
______________________________________
A specific command that discontinues (by activating either the standby or stop mode) the execution of a task during the command execution (step n12) switches the tasks to be executed. For example, when the command TSPD is output from the task program being executed, step n13 is executed so that the execution of the designated task can be discontinued. This brings the MTSP operation back to step n8 where an interruption is activated to allow the executable task having top precedence to be executed. When step n12 is entered, the task that sent out the command will release itself from the executable state, and then the task will be free from the control of the MTSP element 1. The command TRSM output from the designated task permits the task to resume the executable state. The command POST that permits the task execution to run can discontinue (step n18) the task execution by applying an interruption to the master CPU 2 only when the executable task in the next turn has higher precedence than the task being executed (step n17), and as a result, the MTSP element 1 can switch to the next executable task (step n8). In other words, if a task, having higher precedence that the task that sent out the command POST, is in the standby mode activated by the command PEND, the MTSP element 1 will switch the command POST-activated task with the standby task for execution. When the built-in timer 13 counts up (step n14), the MTSP element 1 causes the clock to also count up (step n15). When the MTSP element 1 executes the command and the designated time has elapsed (step n16), the MTSP element 1 activates an interruption into the master CPU 2 so that task execution can be discontinued (step n18) and the next executable task having the same precedence assigned by time-sharing will be eventually executed (step n8). The time-sharing process is designated by the entry of the command TSLI. Process requirements, for example, the registration of the time-sharing task (procedure) and the designated time-sharing time can be simultaneously executed after receiving the command TSLI. During the time-sharing operation, if the designated time has not yet elapsed, the task under execution can check to see if any of other executable tasks has higher precedence (step n17). Therefore, if a task is standing by to receive a message in response to any command activated, for example, the command PEND, the MTSP element 1 will switch the task under execution to the one standing by so that it can receive the needed data (steps n18 and n8). Conversely, if there is no task having higher precedence, the MTSP element 1 will wait for commands and timer count-up (step n9). As described above, the preferred embodiment of the present invention has made it possible to switch tasks as required independent of the master CPU 2. Since no restraint is applied to the memory space and all switching operations can be executed without depending on the CPU architecture, the preferred embodiment can be applied to all kinds of CPUs in microcomputer systems. In addition, if the MTSP element 1 is made available independently, multiple tasks can be easily controlled by merely connecting the MTSP to any CPU microcomputer in the same way that other peripheral devices are connected.
|
Same subclass Same class Consider this |
||||||||||
