Method of task execution environment switch in multitask system

Information

  • Patent Application
  • 20070226747
  • Publication Number
    20070226747
  • Date Filed
    March 21, 2007
    17 years ago
  • Date Published
    September 27, 2007
    16 years ago
Abstract
A task execution environment switching method in a multitask system, which comprises the steps of: a first step for evacuating current task execution environment information in a stack-exclusive-use execution environment stack to a context evacuating region, as pre-processing for calling processing of a sub-function from a main function within the task; a second step for storing execution environment information of the sub-function in a execution environment stack for function of the task from an execution environment table of the task; a third step for calling the sub-function from the main function within the task; and a fourth step for storing the task execution environment information evacuated in the context evacuating region in the first step in a task of the task-exclusive-use execution environment stack, when processing is returned from the sub-function to the main function.
Description

BRIEF DESCRIPTION OF THE DRAWINGS

Other objects of the present invention will become clear from the following description of the preferred embodiments and the appended claims. Those skilled in the art will appreciate that there are many other advantages of the present invention by embodying the present invention.



FIG. 1 is a block diagram showing the structure of a multitask system in a first embodiment of the present invention;



FIG. 2 is a flowchart of the processing for calling a sub-function from a main function in the first embodiment of the present invention;



FIG. 3 is a flowchart of the sub-function call check processing in the first embodiment of the present invention;



FIG. 4 is an illustration showing how a stack region is used when a context evacuating region indicates the sub-function execution environment information in the first embodiment of the present invention;



FIG. 5 is a flowchart of the processing for providing the exclusive state when calling a sub-function from a main function in a second embodiment of the present invention; and



FIG. 6 is a flowchart illustrating an exclusive control of a common stack region according to a conventional technique.


Claims
  • 1. A task execution environment switching method in a multitask system, comprising the steps of: a first step for evacuating current task execution environment information of a task-exclusive-use execution environment stack to a context evacuating region, as pre-processing for calling processing of a sub-function from a main function within said task;a second step for storing execution environment information of said sub-function in a execution environment stack for function of said task from an execution environment table of said task;a third step for calling said sub-function from said main function within said task; anda fourth step for storing said task execution environment information evacuated to said context evacuating region in said first step in a task of said task-exclusive-use execution environment stack, when processing is returned from said sub-function to said main function.
  • 2. The task execution environment switching method according to claim 1, further comprising the steps of: just before said second step, a step for transferring said task execution information in said execution environment table to an exclusive state to be used exclusively from other tasks; andjust after said fourth step, a step for releasing said exclusive state.
  • 3. The task execution environment switching method according to claim 2, wherein: in said first step, it is judged whether or not a flag is set for indicating that another task provided in each task execution environment information in said execution environment table is in use and, said task is shifted to a standby state in said first step when it is judged that said flag is being set;when it is judged in said first step that said flag is not being set, said flag is set in said step for transferring to said exclusive state to transfer said task execution information in said execution environment table to said exclusive sate through setting said flag in said step for transferring to said exclusive state; andsaid exclusive state is released by clearing said flag in said step for releasing said exclusive state.
  • 4. The task execution environment switching method according to claim 2, wherein: said step for making the transition to said exclusive state is executed by changing a task to a task dispatch inhibited state; andsaid step for releasing said exclusive state is executed by changing a task to a task dispatch permitted state.
  • 5. The task execution environment switching method according to claim 2, wherein: said step for making the transition to said exclusive state is executed by changing a task to an interruption inhibited state; andsaid step for releasing said exclusive state is executed by changing a task to an interruption permitted state.
  • 6. The task execution environment switching method according to claim 1, wherein: said task execution environment is a stack register; andsaid task execution environment information is a stack region address used in said sub-function.
  • 7. The task execution environment switching method according to claim 1, wherein said context evacuating region indicates a stack region address.
Priority Claims (1)
Number Date Country Kind
2006-080330 Mar 2006 JP national