Abstract:
A task management method includes determining, when a task other than an operating system task operated cooperatively with a process executed under a control of an operating system requests a cooperative operation to the operating system task and is set in a wait state, whether a priority of the task is higher than a priority of other task set in a wait state by requesting a cooperative operation to the operating system task, and making, when the priority of the task is determined to be higher than the priority of the other task, the operating system task and a process under control of the operating system operated cooperatively with the task succeed the priority of the task.

Description:
BACKGROUND OF THE INVENTION  
       [0001]     1) Field of the Invention  
         [0002]     The present invention relates to a technology for managing tasks on a computer having a dual operating system by setting an appropriate priority for each of the tasks.  
         [0003]     2) Description of the Related Art  
         [0004]     Recently, a hybrid operating system (OS) in which two OS&#39;s are running on a single computer became popular. Since some OS is excellent in real-time processing while other is superior in development environment, it is possible to make use of different merits by employing a plurality of OS&#39;s.  
         [0005]     As an example of the hybrid OS is shown in  FIG. 6 . In this system, a general purpose OS (GPOS) is placed on a real time OS (RTOS) and the GPOS is executed as one task of the RTOS. In other words, the GPOS and processes executed under the control of the GPOS are executed as a GP task. One example of such GPOS is Linux.  
         [0006]     In such type of hybrid OS, since the GPOS and a process under the control of the GPOS do not strongly require real-time properties, the GP task is executed with the lowest priority, and other RT tasks are executed by priority (see, for example, “Real Time OS or Linux?”, [Search on Aug. 8, 2003], &lt;URL: http://www.qnx.co.jp/resource/QNX-Linux.pdf&gt;).  
         [0007]     However, in an in-vehicle navigation system, for example, when a route searching task serving as an RT task is executed with a higher priority than a user interface process under the control of a GPOS, a user operation may not be recognized. Therefore, it is not always preferable that the GP task is executed with the lowest priority (see, for example, Japanese Patent Application Laid-Open Publication No. 2000-242512).  
         [0008]     Besides, in the hybrid OS, a process under the control of a GPOS and another RT task may have to be cooperatively operated. For example, in a streaming play of music through the Internet, it is necessary to receive music data from the Internet by a process under the control of the GPOS, and to transmit the music data received to a music reproducing RT task.  
         [0009]     In such a case, when the GP task has a low priority, the GP task and a real-time task having a high priority cannot be cooperatively operated. Thus, as in a case in which the two tasks communicate with each other under a single OS, the GP task may succeed the high priority from the RT task.  
         [0010]     However, when the GP task simply successes the high priority of the RT task, other processes except for the process cooperatively operated with the RT task are also executed with a high priority, and as a result, the execution of the RT task is interfered.  
       SUMMARY OF THE INVENTION  
       [0011]     It is an object of the present invention to solve at least the problems in the conventional technology.  
         [0012]     The computer program according to one aspect of the present invention makes a computer execute determining, when a task other than an operating system task operated cooperatively with a process executed under a control of an operating system requests a cooperative operation to the operating system task and is set in a wait state, whether a priority of the task is higher than a priority of other task set in a wait state by requesting a cooperative operation to the operating system task; and making, when the priority of the task is determined to be higher than the priority of the other task, the operating system task and a process under control of the operating system operated cooperatively with the task succeed the priority of the task.  
         [0013]     The task management apparatus according to another aspect of the present invention includes a priority determining unit that determines, when a task other than an operating system task operated cooperatively with a process executed under a control of an operating system requests a cooperative operation to the operating system task and is set in a wait state, whether a priority of the task is higher than a priority of other task set in a wait state by requesting a cooperative operation to the operating system task; and a priority succession unit that makes, when the priority of the task is determined to be higher than the priority of the other task, the operating system task and a process under control of the operating system operated cooperatively with the task succeed the priority of the task.  
         [0014]     The task management method according to still another aspect of the present invention includes determining, when a task other than an operating system task operated cooperatively with a process executed under a control of an operating system requests a cooperative operation to the operating system task and is set in a wait state, whether a priority of the task is higher than a priority of other task set in a wait state by requesting a cooperative operation to the operating system task; and making, when the priority of the task is determined to be higher than the priority of the other task, the operating system task and a process under control of the operating system operated cooperatively with the task succeed the priority of the task.  
         [0015]     The computer readable recording medium according to still another aspect of the present invention stores the computer program according to the above aspect.  
         [0016]     The other objects, features, and advantages of the present invention are specifically set forth in or will become apparent from the following detailed description of the invention when read in conjunction with the accompanying drawings. 
     
    
     BRIEF DESCRIPTION OF THE DRAWINGS  
       [0017]      FIG. 1  is a block diagram of a hybrid OS according to an embodiment of the present invention;  
         [0018]      FIG. 2  is a schematic for explaining a data structure used by an RTOS according to the embodiment in priority succession to a process controlled by a GPOS;  
         [0019]      FIG. 3  is a flowchart of a process procedure of the RTOS when a communication request is transmitted from an RT task to a GP task to set the RT task in a wait state;  
         [0020]      FIG. 4  is a flowchart of a process procedure of the RTOS when execution of an inter-OS communication wait RT task is resumed with end of an inter-OS communication of the GP task;  
         [0021]      FIG. 5  is a block diagram of a computer that executes the hybrid OS according to the embodiment; and  
         [0022]      FIG. 6  is a block diagram of a hybrid OS. 
     
    
     DETAILED DESCRIPTION  
       [0023]     Exemplary embodiments of a method of and an apparatus for managing task, and a computer product according to the present invention are described in detail below with reference to the accompanying drawings.  
         [0024]      FIG. 1  is a block diagram of a hybrid OS according to an embodiment of the present invention. This hybrid OS includes a RTOS  100 , and a GPOS  200 .  
         [0025]     The RTOS  100  is an OS that executes the GPOS  200  and a process executed under the GPOS  200  as one of real time tasks (hereinafter, “RT tasks”), and has an inter-OS communication mechanism  110 , a priority succession management list  120 , a TCB queue  130 , a priority succession management list head  140 , and a scheduler  150 . The GPOS  200  is executed as a general-purpose OS task (hereinafter, “GP task”)  300  under the control of the RTOS  100  together with processes controlled by the GPOS  200 .  
         [0026]     The inter-OS communication mechanism  110  is an object that provides a communication function between the RTOS  100  and the GPOS  200 , and is constituted by a data structure such as a first-in-first-out (FIFO) or a message box and a method.  
         [0027]     The inter-OS communication mechanisms  110  are generated for combinations of RT tasks to be communicated and processes. Data structures such as FIFOs and message boxes are generated depending on communication schemes. The combination of the RT task to be communicated and the process may include a plurality of tasks and a plurality of processes.  
         [0028]     Each of the inter-OS communication mechanisms  110  has a TCB queue head  111  and a PCB queue head  112 . The TCB queue head  111  is a pointer that indicates the head of the TCB queue  130 , and the PCB queue head  112  is a point that indicates the head of the PCB queue  210 . The details of the TCB queue  130  and the PCB queue  210  will be described later.  
         [0029]     The priority succession management list  120  is a list in which task control blocks (TCBs) set in a wait state when inter-OS communication is requested are connected in a preferential order.  
         [0030]     The TCB queue  130  is a queue that connects the TCBs of all the RT tasks set in a wait state when inter-OS communication is requested to the inter-OS communication mechanisms  110 . As described above, the head of the TCB queue  130  is indicated by the TCB queue head  111  of the inter-OS communication mechanism  110 .  
         [0031]     The priority succession management list head  140  is a point that indicates the head of the priority succession management list  120 . More specifically, the priority succession management list head  140  indicates the TCB of the RT task having the highest priority in the RT tasks set in a wait state when inter-OS communication is requested.  
         [0032]     The scheduler  150  is a processing unit that manages execution of the RT tasks on the basis of the priorities stored in the TCBs of the RT tasks. When the RT task communicates with a process controlled by the GPOS  200 , the scheduler  150  causes only a process communicating with the RT task to succeed the priority of the RT task.  
         [0033]     More specifically, when a communication request is transmitted from the RT task to the GP task  300  to set the RT task in a wait state, and when the RT task is connected to the head of the priority succession management list  120 , i.e., when the RT task has the highest priority in RT tasks set in a wait state when inter-OS communication is requested the scheduler  150 , the priority is succeeded by a GP task  300 . The scheduler  150  causes a process communicating with the RT task set in a wait state to succeed the priority.  
         [0034]     When the execution of the wait task is resumed by ending the inter-OS communication between the RT task and the GP task  300 , and when the priority succession management list  120  is not empty, i.e., when there is an RT task set in a wait state by requesting inter-OS communication, the scheduler  150  causes a process communicating with the RT task and the GP task  300  to succeed the priority of the highest-priority RT task of the RT tasks set in a wait state. When the priority succession management list  120  is empty, i.e., when there are no other RT tasks set in a wait state by requesting inter-OS communication, the priority of the GP task  300  is returned to the original low priority.  
         [0035]     In this manner, the scheduler  150  causes only the process communicating with the RT task to succeed the priority of the RT task and does not cause other processes under the control of the GPOS  200  to succeed the priority of the RT task. Thus, the processes other than the process communicating with the RT task can be prevented from being executed at a high priority.  
         [0036]     The GPOS  200  parallel processes a plurality of processes as an OS, and is constituted as a lowest-priority RT task executed under the control of the RTOS  100 . There is an idle process controlled by the GPOS  200 . The idle process is always set in an excusable state.  
         [0037]     The GPOS  200  has a PCB (Process Control Block) queue  210  and a GPOS scheduler  220 . The PCB queue  210  is a queue that connects a PCB of a process communicating with another RT task by using the inter-OS communication mechanism  110  in each of the inter-OS communication mechanisms  110 . As described above, the head of the PCB queue  210  is indicated by the PCB queue head  112  of the inter-OS communication mechanism  110 .  
         [0038]     The scheduler  150  of the RTOS  100  accesses the PCB queue  210  through the inter-OS communication mechanism  110 , or the scheduler  150  gives designation to the GPOS scheduler  220  to make it possible to specify a process communicating with the RT task, i.e., a process that is caused to succeed the priority of the RT task.  
         [0039]     The GPOS scheduler  220  is a processing unit that manages execution of a process executed under the control of the GPOS  200  on the basis of the priority in the PCB. The GPOS scheduler  220  changes the priority of the process communicating with the RT task according to the designation from the scheduler  150 .  
         [0040]      FIG. 2  is a schematic for explaining a data structure used by an RTOS  100  according to the embodiment in priority succession to a process controlled by a GPOS  200 . The head of the priority succession management list  120  in which the TCBs of all RT tasks set in a wait state by requesting inter-OS communication are connected in a preferential order of the RT tasks is indicated by the priority succession management list head  140 . The head of the TCB queue  130  that connects the TCBs of all the tasks by requesting inter-OS communication from the inter-OS communication mechanism  110  for each inter-OS communication mechanisms  110  is indicated by the TCB queue head  111 . The head of the PCB queue  210  that connects the PCB of a process communicating with the RT task by using the inter-OS communication mechanism  110  for each inter-OS communication mechanism  110  is indicated by the PCB queue head  112 .  
         [0041]     Each TCB includes a actual priority  401  which is a priority used when an RT task corresponding to the TCB is executed, a next wait TCB  402  which is a pointer for the TCB queue  130 , a wait target  403  which is a pointer to the inter-OS communication mechanism  110  used by the RT task in inter-OS communication, a next priority succession TCB  404  which is a pointer for the priority succession management list  120 , and a original priority  405  which is an original priority of the RT task.  
         [0042]     Each PCB includes a present priority  411  serving as a priority succeeded from the RT task, an original priority  412  serving as an original priority of a process corresponding to the PCB, and a next wait PCB  413  serving as a pointer for the PCB queue  210 .  
         [0043]     The scheduler  150  specifies a priority succession management head TCB indicated by the priority succession management list  120  and uses the wait target  403  stored in the TCB to specify the inter-OS communication mechanism  110  used by an RT task. The scheduler  150  uses the PCB queue head  112  held by the specified inter-OS communication mechanism  110  to specify a process to succeed the priority.  
         [0044]     In this manner, the scheduler  150  specifies the TCB of the highest-priority RT task of the tasks set in a wait state by requesting inter-OS communication by using the priority succession management list  120 . The scheduler  150  specifies the inter-OS communication mechanism  110  used by the RT task by using the specified wait target  403 . The scheduler  150  specifies a process to succeed priority by using the PCB queue head  112  held by the specified inter-OS communication mechanism  110 , so that the priority of the RT task can be succeeded by the process communicating with the RT task.  
         [0045]      FIG. 3  is a flowchart of a process procedure of the RTOS  100  when a communication request is transmitted from an RT task to a GP task  300  to set the RT task in a wait state. When a communication request is transmitted from the RT task to the GP task  300  to set the RT task in a wait state, the method of the inter-OS communication mechanism  110  which processes the communication request links the tasks to be set in a wait state to the TCB queue  130  (step S 301 ). At the same time, the tasks are described in the priority succession management list  120  in the preferential order (step S 302 ).  
         [0046]     The scheduler  150  checks whether the present RT task is the RT task at the head of the priority succession management list  120  or not before dispatch, i.e., whether the present RT task set in a wait state by executing inter-OS communication request has a priority higher than that of another RT task in the priority succession management list  120  or not (step S 303 ).  
         [0047]     As a result, when the present RT task is the RT task at the head of the priority succession management list  120 , the priority of the process communicating with the RT task is increased to the priority of the RT task.  
         [0048]     More specifically, the priority of the RT task is succeeded by the GP task  300  (step S 304 ), and the inter-OS communication mechanism  110  is specified by using the wait target  403  of the TCB of the RT task (step S 305 ). The PCB of the process communicating with the RT task is acquired from the specified inter-OS communication mechanism  110 , and the priority of the RT task is succeeded by the PCB (step S 306 ). More specifically, the priority of the RT task is set to be a present priority  411  of the acquired PCB. A dispatch process is started (step S 307 ).  
         [0049]     On the other hand, when the present RT task is not the RT task at the head of the priority succession management list  120 , the priority of the RT task at the head of the priority succession management list  120  has been succeeded by the GP task  300 . Thus, the process directly shift to the dispatch process (step S 307 ).  
         [0050]     In this manner, when a communication request is transmitted from the RT task to the GP task  300  to set the RT task in a wait state, the method of the inter-OS communication mechanism  110  sets present RT tasks to be set in a wait state in the priority succession management list  120  in a preferential order, and the scheduler  150  checks whether the present RT task is an RT task at the head of the priority succession management list  120  or not before dispatch. When the present RT task is the RT task at the head, the priority of the RT task is succeeded by a process communicating with the RT task to make it possible to increase the priority of the process communicating with the RT task to the priority of the RT task.  
         [0051]      FIG. 4  is a flowchart of a process procedure of the RTOS  100  when execution of an inter-OS communication wait RT task is resumed with end of an inter-OS communication of the GP task  300 . When the execution of the wait task of the RTOS  100  is resumed by ending the inter-OS communication of the GP task  300 , the method of the inter-OS communication mechanism  110  which processes communication deletes the RT task the execution of which is resumed from the TCB queue  130  of the inter-OS communication mechanism  110  because the execution of the wait task is resumed (step S 401 ). The RT task is also deleted from the priority succession management list  120  (step S 402 ).  
         [0052]     The scheduler  150  checks whether the priority succession management list  120  is empty or not before dispatch (step S 403 ). When the priority succession management list  120  is not empty, the priority of the RT task at the head of the priority succession management list  120  is succeeded by the GP task  300 . The priority is succeeded by a process communicating with the RT task.  
         [0053]     More specifically, the priority of the RT task is succeeded by the GP task  300  (step S 404 ). The inter-OS communication mechanism  110  is specified by using the wait target  403  of the TCB of the RT task (step S 404 ), and the PCB of a process communicating with the RT task is acquired from the specified inter-OS communication mechanism  110 . The priority of the RT task is succeeded by the obtained PCB (step S 406 ). More specifically, the priority of the RT task is set at the present priority  411  of the acquired PCB. A dispatch process is started (step S 407 ).  
         [0054]     On the other hand, the priority succession management list  120  is empty, the priority of the GP task  300  and priority of the process which performs communication are returned to original low priorities, respectively (step S 408 ). The process shifts to the dispatch process (step S 407 ).  
         [0055]     In this manner, when the execution of the wait task of the RTOS  100  is resumed by ending inter-OS communication of the GP task  300 , the method of the inter-OS communication mechanism  110  deletes the RT task the execution of which is resumed from the priority succession management list  120 , and the scheduler  150  checks whether the priority succession management list  120  is empty or not before dispatch. When the priority succession management list  120  is not empty, the priority of the RT task at the head of the priority succession management list  120  is succeeded by the process communicating with the RT task, so that the priority of the process communicating with the RT task can be kept at the same level as that of the priority of the RT task with which the process communicates.  
         [0056]      FIG. 5  is a block diagram of a computer that executes the hybrid OS according to the embodiment. A computer  500  includes a central processing unit (CPU)  510 , a random access memory (RAM)  520 , a read only memory (ROM)  530 , a hard disk drive (HDD)  540 , an input/output (I/O) interface  550 , a local area network (LAN) interface  560 , and a modem  570 .  
         [0057]     The CPU  510  is a processor that executes a hybrid OS, an application program, or the like. The RAM  520  is a storage unit that stores the priority succession management list  120 , the TCB queue  130 , the PCB queue  210 , and the like.  
         [0058]     The ROM  530  is a storage unit in which constants and the like which are not changed. The HDD  540  is a magnetic disk device that stores a program or a file. The program stored in the HDD  540  is executed by the CPU  510  by using the RAM  520  and the ROM  530 .  
         [0059]     The I/O interface  550  is an interface that connects input/output devices such as a display device, a keyboard, and a mouse. The LAN interface  560  is an interface that connects the computer to a LAN, and the modem  570  is a device that connects the computer to a public network.  
         [0060]     According to the present embodiment, the TCBs of all the RT tasks set in a wait state by requesting inter-OS communication are managed in a preferential order by using the priority succession management list  120 . When a communication request is transmitted from the RT task to the GP task  300  to set the RT task in a wait state, the scheduler  150  checks whether the RT task is the RT task at the head of the priority succession management list  120  or not. When the RT task is the RT task at the head, the priority of the RT task is succeeded by only a process communicating with the RT task. Thus, other processes can be prevented from being executed at the priority of the RT task, and execution of the RT task can be prevented from being interrupted by other processes.  
         [0061]     According to the present embodiment, when the execution of the wait task of the RTOS  100  is resumed by ending the inter-OS communication of the GP task  300 , the scheduler  150  checks whether the priority succession management list  120  is empty or not. When the priority succession management list  120  is not empty, the priority of the RT task at the head of the priority succession management list  120  is set as the priority of the process communicating with the RT task, so that the priority of the process communicating with the RT task can be kept at the same level as that of the priority of the RT task with which the process communicates.  
         [0062]     According to the present invention, a process other than a process cooperatively operated with an RT task under the control of a GPOS is prevented from being executed at a high priority. Thus, the RT task can be advantageously prevented from being interrupted by execution of another process at a high priority.  
         [0063]     Although the invention has been described with respect to a specific embodiment for a complete and clear disclosure, the appended claims are not to be thus limited but are to be construed as embodying all modifications and alternative constructions that may occur to one skilled in the art which fairly fall within the basic teaching herein set forth.  
         [0064]     Although the invention has been described with respect to a specific embodiment for a complete and clear disclosure, the appended claims are not to be thus limited but are to be construed as embodying all modifications and alternative constructions that may occur to one skilled in the art which fairly fall within the basic teaching herein set forth.