Abstract:
In the RTOS (Real Time Operating System) of this invention, task programs are programmed without including a cache memory management process. The RTOS itself includes the process. Generally, the time of transmitting task code is longer than that of switching between tasks so that waiting time has occurred in a conventional RTOS. The RTOS of this invention loads a task to a cache bank at the frame before executing the task so that the waiting time does not occur and the cache memory management process cause no delay time.

Description:
BACKGROUND OF THE INVENTION  
         [0001]    This invention relates to a Real Time Operating System (will be abbreviated to RTOS hereinafter) for use in a digital signal processing system and, in particular, to an RTOS for managing a cache memory included in a microcomputer to process audio and visual signals.  
           [0002]    In a conventional digital signal processing system of the type described which includes a microcomputer today, it is a recent trend that requirements have been made about a high speed processing and a very complex processing more and more. Such high speed and very complex processings need to inevitably prepare a high speed memory and a very large and intricate program formed by a huge amount of codes. This makes the digital signal processing system expensive.  
           [0003]    In order to solve such a cost problem, consideration is made in the digital signal processing system about provision of a cache memory which can be operated in a high speed and which is comparatively inexpensive. In this case, the cache memory should be skillfully controlled or managed in the digital signal processing system.  
           [0004]    Especially, a delay time must be shortened in the cache memory so as to operate the digital signal processing system at a real time when the digital signal processing device is applied to a portable telephone or the like. To this end, such cache memory management is usually executed by the use of hardware or software. In this event, when the hardware is used to manage the cache memory, a delay time inevitably occurs on a miss hit and, as a result, real time processing can not be expected by using the hardware.  
           [0005]    On the other hand, when the software is used to manage the cache memory, a programmer who designs the software must completely understand and know all of program flows. However, in the case of constructing a multimedia system which executes a plurality of programs by a single processing unit at the same time or by linking together a plurality of programs each of which is programmed individually, it is too virtually difficult for the programmer to understand all program flows. Even if he or she can understand all program flows, it takes a very long time to develop the digital signal processing system because of intricacy of the software.  
           [0006]    In the meanwhile, a plurality of programs are usually executed at the same time on RTOS. However, no consideration is made at all about a conventional RTOS which manages the cache memory without delays.  
         SUMMARY OF THE INVENTION  
         [0007]    It is an object of this invention to provide a method of managing a cache memory which occurs no delay without the step of loading tasks in each of subtask.  
           [0008]    It is another object of this invention to provide an RTOS which is capable of managing a cache memory without a superfluous delay on loading or switching a plurality of tasks.  
           [0009]    It is still another object of this invention to provide an application device, such as a processing unit, an audio-visual signal processing system, and a portable telephone, which is operable in accordance with the RTOS without any superfluous delay.  
           [0010]    According to this invention, the method is for use in successively executing a current task and a following task after the current task and comprises a following task detecting step of detecting the following task, a task discriminating step of discriminating between the following task and each of loaded tasks which are currently stored in the cache memory together and which includes the current task, a target bank detecting step of detecting a ready one of the cache banks that is not loaded with the current task and that is ready for memorizing the following task, if the following task is not present in the cache memory as a result of discriminating the loaded tasks in the task discriminating step, and a loading step of loading the following task with the ready cache bank before the execution of the following task when the following task is not present in the cache memory.  
           [0011]    According to this invention, the RTOS is for use in successively executing a current task and a following task after the current task and has a process of a cache management process which detects a following task to be executed after execution of the current task and which loads the following task with the cache memory, said cache management process being not included in the tasks.  
           [0012]    According to this invention, an audio-visual signal processing unit, and a portable telephone, the ones are for use in successively executing a current task and a following task after the current task and comprises following task detecting means for detecting the following task, task discriminating means for discriminating between the following task and each of loaded tasks which are currently stored in the cache memory together and which includes the current task, and target bank detecting means for detecting a ready one of the cache banks that is not loaded with the current task and that is ready for memorizing the following task, if the following task is not present in the cache memory by discriminating the loaded tasks in the task discriminating means, and loading means of loading the following task to the ready cache bank before the execution of the following task when the following task is not present in the cache memory. 
       
    
    
     BRIEF DESCRIPTION OF THE DRAWING  
       [0013]    [0013]FIG. 1 shows a block diagram for use in schematically describing a part of a conventional RTOS;  
         [0014]    [0014]FIG. 2 shows a block diagram for use in describing a cache memory management operation executed in accordance with the conventional RTOS;  
         [0015]    [0015]FIG. 3 shows a structure of an interval table used in the conventional RTOS;  
         [0016]    [0016]FIG. 4 shows a format of a cache tag management table used in the conventional RTOS;  
         [0017]    [0017]FIG. 5 exemplifies a time chart for executing a plurality of tasks executed by the use of conventional RTOS;  
         [0018]    [0018]FIG. 6 shows formats of a cache memory and a external memory which stores task codes;  
         [0019]    [0019]FIG. 7 shows a table for use in describing a renewing operation of the interval table illustrated in FIG. 3  
         [0020]    [0020]FIG. 8 shows a time chart for use in describing an operation of transmitting task codes to a cache memory under control of the conventional RTOS;  
         [0021]    [0021]FIG. 9 shows a block diagram for use in schematically describing a part of an RTOS according to the present invention;  
         [0022]    [0022]FIG. 10 shows a block diagram for use in describing a cache memory management operation executed in accordance with the present invention;  
         [0023]    [0023]FIG. 11 shows a format of a predictive interval table uses in FIG. 10;  
         [0024]    [0024]FIG. 12 shows a format of a cache tag management table used in FIG. 10;  
         [0025]    [0025]FIG. 13 shows a diagram for use in an example of renewing operation carried out in the predictive interval table  33 ; and  
         [0026]    [0026]FIG. 14 shows a timing chart for use in describing an operation of transmitting task codes to a cache memory in accordance with the present invention. 
     
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS  
       [0027]    Referring to FIG. 1, description will be conceptually made about a conventional RTOS which serves to execute and to manage a plurality of tasks  1 ,  2 , and  3  for a better understanding of the present invention.  
         [0028]    In the illustrated example, the task  1  is divided into first, second, and third subtasks  1 A,  1 B, and  1 C while the tasks  2  and  3  are assumed to manage subtasks  2 A and  3 A, respectively. Specifically, each task  1 ,  2 , and  3  executes, for example, scheduling processing of each subtask. At any rate, cache memory management is carried out by predetermined ones of the subtasks, for example,  1 A,  2 A, and  3 A to determine a next following task and to load the cache memory with the next task. From this fact, it is readily understood that a programmer should recognize and write a cache memory management process in every task.  
         [0029]    Referring to FIG. 2, the conventional RTOS has an interval table renewing unit  10  which is operable in response to an interruption sent from an interval timer (not shown) and which cooperates with an interval table  30  (will be mentioned later in detail). It suffices to say that the interval table  30  stores an execution start time. The interval table renewing unit  10  renews the execution start time at every interruption time of the interval timer.  
         [0030]    Referring to FIG. 3 together with FIG. 2, the interval table  30  is divided into zeroth through n-th regions assigned to zeroth through n-th ones of the tasks, respectively. In this connection, the value of “n” is smaller than the number of the tasks by  1 . Each of the first through the n-th regions has a current frame counter portion for counting every current frame of the tasks, an A frame counter portion, and a B frame counter portion. The current frame counter portion and both of the A and B frame counter portions which will be used in a manner to be described later will be simply referred to as a current frame counter and A and B frame counters. The current frame counter issues an execution request related to the task in question when the count is equal to or smaller than zero. Each A frame counter indicates a value which is subtracted at the beginning of each frame from a predictive frame value of the current frame counter just before. The B frame counter indicates a value which is added to the count of the current frame counter at the end of execution of each task. An interval table monitor unit  11  illustrated in FIG. 1 refers to the interval table  30  and searches for the next execution task which is to be next started.  
         [0031]    If the next following task is present in the interval table  30 , a target bank detecting unit  15  accesses a cache tag management table  32  as shown in FIG. 4 and detects a bank which is ready to be allocated to the next execution task as a result of accessing the cache tag management table  32 . Thereafter, the cache tag management table  32  is renewed so that a code allocated to the bank in question indicates a code assigned to the next execution task.  
         [0032]    As shown in FIG. 4, the cache tag management table  32  serves to allocate task codes to the cache banks and is divided into zeroth through m-th areas assigned to zeroth through m-th ones of the cache banks, respectively. Each of the zeroth through the m-th areas stores the cache bank numbers which are given to the respective cache banks together with load task IDs which identify the loaded tasks stored into the cache banks, respectively From this fact, it is readily understood that each of the zeroth and the m-th areas is loaded with each pair of the cache bank numbers and the load task IDs.  
         [0033]    Referring back to FIG. 2, a loading operation unit  16  is coupled to the target bank detecting unit  15  to generate a command which is indicative of loading the bank detected by the target bank detecting unit  15  with the task code detected by the interval table monitor unit  11 . A standby task registration unit  12  is coupled to a standby task table  31  to register an execution task into the standby task table  31 . A task switching unit  13  switches from the current task to the next execution task registered in the standby task table  31 .  
         [0034]    Now, the following description will be directed to a cache memory management process which is carried out by the conventional RTOS mentioned above. In the following, it is assumed that the process executes three tasks (TASK  1 ,  2 ,  3 ) according to the schedule as shown in FIG. 5 and that the cache memory and an external memory are formed as shown in FIG. 6. In this case, the external memory may be a main memory and stores the task codes in the illustrated manner. Further, it is also assumed that each of the task codes is not allocated to a plurality of the cache banks in the cache memory during transmission from the external memory to the cache memory.  
         [0035]    As mentioned above, a next one of the tasks to be executed in the next frame is determined by the count or value of the current frame counter included in the interval table  30 . The interval table  30  is allocated to the TASK  1 ,  2 , and  3  and is renewed in the manner illustrated in FIG. 7.  
         [0036]    In FIG. 7, consideration is made about first, second, and third frames ( 1 ), ( 2 ), and ( 3 ) each of which is defined by a beginning state depicted at  1  and an end state depicted at  2 . At the beginning states  1 - 1 ,  2 - 1 , and  3 - 1 , each current frame counter takes the value which is renewed by the interval table renewing unit  10  and which is given by: 
         C C −C A   
         [0037]    where C C  represents a value of each current frame counter and C A  represents the value of each A frame counter. A renewed value is loaded with each current frame counter again. When the current frame counter becomes zero, it is judged that the task execution is requested.  
         [0038]    At the end states  1 - 2 ,  2 - 2 , and  3 - 2  of each frame, renewal of each current frame counter is carried out in accordance with the following: 
         C C +CB 
         [0039]    where C B  represents the value of each B frame counter. The renewed value is stored again in each current frame counter. No renewal is made about the current frame counter which is related to the tasks which are not being executed. For example, the current frame counter of TASK  1  is not renewed at the end state  2 - 2 .  
         [0040]    Referring to FIG. 8, illustration is made about a timing relationship among the tasks  1  to  3  which are executed in the manner illustrated in FIG. 7. In FIG. 8, the tasks  1 ,  2 , and  3  are assumed to be started within frames A, B, and C and to be switched from one to another by the RTOS. The task codes are transmitted by the RTOS at the beginnings of the frames A, B. and C, as illustrated along the bottom line of FIG. 8. In this event, the RTOS starts the switching operation of the tasks  1 ,  2 , and  3  simultaneously with the transmission of each task code. However, it takes a long time to transmit each task code in comparison with the switching operation of the tasks  1 ,  2 , and  3 . Therefore, a waiting or standby time inevitably appears as depicted at (a), (b), and (c) in FIG. 8 until execution of each task  1 ,  2 , and  3 .  
         [0041]    A small number of the task codes alone can be transmitted while the standby task registration unit  12  and the task switch unit  13  are being operated. Therefore, the task switch operation is finished with the conventional RTOS before completion of the task code transmission. This shows that the standby or waiting time occurs at a high probability. In this case, the cache bank during transmission of the task code is put into a locked state. As a result, the task can not be executed at once but is put in a waiting state until completion of the task code transmission.  
         [0042]    Such a waiting time is short as compared with a waiting time which occurs due to a miss hit of the cache memory. However, even such a short waiting time brings about a fatal delay in a digital signal processing system that strongly requires real time processing.  
         [0043]    Referring FIG. 9, an RTOS according to a preferred embodiment of the present invention is conceptually illustrated which also manages cache control processing in addition to scheduling processing. This shows that the cache control processing is incorporated into the RTOS. On the other hand, the cache management processing is incorporated into one of the subtasks related to the tasks  1 ,  2 , and  3 , as shown in FIG. 1. With this structure according to the present invention, no cache management processing may be incorporated in the subtasks, differing from the RTOS illustrated in FIG. 1.  
         [0044]    Referring FIG. 10 together with FIG. 9, the RTOS according to the preferred embodiment of this invention will be described in detail. Like in FIG. 2, the RTOS according to the present invention comprises components are similar to those illustrated in FIG. 2 and which are depicted at the same reference numerals as those of FIG. 2. Specifically, the illustrated RTOS further comprises a next execution task detecting unit  17 , a task discriminating unit  18 , an interval table monitor unit  11 , and a predictive interval table  33  in addition to the elements illustrated in FIG. 2.  
         [0045]    In FIG. 10, the interval table renewing unit  10  is coupled to both the interval table  30  and the predictive interval table  33  (as shown by broken lines) and renews both the interval table  30  and the predictive interval table  33  each time when an interval timer interruption is received from an external circuit. Herein, it is to be noted that the predictive interval table  33  previously or predictively indicates those contents of the interval table  30  which might occur in the future after the interval timer interruption is received several times.  
         [0046]    The next task detecting unit  17  refers to the predictive interval table  33  to detect a next following execution task which may be executed at the next frame.  
         [0047]    The task discriminating unit  18  compares the next task detected by the next task detecting unit  17  with the current task which is currently being executed. If the next task is coincident with the current one, then the task discriminating unit  18  decides not to load the cache memory with the task in question and transfers a processing to the interval table monitor unit  11 . If the next task is not coincident with the current one, the task discriminating unit  18  decides to use the cache memory and transfers operation to the target bank detecting unit  15 . The operation of using the cache memory will be simply called caching or caching operation.  
         [0048]    On the caching operation, the target bank detecting unit  15  refers to the cache tag management table  34  to detect a bank which is allocable to the next task and which has an allocation code assigned thereto. Thereafter, the target bank detecting unit  15  renews the cache tag management table  34  so that the allocation code to the bank indicates the code of the next task.  
         [0049]    In this sense, the cache tag management table is represented by a reference number  34  different from that in FIG. 4. Herein, it is to be noted that the execution flag indicates which one of tasks is being executed currently and is provided to avoid wrong loading on the executing bank.  
         [0050]    The cache tag management table illustrated in FIG. 10 stores not only the cache bank number and the load task ID, but also an execution flag and is therefore different from that illustrated  
         [0051]    The loading operation unit  16  is supplied with the bank which is detected by the target bank detecting unit  15  and which is specified by the allocation code. Under the circumstances, the loading operation unit  16  issues a command which is indicative of loading the bank under consideration with the next task detected by the next task detecting unit  17 .  
         [0052]    After the cache memory management process is finished in the above-mentioned manner, processing is executed by the interval table monitor unit  11 , the standby task registration unit  12 , and the task switching unit  13  in the manner mentioned in conjunction with FIG. 4.  
         [0053]    Moreover, description will be made about the cache memory management process which are executed by the use of the RTOS according to the present invention. Herein, it is assumed that the cache memory and the external memory are structured as shown in FIG. 6 and that three tasks represented by TASK 1 , TASK 2 , and TASK 3  are executed according to the schedule shown in FIG. 5.  
         [0054]    At first, the interval table  30  is renewed in the manner mentioned in conjunction with the conventional interval table.  
         [0055]    The predictive interval table  33  has a predictive current frame counters for the respective tasks TASK 1 , TASK 2  and TASK 3 . Each predictive current frame counter acts like the current frame counter stored by the interval table  30  and is renewed in the manner shown in FIG. 13. The predictive current frame counters are assumed to be renewed in timed relation to renewal operation of the interval table  30  shown in FIG. 7. The predictive interval table  33  is renewed, like the interval table  30 , by the interval table renewing unit  10 . However, a renewing method of the predictive interval table  33  is different from that of each current frame counter. Specifically, if the current frame counter takes zero or less, renewal operation is executed in each predictive interval counter in accordance with the following formula: 
         C R =C C −C A +C B , 
         [0056]    where CR represents the value of predictive frame counter; C C , the value of the current frame counter; C A , the value of the A frame counter; and C B , the value of the B frame counter. If the counter is more than zero, the renewal operation is executed in accordance with the following formula: 
         C R =C C −C A . 
         [0057]    When the predictive frame counter becomes zero or less, it is judged that the task to be executed in the next frame is present and an execution request is issued in connection with the task. In this example, the predictive frame counter is indicative of the value or count before one frame in the current frame counter. As the banks are increased in number, the predictive frame counter may be indicative of the value before two or more frames in the current frame counter.  
         [0058]    Referring to FIG. 13, the predictive frame counter for the TASK 2  takes zero at the time instance ( 1 ) so that the next task detecting unit  17  predicts the TASK 2  will be executed at the B frame. If the TASK 2  is not loaded to the cache memory, the task discriminating unit  18  decides to load the cache memory with the task. Consequently, the loading operation unit  16  loads the TASK 2  to the bank which is detected by the target bank detecting unit  15 .  
         [0059]    Likewise, commands are issued at the time instance ( 2 ), to predict an execution task at the B frame and to load the code of TASK 3  which is not loaded to the cache memory.  
         [0060]    Referring to FIG. 14, illustration is made about the caching operation which is executed in the above-mentioned manner. FIG. 14 shows a time chart of a task code transmitting operation of the TASK 1 - 3 , a task switching operation, and a task executing operation when the predictive interval table  33  is renewed as shown in FIG. 13. In FIG. 14, the task code transmitting operation has finished before the task switching operation to the next task by using the cache memory management process of this invention. As a result, no waiting or standby time takes place in accordance with this invention.  
         [0061]    As mentioned above, this invention can eliminate any waiting time which might wait for complete code transmission to the cache memory at the beginning of executing program or programs.  
         [0062]    While this invention has thus far been described an a embodiment thereof, it will be readily possible for those skilled in the art to put this invention into various other manners.