Semiconductor device, semiconductor device control method and program

The semiconductor device simplifies multiprocessor system software development by scheduling tasks based on group identification, reducing complexity and enhancing reusability through operating system management of shared resources.

JP7785525B2Active Publication Date: 2025-12-15RENESAS ELECTRONICS CORP

Patent Information

Application Number
JP2021205996
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2021-12-20
Publication Date
2025-12-15
Estimated Expiration
2041-12-20

AI Technical Summary

Technical Problem

Existing multiprocessor systems require complex exclusive control processing for shared resources, complicating software development and reducing the reusability of single-processor system software due to issues like deadlock and livelock from nested locking.

Method used

A semiconductor device with a memory storing task management and active group management information, allowing processors to execute tasks based on group identification, eliminating the need for complex exclusive control by scheduling tasks through an operating system.

Benefits of technology

Simplifies software development for multiprocessor systems by reducing the need for complex exclusive control, increasing software reusability from single-processor systems, and avoiding issues like deadlock and livelock.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007785525000001
    Figure 0007785525000001
  • Figure 0007785525000002
    Figure 0007785525000002
  • Figure 0007785525000003
    Figure 0007785525000003
Patent Text Reader

Abstract

To eliminate the need for complex exclusive control processing in a task side executed by a processor.SOLUTION: A semiconductor device 10 comprises: a memory 13 which stores task management information 15 and in-execution group management information 16; a first PE 11a and a second PE 11b; and a first shared resource 12a and a second shared resource 12b. The first PE 11a or the second PE 11b are configured to: refer to the in-execution group management information 16; identify a group of tasks executable in the first PE 11a or the second PE 11b as an executable group; refer to the task management information 15; and determine the task associated with group identification information of the identified executable group, as the task to be executed next in the first PE 11a or the second PE 11b.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present invention relates to a semiconductor device, a control method for a semiconductor device, and a program. [Background technology]

[0002] In recent years, microcomputers have been widely used as semiconductor devices mounted on in-vehicle systems, industrial equipment, home appliances, etc. Such microcomputers employ multiprocessor systems that allow multiple processors to execute tasks in parallel. In multiprocessor systems, exclusive control is required because each processor competes for access to shared resources such as shared memory.

[0003] A related technique is known from Patent Document 1. The related technique discloses a technique that can prevent processor resources from being continuously wasted when contention for a shared resource occurs in a multiprocessor system. [Prior art documents] [Patent documents]

[0004] [Patent Document 1] Japanese Patent Application Laid-Open No. 2011-175378 Summary of the Invention [Problem to be solved by the invention]

[0005] However, in the related technology, it is necessary for the task executed by the processor to perform complex exclusive control processing.

[0006] Other objects and novel features will become apparent from the description of this specification and the accompanying drawings. [Means for solving the problem]

[0007] According to one embodiment, a semiconductor device includes a memory, first and second processor elements, and first and second shared resources. The memory stores a program, task management information, and active group management information. The first and second shared resources are accessible from the first and second processor elements. The task management information associates a task executed by the first or second processor element with group identification information that identifies a group corresponding to the first or second shared resource. The active group management information indicates, for each group, whether a task associated with the group identification information of the group is being executed by the first or second processor element. The first or second processor element is configured to execute a program, refer to the active group management information, identify a group of tasks executable by the first or second processor element as an executable group, refer to the task management information, and determine a task associated with the group identification information of the identified executable group as the next task to be executed by the first or second processor element. [Effects of the Invention]

[0008] According to one embodiment, it is possible to eliminate the need for complex exclusive control processing on the task side executed by the processor. [Brief explanation of the drawings]

[0009] [Figure 1] FIG. 1 is a configuration diagram showing an overview of a semiconductor device according to an embodiment. [Figure 2] FIG. 2 is a diagram showing a hardware configuration of the multiprocessor system according to the first embodiment. [Figure 3] FIG. 3 is a configuration diagram showing the logical layer configuration of the multiprocessor system according to the first embodiment. [Figure 4] FIG. 4 is a diagram showing the configuration of the RTOS and RTOS data according to the first embodiment. [Figure 5]FIG. 5 is a diagram showing the structure of the RTOS data according to the first embodiment. [Figure 6] FIG. 6 is a configuration diagram showing the configuration of the RTOS according to the first embodiment. [Figure 7] FIG. 7 is a diagram for explaining a method for generating RTOS data according to the first embodiment. [Figure 8] FIG. 8 is a flowchart showing an operation method of the multiprocessor system according to the first embodiment. [Figure 9] FIG. 9 is a system configuration diagram for a specific example of the multiprocessor system according to the first embodiment. [Figure 10] FIG. 10 is a diagram showing an RTOS initial setting file for a specific example of the multiprocessor system according to the first embodiment. [Figure 11] FIG. 11 is a diagram showing initial values ​​of task management information for a specific example of the multiprocessor system according to the first embodiment. [Figure 12] FIG. 12 is a diagram showing the state of tasks in each PE in Case 1 of the specific example of the multiprocessor system according to the first embodiment. [Figure 13] FIG. 13 is a diagram showing task management information and schedule management information of PE0 in case 1 of the specific example of the multiprocessor system according to the first embodiment. [Figure 14] FIG. 14 is a diagram showing task management information, schedule management information, and active group management information of PE1 in case 1 of the specific example of the multiprocessor system according to the first embodiment. [Figure 15] FIG. 15 is a diagram showing the state of tasks in each PE in Case 2 of the specific example of the multiprocessor system according to the first embodiment. [Figure 16] FIG. 16 is a diagram showing task management information, schedule management information, and active group management information of PE0 in case 2 of the specific example of the multiprocessor system according to the first embodiment. [Figure 17]FIG. 17 is a diagram showing the state of tasks in each PE in Case 3 of the specific example of the multiprocessor system according to the first embodiment. [Figure 18] FIG. 18 is a diagram showing task management information, schedule management information, and active group management information of PE1 in case 3 of the specific example of the multiprocessor system according to the first embodiment. [Figure 19] FIG. 19 is a diagram showing the state of tasks in each PE in Case 4 of the specific example of the multiprocessor system according to the first embodiment. [Figure 20] FIG. 20 is a diagram showing task management information, schedule management information, and active group management information of PE0 in case 4 of the specific example of the multiprocessor system according to the first embodiment. [Figure 21] FIG. 21 is a diagram showing the state of tasks in each PE in Case 5 of the specific example of the multiprocessor system according to the first embodiment. [Figure 22] FIG. 22 is a diagram showing task management information, schedule management information, and running group management information of PE1 in case 5 of the specific example of the multiprocessor system according to the first embodiment. [Figure 23] FIG. 23 is a diagram showing the state of tasks in each PE in Case 6 of the specific example of the multiprocessor system according to the first embodiment. [Figure 24] FIG. 24 is a diagram showing task management information and schedule management information of PE1 in Case 6 of the specific example of the multiprocessor system according to the first embodiment. [Figure 25] FIG. 25 is a diagram showing the state of tasks in each PE in Case 7 of the specific example of the multiprocessor system according to the first embodiment. [Figure 26] FIG. 26 is a diagram showing task management information and schedule management information of PE0 in Case 7 of the specific example of the multiprocessor system according to the first embodiment. [Figure 27]FIG. 27 is a diagram showing task management information, schedule management information, and active group management information of PE1 in case 7 of the specific example of the multiprocessor system according to the first embodiment. [Figure 28] FIG. 28 is a diagram illustrating an example of task transition in a multiprocessor system of a comparative example. [Figure 29] FIG. 29 is a diagram illustrating an example of task transition in the multiprocessor system according to the first embodiment. [Figure 30] FIG. 30 is a diagram showing a hardware configuration of a multiprocessor system according to the second embodiment. [Figure 31] FIG. 31 is a diagram showing the configuration of the RTOS and RTOS data according to the second embodiment. [Figure 32] FIG. 32 is a diagram showing the structure of RTOS data according to the second embodiment. [Figure 33] FIG. 33 is a configuration diagram showing the configuration of the RTOS according to the second embodiment. [Figure 34] FIG. 34 is a flowchart showing an operation method of the multiprocessor system according to the second embodiment. [Figure 35] FIG. 35 is a flowchart showing an operation method of the multiprocessor system according to the second embodiment. [Figure 36] FIG. 36 is a diagram illustrating an example of task transition in the multiprocessor system according to the first embodiment. [Figure 37] FIG. 37 is a diagram illustrating an example of task transition in the multiprocessor system according to the second embodiment. DETAILED DESCRIPTION OF THE INVENTION

[0010] Hereinafter, embodiments will be described with reference to the drawings. For clarity of explanation, the following description and drawings have been omitted or simplified as appropriate. Furthermore, each element shown in the drawings as a functional block performing various processes can be configured in hardware with a CPU, memory, or other circuits, and in software with a program loaded into memory, for example. Therefore, those skilled in the art will understand that these functional blocks can be realized in various forms using only hardware, only software, or a combination thereof, and are not limited to any of these. In addition, the same elements are designated by the same reference numerals in each drawing, and redundant explanations are omitted as necessary.

[0011] (Review of related technologies) In recent years, the electronics of in-vehicle systems has progressed, and we are now in an era where a single vehicle is equipped with systems incorporating a huge amount of software. Software developers for in-vehicle systems need to develop large-scale software to be incorporated into in-vehicle systems in a short period of time. In order to develop large-scale software in a short period of time, there is a demand for technologies that increase the reusability of software and technologies that make software development easier.

[0012] On the other hand, CPU operating frequencies have reached their limits due to issues of leakage current and reliability, and as an alternative approach, a multiprocessor system that incorporates two or more CPUs on a single semiconductor chip is being used to improve performance by running software simultaneously.

[0013] Developing software for a multiprocessor system involves the need for exclusive control of shared resources between processors in the application program, making software development for a multiprocessor system more complex and difficult than software development for a single-processor system.

[0014] A known method of exclusive control of shared resources in a multiprocessor system is a locking method that acquires and releases a lock on the shared resource. Locking methods include a spinlock method and a sleeplock method. The spinlock method is a method in which a task busy waits until it acquires the lock, and continues to access a lock variable used to acquire and release the lock. The sleeplock method is a method in which a task goes to sleep if it is unable to acquire the lock, and wakes up the task when the lock is released to acquire the lock. The spinlock method wastes processor time while the processor is busy waiting, and the sleeplock method requires processor execution time during sleep and wakeup.

[0015] In contrast to this, in the above-mentioned Patent Document 1, CPU waste is prevented by switching between waiting using the spin lock method and waiting using the sleep lock method based on the holding period during which the task holds the lock on the shared resource.

[0016] However, related technologies such as those described in Patent Document 1 do not take software applicability into consideration. Software applicability, as described here, refers to the case where software that runs on a single-processor system can be used directly on a multiprocessor system. In a typical multiprocessor system, when a shared resource between processors is operated during process execution, a lock acquisition process must be added to the process program. Similarly, a lock release process must be added after the operation on the shared resource between processors is completed. Furthermore, a case can occur where, while a lock is acquired on one shared resource, a lock is acquired on another shared resource (nested locking). Nested locking carries the risk of causing problems specific to multiprocessors, such as deadlock and livelock. For this reason, it is not easy to add lock acquisition and lock release processes to a process (task).

[0017] (Outline of the embodiment) FIG. 1 shows a schematic configuration of a semiconductor device according to an embodiment. A semiconductor device 10 according to the embodiment constitutes a multiprocessor system. As shown in FIG. 1, the semiconductor device 10 includes a first processor element (PE) 11a, a second processor element (PE) 11b, a first shared resource (SR) 12a, a second shared resource (SR) 12b, and a memory 13. The memory 13 stores a program 14, task management information 15, and active group management information 16. The program 14 includes an operating system (OS) and application programs.

[0018] The first PE 11a and the second PE 11b are execution units that operate independently and can execute tasks in parallel. A task is a unit of predetermined processing included in an application program. For example, one PE can execute one task. Note that the execution of a program is not limited to tasks, and it may also be per process or thread. The first PE 11a and the second PE 11b execute task processing in accordance with an application program stored in the memory 13.

[0019] The first shared resource 12a and the second shared resource 12b are accessible from the first PE 11a and the second PE 11b, respectively. That is, the first shared resource 12a and the second shared resource 12b are accessible from tasks executed on the first PE 11a and the second PE 11b, respectively. The first shared resource 12a and the second shared resource 12b are shared memories, etc. The first shared resource 12a and the second shared resource 12b are not limited to memories but also include other storage means, network resources, other system resources, etc. The first shared resource 12a and the second shared resource 12b can be simultaneously accessed by multiple tasks on the first PE 11a and the second PE 11b, and exclusive control is required to prevent access conflicts.

[0020] The task management information 15 is information that associates a task executed by the first PE 11a or the second PE 11b with group identification information that identifies a group corresponding to the first shared resource 12a or the second shared resource 12b. That is, each task is grouped according to the shared resource that it accesses. The running group management information 16 is information that indicates, for each group, whether a task associated with the group identification information of the group is being executed by the first PE 11a or the second PE 11b.

[0021] The first PE 11a or the second PE 11b executes the program 14, which is an operating system, to realize a function of scheduling tasks to be executed by the first PE 11a or the second PE 11b. Specifically, the first PE 11a or the second PE 11b executes the program 14, and refers to the running group management information 16 to identify a group of tasks that can be executed by the first PE 11a or the second PE 11b as an executable group. The first PE 11a or the second PE 11b refers to the task management information 15 and determines a task associated with the group identification information of the identified executable group as the task to be executed next by the first PE 11a or the second PE 11b. For example, the first PE 11a or the second PE 11b refers to the running group management information 16 to identify a group, the group of which a task associated with the group identification information is not being executed by the first PE 11a or the second PE 11b, as an executable group.

[0022] As described above, in the embodiment, in a semiconductor device constituting a multiprocessor system, tasks are associated with groups of shared resources, and the OS manages the execution status of tasks that access the shared resources from any of the processors for each group, and schedules the next task based on the execution status of the tasks for each group. This makes it possible to realize exclusive control of the shared resources accessed by a task by task scheduling on the OS side, rather than on the application program side of the task.

[0023] Therefore, according to the embodiment, software developers of multiprocessor systems do not need to be aware of resource contention between processors during task processing, and application programs do not need complex exclusive control processing, which reduces the difficulty of software development. Furthermore, it becomes possible to increase the reusability of software already developed for single-processor systems.

[0024] (Embodiment 1) Next, a description will be given of a multiprocessor system according to embodiment 1. In this embodiment, the scheduling function of the OS performs exclusive control for each group of tasks that access a shared resource.

[0025] <System configuration> First, the system configuration of this embodiment will be described. Fig. 2 shows the hardware configuration of a multiprocessor system according to this embodiment. Fig. 3 shows the logical layer configuration of the multiprocessor system according to this embodiment. The multiprocessor system 100 according to this embodiment is a microcomputer (semiconductor device) that implements an RTOS (Real Time Operating System).

[0026] 2, the multiprocessor system 100 includes a plurality of PEs 101 (for example, PEs 101a to 101n) and a memory 102. The PEs 101a to 101n and the memory 102 are connected to one another via a bus 103. The PEs 101a to 101n can access the memory 102 via the bus 103.

[0027] The PE 101 is a computing device that includes a CPU core and executes programs. The PE 101 reads programs such as an OS and application programs from a memory 102 and executes the read programs to realize the functions of the programs. The PEs 101a to 101n each include registers (REG) 104a to 104n that are used to process the programs they execute.

[0028] The memory 102 is a storage device that stores programs and data used by the PE 101. The memory 102 is a non-volatile memory such as a flash memory, or a volatile memory such as an SRAM (Static Random Access Memory) or a DRAM (Dynamic Random Access Memory).

[0029] The memory 102 includes a program area 110 and a data area 120. The program area 110 is an area that stores programs that can be executed by the PE 101. The data area 120 is an area that stores data that is necessary for processing the programs.

[0030] The program area 110 stores an RTOS 111, a user application program 112, and the like. The RTOS 111 is basic software for real-time systems. The functions of the basic software include scheduling of tasks to be executed by the PE 101. The RTOS 111 provides system calls to application programs to invoke various functions of the basic software.

[0031] 3, the RTOS 111 provides basic software functions to each PE 101 of the multiprocessor system 100. That is, the RTOS 111 is read and executed by each PE 101, thereby realizing various functions such as scheduling in each PE 101.

[0032] The user application program 112 is an application program developed by a user. The user application program 112 includes a software component SW-C for each PE 101. The software component SW-C includes a task to be executed by each PE 101. A task is an execution unit of program processing. Each task is started by invoking a system call of the RTOS 111 from the software component SW-C, and the task is executed.

[0033] 3, each software component SW-C of the user application program 112 runs on each PE 101 via the functions of the RTOS 111. The software component SW-C includes a plurality of tasks (T) to be executed on the PE 101. The software component SW-C is read and executed by the corresponding PE 101, thereby realizing the function of the task on the PE 101.

[0034] The data area 120 stores RTOS data 121 and the like. The RTOS data 121 is data required when the RTOS 111 is executed. That is, the RTOS data 121 is referenced and updated by the PE 101 in accordance with the processing of the RTOS 111 executed by the PE 101. The data area 120 also includes application data required when the user application program 112 is executed.

[0035] The multiprocessor system 100 also includes a plurality of shared resources SR accessed by tasks of each PE 101. In this embodiment, as shown in FIG. 3, tasks that access the shared resources SR are grouped by shared resource SR. For example, among the tasks executed by each PE 101, tasks that access shared resource SR1 are group 1 (Gr1) tasks. Furthermore, tasks that access shared resource SR2 are group 2 (Gr2) tasks. Furthermore, tasks that access shared resource SR3 are group 3 (Gr3) tasks. In scheduling by the RTOS 111, exclusive control of tasks is performed for each group corresponding to the shared resource SR.

[0036] 4 shows the functional configuration of the RTOS and the data configuration of the RTOS data according to this embodiment. As shown in FIG. 4, the RTOS data 121 includes task management information 230, schedule management information 240, and active group management information 250.

[0037] The task management information 230 is information for managing tasks executed by the PE 101. One piece of task management information 230 is assigned to each task. The task management information 230 includes task identification information, task status, task priority for scheduling, and the like. Furthermore, in order to manage tasks for each group of shared resources SR, the task management information 230 includes identification information for the group of shared resources SR used by the task. The task management information 230 associates this information with the task.

[0038] The schedule management information 240 is information for managing the scheduling of tasks in the PE 101. One piece of schedule management information 240 is assigned to each PE 101. The schedule management information 240 includes, for example, information on tasks waiting to be executed, the highest priority of the task, information on tasks currently being executed, etc. Furthermore, in order to manage the scheduling for each group of the shared resource SR, the schedule management information 240 includes the highest priority of the task for each group.

[0039] The running group management information 250 is information for managing groups of tasks currently being executed in the multiprocessor system 100. Only one piece of running group management information 250 is assigned to the multiprocessor system 100. The running group management information 250 includes information indicating whether or not there is a task currently being executed for each group in the multiprocessor system 100.

[0040] The RTOS function 111a, which is realized by the PE 101 executing the RTOS 111, includes a task management control unit 210 and a schedule management control unit 220. The task management control unit 210 manages and controls the state of each task in the PE 101. The task management control unit 210 refers to and updates task management information 230, schedule management information 240 for the PE 101 to be executed, and running group management information 250 for the group to which the task belongs, to manage the state of each task. The task management control unit 210 is called by the user application program 112 (software component) and controls the operation of the task in response to the call. The task management control unit 210 receives a task start request or task stop request from the user application program 112 as input, and saves the task state and task register information in the task management information 230.

[0041] It can also be said that the task management control unit 210 manages the execution state of tasks for each group of shared resource SR. For example, the task management control unit 210 manages the execution state of tasks in group 1 that access shared resource SR1 and the execution state of tasks in group 2 that access shared resource SR2, among the tasks executed by each PE 101. The task management control unit 210 refers to and updates the executing group management information 250 to manage whether or not a task in each group is being executed by any PE 101. For example, the task management control unit 210 manages whether or not a task in group 1 that accesses shared resource SR1 is being executed by any of the PEs 101, and manages whether or not a task in group 2 that accesses shared resource SR2 is being executed by any of the PEs 101.

[0042] The schedule management control unit 220 manages and controls the schedule of tasks in the PE 101. The schedule management control unit 220 schedules tasks by referring to and updating task management information 230, schedule management information 240 of the execution target PE, and running group management information 250 of the group to which the task belongs. The schedule management control unit 220 is called by the task management control unit 210, and identifies the next task to be started using the schedule management information 240 and running group management information 250 as input.

[0043] Furthermore, the schedule management control unit 220 determines the next task to be executed for each group based on the execution status of the task for each group. For example, the schedule management control unit 220 determines the next task of group 1 to be executed by each PE 101 based on the execution status of the task of group 1 that accesses the shared resource SR1. The schedule management control unit 220 also determines the next task of group 2 to be executed by each PE 101 based on the execution status of the task of group 2 that accesses the shared resource SR2. When scheduling tasks belonging to a group, if the tasks of the group are not being executed by all PEs 101, the schedule management control unit 220 schedules the next task to be executed in the group to be executed by the PE 101. If the tasks of the group are being executed by any PE 101, the schedule management control unit 220 suspends the execution of the next task to be executed (startup candidate) in the group.

[0044] Furthermore, the schedule management control unit 220 schedules the execution of the highest priority task among the tasks scheduled to be executed next. That is, the schedule management control unit 220 schedules the next task of each group to be executed based on the execution status of the task for each group and the priority of the task for each group. For example, the schedule management control unit 220 determines the next task of group 1 to be executed by each PE 101 based on the execution status of the task of group 1 and the priority of the task of group 1. Furthermore, the schedule management control unit 220 determines the next task of group 2 to be executed by each PE 101 based on the execution status of the task of group 2 and the priority of the task of group 2. When scheduling tasks belonging to a group, the schedule management control unit 220 determines whether the tasks of the group are being executed by all PEs 101. If the tasks of the group are not being executed by all PEs 101, the schedule management control unit 220 schedules the PE 101 to execute the highest priority task among the tasks scheduled to be executed next. Note that if a group is not set for a task (referred to as a non-group), the task is scheduled based only on priority.

[0045] 5 shows the configuration of each piece of information included in the RTOS data according to this embodiment. As shown in Fig. 5, task management information 230 includes a task group ID (GrID) 231, a task state (Stt) 232, task stack information (Stc) 233, a task start address (Add) 234, and a task priority (Pr) 235.

[0046] The task group ID 231 is identification information that identifies the group to which the task belongs (the shared resource that the task accesses). For example, if the number of groups (shared resources) is x+1, the group ID is 0 to x. x is an arbitrary value that is determined when the user performs the initial setup of the RTOS.

[0047] The task state 232 is information indicating the task state. For example, a bitmap value corresponding to the task state is set in the task state 232. Any one of a Running state, a Suspended state, a Ready state, and a Terminated state is set in the task state 232. The Running state is a state in which the task is being executed (being executed) on the PE 101. The Suspended state is a state in which the task is not being executed (execution has not been requested) on the PE 101. The Ready state is a state in which the task is ready to be executed on the PE 101. The Terminated state is a state in which the task is not ready to be executed on the PE 101.

[0048] The task stack information 233 is a buffer that temporarily stores (stacks) the values ​​of the register 104 used when a task runs on the PE 101. The task start address 234 is information indicating the address of the user application program 112 that the PE 101 reads when starting task processing. The task priority 235 is information indicating the priority value of the task for scheduling. The task priority 235 is, for example, any value from 1 to n. n is an arbitrary maximum priority value, and is generally determined when the user performs initial setup of the RTOS. In this embodiment, priority 1 is the lowest priority, and priority n is the highest priority.

[0049] The schedule management information 240 includes ready task information 241, group highest priority information 242, highest priority information 243, and running task ID 244. The ready task information 241 is the task ID of a task that is in a ready state for each priority. The ready task information 241 is stored, for example, in a structure array for each priority. In the structure array, task IDs of tasks in a ready state with the same priority are linked in the order in which they became ready. Each structure stores the task ID of the ready task and address information of a buffer (structure) that stores the task ID of the next ready task (the task that next became ready).

[0050] The group highest priority information 242 is information that indicates the highest priority value among tasks in a ready state for each group. The group highest priority information 242 is stored, for example, in an array from group 0 to group x. If there are no tasks in a ready state in a group, 0 is stored in the group highest priority information 242 for that group.

[0051] The highest priority information 243 is information indicating the highest priority value among tasks in a ready state in the PE 101. If there is no task in a ready state in the PE 101, 0 is stored in the highest priority information 243. The running task ID 244 is the task ID of a task in a running state in the PE 101. If there is no task in a running state, 0 is stored in the running task ID 244.

[0052] The running group management information 250 is information indicating the group to which a task currently being executed belongs in one of the PEs 101 of the multiprocessor system 100. The running group management information 250 is configured, for example, as a bitmap table in which one bit is assigned to each of groups 0 to x. A 1 is set in a predetermined bit corresponding to a group among groups 0 to x in which a task in a Running state exists on the multiprocessor system 100. A 0 is set in a predetermined bit corresponding to a group among groups 0 to x in which no task in a Running state exists on the multiprocessor system.

[0053] 6 shows the configuration of the task management control unit 210 and schedule management control unit 220 included in the RTOS function 111a according to this embodiment. As shown in Fig. 6, the task management control unit 210 includes a storage unit 211, a restoration unit 212, and a startup unit 213. The schedule management control unit 220 includes a group determination unit 221, a group update unit 222, and a schedule update unit 223.

[0054] The storage unit 211 is called by the user application program 112 and stores the status of the requested task and information held in the register 104 of the PE 101 in the task management information 230. The storage unit 211 updates the schedule management information 240 and the active group management information 250 based on the stored task management information 230. The storage unit 211 also calls the group determination unit 221 of the schedule management control unit 220 and requests task scheduling.

[0055] The group determination unit 221 determines the group of the next task to be started in response to a call from the storage unit 211. The group determination unit 221 determines a group of executable tasks as an executable group based on the running group management information 250 and the schedule management information 240. The group determination unit 221 refers to the running group management information 250 and determines a group in which no task is being executed by any of the PEs 101 as an executable group.

[0056] The group update unit 222 updates the in-execution group management information 250 of the corresponding group based on the task group determined by the group determination unit 221. The group update unit 222 determines the task ID of the task to be started next within the corresponding group based on the schedule management information 240. Since the schedule management information 240 is updated based on the task management information 230, the group update unit 222 may refer to the schedule management information 240 and the task management information 230 to determine the task to be started next. The schedule management information 240 may refer to the task management information 230 and determine the task associated with the executable group as the task to be started next on any one of the PEs 101. Also, the schedule management information 240 may refer to the task management information 230 and determine, among the tasks associated with the executable group, the task executable on any one of the PEs 101 as the task to be started next on any one of the PEs 101. Furthermore, the schedule management information 240 may refer to the task management information 230 and determine, among the tasks associated with the executable group, the task executable on any one of the PEs 101 and having the highest priority as the task to be started next on any one of the PEs 101.

[0057] The schedule update unit 223 updates the schedule management information 240 based on the task ID acquired by the group update unit 222. Also, the schedule update unit 223 calls the return unit 212 of the task management control unit 210 and requests the start of a task.

[0058] The return unit 212 returns the information necessary for starting the requested task in response to the call from the schedule update unit 223. The return unit 212 returns the register information stored in the task management information 230 of the task to be started to the register 104 of the PE 101. The start unit 213 starts the task on the PE 101 based on the information returned by the return unit 212.

[0059] <RTOS Initial Settings> Next, a data initial setting method according to this embodiment will be described. Fig. 7 shows a configuration for generating RTOS data according to this embodiment. As shown in Fig. 7, the RTOS data 121 is generated and initialized in advance by a generating device 302 using an RTOS initial setting file 301.

[0060] The RTOS initial setting file 301 is a configuration file created by the user for initial setting of the RTOS. The RTOS initial setting file 301 describes the priority and group of each task, the maximum priority of a task, the number of task groups, etc., set by the user.

[0061] The generating device 302 is a configurator that generates the RTOS data 121 based on the RTOS initial setting file 301. The generating device 302 reads the RTOS initial setting file 301 set by the user, and generates and initializes the RTOS data 121 based on the read RTOS initial setting file 301. The generating device 302 is also connected to the multiprocessor system 100 (semiconductor device), and writes the generated RTOS data 121 to the data area 120 of the memory 102 of the multiprocessor system 100.

[0062] The generating device 302 generates and initializes the task management information 230, schedule management information 240, and running group management information 250 included in the RTOS data 121. The generating device 302 generates the same number of task management information 230 as the number of tasks described in the RTOS initialization file 301, and initializes each piece of task management information 230 based on the definition of each described task. For example, the generating device 302 sets the task group ID 231 of the task management information 230 based on the task group definition described in the RTOS initialization file 301. The generating device 302 sets the task priority 235 of the task management information 230 based on the task priority definition described in the RTOS initialization file 301. The generating device 302 also initializes the task state 232, task stack information 233, and task start address 234 of the task management information 230.

[0063] Furthermore, the generating device 302 generates the same number of schedule management information 240 as the number of processor elements described in the RTOS initial setting file 301, and initializes each schedule management information 240 based on the definition of each described processor element. For example, the generating device 302 generates a structure array of ready task information 241 in the schedule management information 240 based on the definition of the highest task priority in the RTOS initial setting file 301, and sets an initial value (0) to the generated structure array. The generating device 302 generates an array of group highest priority information 242 in the schedule management information 240 based on the definition of the number of task groups in the RTOS initial setting file 301, and sets an initial value (0) to the generated array. The generating device 302 also sets initial values ​​to the highest priority information 243 and running task ID 244 in the schedule management information 240.

[0064] Furthermore, the generating device 302 generates the running group management information 250 and initializes the running group management information 250 based on the description in the RTOS initial setting file 301. For example, the generating device 302 generates a bitmap of the running group management information 250 based on the definition of the number of task groups in the RTOS initial setting file 301, and sets an initial value (0) in the generated bitmap.

[0065] <System Operation> Next, the operation method of the system according to this embodiment will be described with reference to a flowchart shown in FIG.

[0066] 8, first, in S100, the task management control unit 210 saves register information of a task. That is, when the saving unit 211 is called from the user application program 112, it acquires information held in the register 104 of the PE 101 that is used by the running task requested by the call (for example, a stop request). The saving unit 211 also saves the acquired information of the register 104 in the task stack information 233 in the task management information 230 of the corresponding task. The information of the register 104 that the task uses also includes an address to which the register 104 is restored when the processing of the task is resumed.

[0067] Next, in S101, the task management control unit 210 updates the task state. That is, the storage unit 211 updates the task state 232 in the task management information 230 of the requested task currently being executed from the running state to another state (for example, the suspended state) in response to the request.

[0068] Next, in S102, the task management control unit 210 updates the running group management information 250 and the schedule management information 240 in accordance with the update of the task state. If the processing of the storage unit 211 has been called by a task stop request from the user application program 112, the storage unit 211 performs the update processing as follows. That is, the storage unit 211 updates the bit map of the running group management information 250 by setting to 0 the bit corresponding to the group to which the task that was running until just before (the requested task) belongs. In addition, the storage unit 211 deletes the task ID of the task that was running until just before from the ready task information 241 in the schedule management information 240 of the PE 101 in which the task was running until just before. Furthermore, the storage unit 211 sets the running task ID 244 in the schedule management information 240 to 0.

[0069] On the other hand, if the storage unit 211 has been called by a task activation request from the user application program 112, the storage unit 211 performs registration processing as follows. That is, the storage unit 211 registers the task ID of the task for which the activation request has been made in ready task information 241 in the schedule management information 240 of the PE 101 that executes the task for which the activation request has been made. The storage unit 211 refers to the task priority 235 in the task management information 230 of the task, and registers the task ID of the task for which the activation request has been made in the ready task information 241 of the corresponding priority.

[0070] Furthermore, in the case of a startup request, the storage unit 211 references the highest priority information 243 in the schedule management information 240, and compares the highest priority information 243 with the task priority 235 in the task management information 230 of the task for which startup is requested. If the task priority 235 of the task is higher than the highest priority information 243, the storage unit 211 updates the value of the highest priority information 243 in the schedule management information 240 to the value of the task priority 235 of the task for which startup is requested. Furthermore, if the highest priority information 243 and the task priority 235 of the task are the same, or if the task priority 235 of the task is lower than the highest priority information 243, the storage unit 211 does not update the highest priority information 243 in the schedule management information 240.

[0071] Furthermore, in the case of a startup request, the storage unit 211 references the group highest priority information 242 in the schedule management information 240. By this reference, the storage unit 211 compares the group highest priority information 242 of the task group for which the startup request has been made with the task priority 235 in the task management information 230 of the task for which the startup request has been made. If the task priority 235 is higher than the group highest priority information 242, the storage unit 211 updates the value of the group highest priority information 242 of the task group for which the startup request has been made to the value of the task priority 235 of the task for which the startup request has been made. Furthermore, if the group highest priority information 242 and the task priority 235 are the same or if the task priority 235 is lower than the group highest priority information 242, the storage unit 211 does not update the group highest priority information 242.

[0072] Next, in S103, the schedule management control unit 220 identifies a group of executable tasks as an executable group, and in S104 determines whether or not an executable group exists. That is, when the group determination unit 221 is called, for example, from the storage unit 211 or the idle handler, it references the running group management information 250. By this reference, if any bit in the bitmap of the running group management information 250 is set to 0, the group determination unit 221 identifies the group corresponding to the bit position that is set to 0. Furthermore, the group determination unit 221 references the group highest priority information 242 in the schedule management information 240 of the PE 101 that responded to the call. By this reference, the group determination unit 221 confirms the value of the highest priority corresponding to the identified group.

[0073] If the value of the highest group priority information 242 for the identified group is 0, there is no task that is ready to be executed and belongs to the group. Therefore, the group determination unit 221 again refers to the running group management information 250 and searches for bit positions that are 0. Furthermore, if all bits in the running group management information 250 are 1, the group determination unit 221 determines in S104 that no executable group exists. Alternatively, if all of the highest group priority information 242 for the group are 0, the group determination unit 221 determines in S104 that no executable group exists. In this case, the group determination unit 221 transitions the process to S105. Furthermore, if the bit for the group in the running group management information 250 is 0 and the value of the highest group priority information 242 for the group is not 0, the group determination unit 221 determines in S104 that a executable group exists. That is, if there is no task currently being executed in the group and there is a task in a ready state in the group, the group determination unit 221 determines in S104 that an executable group exists. In this case, the group determination unit 221 transitions the process to S106.

[0074] In S105, the schedule management control unit 220 transitions the process to the idle handler. That is, since there is no task that can be started, the group determination unit 221 transitions the process to the idle handler. When the process of the idle handler is completed, the process returns to S103.

[0075] Furthermore, in S106, the schedule management control unit 220 updates the active group management information and identifies the task ID of the task to be started. That is, if it is determined that an executable group exists, the group update unit 222 refers to the determined schedule management information 240. By this reference, the group update unit 222 compares the group highest priority information 242 and the highest priority information 243 of the group identified in S103. If the group highest priority information 242 and the highest priority information 243 match, the group update unit 222 sets to 1 the bit corresponding to the group identified in S103 in the bitmap of the active group management information 250.

[0076] Furthermore, if the highest group priority information 242 and the highest priority information 243 of the group identified in S103 do not match, the group update unit 222 performs the following process. That is, the group update unit 222 references the task group ID 231 in the task management information 230 of the task that corresponds to the highest priority information 243 among the tasks in the ready task information 241 of the schedule management information 240. Through this reference, the group update unit 222 determines whether the bit corresponding to the task group ID 231 of the task in question in the bitmap of the running group management information 250 is set to 0. If the corresponding bit in the running group management information 250 is 0, the group update unit 222 sets the bit to 1. Furthermore, if the corresponding bit in the running group management information 250 has already been set to 1, the group update unit 222 references the group ID of the next task of the same priority from the ready task information 241 of the schedule management information 240, and repeats the above-described determination process. When all references to the task group ID 231 of the task corresponding to the highest priority information 243 have been completed, the group update unit 222 moves the reference destination to the ready task information 241 of the next priority and repeats the above-mentioned determination process. Thereafter, the determination process is repeated until the group highest priority information 242 of the group identified in S103 matches the priority value of the reference destination. The group update unit 222 repeats this determination process to identify the group of the task to be started next and the task ID of the task.

[0077] Next, in S107, the schedule management control unit 220 updates the running task ID with the identified task ID. That is, the schedule update unit 223 sets the task ID of the next task to be started, identified in S106, as the running task ID 244 in the schedule management information 240. After completing the setting of the running task ID 244, the schedule update unit 223 calls the task management control unit 210 and transitions the process to S108.

[0078] Next, in S108, the task management control unit 210 restores the register information of the task to the register of the PE. That is, when called by the schedule update unit 223, the restoring unit 212 refers to the task stack information 233 in the task management information 230 of the task identified in S106. By this reference, the restoring unit 212 restores the saved register information of the task to the register 104 of the PE 101 that executes the task.

[0079] Next, in S109, the task management control unit 210 starts the task. That is, when the register information is restored, the starting unit 213 references the task start address 234 in the task management information 230 of the restored task, and starts the task in the corresponding PE 101.

[0080] <Example of system operation> Next, a specific example of the operation method of the system of this embodiment will be described. Figure 9 shows the configuration of a multiprocessor system in this specific example.

[0081] 9, in a specific example, the multiprocessor system 100 includes two PEs 101, PE0 and PE1. The user application program 112 includes a software component SW-C0 executed by PE0 and a software component SW-C1 executed by PE1. The software component SW-C0 includes three tasks T1, T2, and T3 executed by PE0. The software component SW-C1 includes three tasks T4, T5, and T6 executed by PE1. The group of tasks that access the shared resource SRA is group A (GrA), and the group of tasks that access the shared resource SRB is group B (GrB).

[0082] Fig. 10 shows the description of the RTOS initial setting file in a specific example. Fig. 11 shows the initial values ​​of task management information generated from the RTOS initial setting file of Fig. 10. The initial setting values ​​of six tasks T1 to T6 in the specific example are generated by having the generating device 302 read the RTOS initial setting file 301.

[0083] As shown in Fig. 10, the RTOS initial setting file 301 describes the group name and priority of each task. In this specific example, task T1 is defined as group A and priority 6. task T2 is defined as group A and priority 4. task T3 is defined as group B and priority 4. task T4 is defined as group A and priority 4. task T5 is defined as group B and priority 2. task T6 is defined as priority 2, and no group is defined (it is a non-group).

[0084] 11, the generation device 302 generates task management information 230 for each task based on the definition of each task in the RTOS initial setting file 301. In a specific example, task management information 230-1 to 230-6 for tasks T1 to T6 is generated based on the definitions of tasks T1 to T6 in the RTOS initial setting file 301, and each piece of information is initialized. Based on the definitions of the task group and priority, the generation device 302 sets the task group ID 231 and task priority 235 in the task management information 230. The generation device 302 also initializes the task state 232 to the Suspended state (1), and sets the address of the software component SW-C0 or SW-C1 to the task activation address 234.

[0085] In task management information 230-1 for task T1, the task group ID 231 is set to ID (1) indicating group A and the task priority 235 is set to 6, based on the definition of task T1 in RTOS initialization file 301. In task management information 230-2 for task T2, the task group ID 231 is set to ID (1) indicating group A and the task priority 235 is set to 4, based on the definition of task T2 in RTOS initialization file 301. In task management information 230-3 for task T3, the task group ID 231 is set to ID (2) indicating group B and the task priority 235 is set to 4, based on the definition of task T3 in RTOS initialization file 301. In task management information 230-4 for task T4, the task group ID 231 is set to ID (1) indicating group A and the task priority 235 is set to 4, based on the definition of task T4 in RTOS initialization file 301. In task management information 230-5 for task T5, the task group ID 231 is set to ID (2) indicating group B, and the task priority 235 is set to 2, based on the definition of task T5 in RTOS initialization file 301. In task management information 230-6 for task T6, the task group ID 231 is set to ID (0) indicating a non-group, and the task priority 235 is set to 2, based on the definition of task T6 in RTOS initialization file 301.

[0086] In the following, in a specific example, the state transition flow of tasks T1 to T6 initially set as shown in FIG. 11 will be explained in the following order. Case 1: RTOS initialization is complete and all tasks are in the Ready state Case 2: Task T1 in group A is in Running state on PE0 side Case 3: Task T1 of group A is in the Running state on PE0, and task T5 of group B is in the Running state on PE1. Case 4: Task T2 of group A is in the Running state on PE0, and task T5 of group B is in the Running state on PE1. Case 5: Task T2 of group A is in the Running state on PE0, and task T6, which does not belong to any group (non-group), is in the Running state on PE1. Case 6: Task T2 in group A is in the Running state on PE0, and the idle handler is running on PE1. Case 7: Task T3 of group B is in the Running state on PE0, and task T4 of group A is in the Running state on PE1.

[0087] [Case 1: RTOS initialization complete, all tasks are in the Ready state] 12 shows the state of tasks in each PE in case 1. FIGS. 13 and 14 show specific values ​​of each task management information 230, each schedule management information 240, and active group management information 250 in case 1.

[0088] 12, in Case 1, on the PE0 side, task T1 (group A, priority 6), task T2 (group A, priority 4), and task T4 (group B, priority 4) are in the Ready state. On the PE1 side, task T4 (group A, priority 4), task T5 (group B, priority 2), and task T6 (non-group, priority 2) are in the Ready state.

[0089] Specifically, as shown in FIG. 13, on the PE0 side, the task states 232 of tasks T1 to T3 in task management information 230-1 to 230-3 become ready state (2). In schedule management information 240-1 of PE0, task T1 is registered in ready task information 241 with priority 6. Furthermore, tasks T2 and T3 are registered in ready task information 241 with priority 4. As shown in FIG. 14, on the PE1 side, the task states 232 of tasks T4 to T6 in task management information 230-4 to 230-6 become ready state (2). In schedule management information 240-2 of PE1, task T4 is registered in ready task information 241 with priority 4. Furthermore, tasks T5 and T6 are registered in ready task information 241 with priority 2. Furthermore, as shown in FIG. 14, in running group management information 250, the bits for group A and group B are 0.

[0090] In this example, first, in the state of Case 1, the schedule management control unit 220 references the ready task information 241 in the schedule management information 240-1 of PE0 and selects task T1, which has the highest priority of 6, as a candidate task to be started. Next, the schedule management control unit 220 references the task management information 230-1 of the selected task T1 and acquires the task group ID 231 (group A). ​​Next, the schedule management control unit 220 references the running group management information 250 and checks the value of the bit corresponding to group A to which task T1 belongs. Since the bit for group A is 0 in Case 1, the schedule management control unit 220 determines task T1 as the next task to be started and transitions to the state of Case 2.

[0091] [Case 2: Task T1 in Group A is in Running state on PE0] Fig. 15 shows the state of tasks in each PE in Case 2. Fig. 16 shows specific values ​​of the task management information 230, schedule management information 240, and running group management information 250 of PE0 in Case 2. The task management information 230 and schedule management information 240 of PE1 in Case 2 are the same as those in Case 1. As shown in Fig. 15, in Case 2, task T1 (group A, priority 6) on the PE0 side changes from the state in Case 1 to the Running state.

[0092] Specifically, when the schedule management control unit 220 determines task T1 as the next task to be activated as described above, it updates the task state 232 of task management information 230-1 for task T1 from Ready to Running, as shown in Fig. 16. Also, the schedule management control unit 220 sets the bit for group A in running group management information 250 to 1, as shown in Fig. 16. Furthermore, the schedule management control unit 220 sets the priority of task T1 to 6 in the highest priority information 243 of schedule management information 240-1 for PE0 and the highest group priority information 242 for group A, as shown in Fig. 16. Also, the schedule management control unit 220 sets task T1 to running task ID 244.

[0093] In this example, in the state of Case 2, the schedule management control unit 220 references the ready task information 241 in the schedule management information 240-2 of PE1 and selects task T4, which has the highest priority of 4, as a candidate task to be started. Next, the schedule management control unit 220 references the task management information 230-4 of task T4 and acquires the task group ID 231 (group A). ​​Next, the schedule management control unit 220 references the running group management information 250 and checks the value of the bit corresponding to group A to which task T4 belongs. In Case 2, the bit for group A is set to 1, so the schedule management control unit 220 determines that task T4 is a task that cannot be started.

[0094] Next, the schedule management control unit 220 references the ready task information 241 in the schedule management information 240-2 and selects task T5, which has the second highest priority of 2 after task T4, as a candidate task to be started. Next, the schedule management control unit 220 references the task management information 230-5 for task T5 and acquires the task group ID 231 (group B). Next, the schedule management control unit 220 references the running group management information 250 and checks the value of the bit corresponding to group B to which task T5 belongs. In case 2, the bit for group B is 0, so the schedule management control unit 220 determines task T5 as the next task to be started and transitions to the state of case 3.

[0095] [Case 3: Task T1 of group A is in the Running state on PE0, and task T5 of group B is in the Running state on PE1] Fig. 17 shows the state of tasks in each PE in Case 3. Fig. 18 shows specific values ​​of the task management information 230, schedule management information 240, and running group management information 250 of PE1 in Case 3. The task management information 230 and schedule management information 240 of PE0 are the same as those in Case 2. As shown in Fig. 17, in Case 3, task T5 (group B, priority 2) on the PE1 side changes from the state in Case 2 to the Running state.

[0096] Specifically, when the schedule management control unit 220 determines task T5 as the next task to be started as described above, it updates the task state 232 of task management information 230-5 of task T5 from Ready to Running, as shown in FIG. 18. Also, as shown in FIG. 18, the schedule management control unit 220 sets the bit for group B in running group management information 250 to 1. Furthermore, as shown in FIG. 18, the schedule management control unit 220 sets the priority of task T4 to 4 in the highest priority information 243 of schedule management information 240-2 of PE1. Also, the schedule management control unit 220 sets the priority of task T5 to 2 in the group highest priority information 242 of group B. Furthermore, the schedule management control unit 220 sets task T5 in the running task ID 244.

[0097] In this example, in the state of Case 3, task T1 in the Running state is terminated on the PE0 side. Then, the task management control unit 210 performs termination processing for task T1. The task management control unit 210 also updates the task management information 230-1 and the running group management information 250 for task T1, and calls the schedule management control unit 220.

[0098] Next, the schedule management control unit 220 references the ready task information 241 in the schedule management information 240-1 of PE0 and selects task T2, which has the next highest priority and is assigned a priority of 4, as a candidate task to be started. Next, the schedule management control unit 220 references the task management information 230-2 for task T2 and acquires the task group ID 231 (group A). ​​Next, the schedule management control unit 220 references the running group management information 250 and checks the value of the bit corresponding to group A to which task T2 belongs. In case 3, when task T1 is completed, the bit for group A in the running group management information 250 is set to 0, so the schedule management control unit 220 determines task T2 as the next task to be started and transitions to the state of case 4.

[0099] [Case 4: Task T2 of group A is in the Running state on PE0, and task T5 of group B is in the Running state on PE1] Fig. 19 shows the state of tasks in each PE in Case 4. Fig. 20 shows specific values ​​of the task management information 230, schedule management information 240, and running group management information 250 of PE0 in Case 4. The task management information 230 and schedule management information 240 of PE1 in Case 4 are the same as those in Case 3. As shown in Fig. 19, in Case 4, task T1 (group A, priority 6) on the PE0 side changes from the state in Case 3 to the Suspended state (deleted in the figure), and task T2 (group A, priority 2) changes to the Running state.

[0100] Specifically, when task T1 ends as described above, the task management control unit 210 updates the task state 232 of task T1's task management information 230-1 from Running to Suspended, as shown in Figure 20. The task management control unit 210 also sets the bit for group A in the running group management information 250 to 0. Furthermore, the task management control unit 210 deletes task T1 from ready task information 241 in the schedule management information 240-1 of PE0, and sets the running task ID 244 to 0.

[0101] Furthermore, when the schedule management control unit 220 determines task T2 as the next task to be activated as described above, it updates the task state 232 of task management information 230-2 of task T2 from Ready state to Running state, as shown in Fig. 20. Also, the schedule management control unit 220 sets the bit for group A in running group management information 250 to 1, as shown in Fig. 20. Furthermore, the schedule management control unit 220 sets the priority of task T2 to 4 in the highest priority information 243 of schedule management information 240-1 of PE0 and the highest group priority information 242 of group A, as shown in Fig. 20. Also, the schedule management control unit 220 sets task T2 to the running task ID 244.

[0102] In this example, in the state of Case 4, task T5 in the Running state is terminated on the PE1 side. The task management control unit 210 then performs termination processing for task T5. The task management control unit 210 also updates the task management information 230-5 and the running group management information 250 for task T5, and calls the schedule management control unit 220.

[0103] Next, the schedule management control unit 220 references the ready task information 241 in the schedule management information 240-2 of PE1 and selects task T4, which has the highest priority of 4, as a candidate task to be started. Next, the schedule management control unit 220 references the task management information 230-4 for task T4 and acquires the task group ID 231 (group A). ​​Next, the schedule management control unit 220 references the running group management information 250 and checks the value of the bit corresponding to group A to which task T4 belongs. In case 4, since the bit for group A is set to 1, the schedule management control unit 220 determines that task T4 is a task that cannot be started.

[0104] Next, the schedule management control unit 220 references the ready task information 241 in the schedule management information 240-2 and selects task T6, which has the second highest priority after task T4 and is assigned a priority of 2, as a candidate task to be started. Next, the schedule management control unit 220 references the task management information 230-6 for task T6 and acquires the task group ID 231 (non-group). Next, the schedule management control unit 220 confirms that the group ID of task T6 is 0 (non-group). In this case, because task T6 does not operate on a shared resource, the schedule management control unit 220 determines that it is the next task that can be started without reference to the running group management information 250. Therefore, the schedule management control unit 220 determines that task T6 is the next task to be started and transitions to the state of case 5.

[0105] [Case 5: Task T2 of Group A is in the Running state on PE0, and task T6, which does not belong to any group (Non-Group), is in the Running state on PE1] Fig. 21 shows the state of tasks in each PE in Case 5. Fig. 22 shows specific values ​​of the task management information 230, schedule management information 240, and running group management information 250 of PE1 in Case 5. As shown in Fig. 21, in Case 5, from the state in Case 4, task T5 (group B, priority 2) on the PE1 side enters the Suspended state, and task T6 (non-group, priority 2) enters the Running state.

[0106] Specifically, when task T5 ends as described above, the task management control unit 210 updates the task state 232 of task management information 230-5 for task T5 from Running to Suspended, as shown in Fig. 22. Also, the task management control unit 210 sets the bit for group B in running group management information 250 to 0, as shown in Fig. 22. Furthermore, the task management control unit 210 deletes task T5 from ready task information 241 in schedule management information 240-2 for PE1, and sets the running task ID 244 to 0.

[0107] Furthermore, when the schedule management control unit 220 determines task T6 as the next task to be started as described above, it updates the task state 232 of task management information 230-6 for task T6 from Ready to Running, as shown in FIG. 22. Furthermore, the schedule management control unit 220 does not update the bit of the running group management information 250. Furthermore, as shown in FIG. 22, the schedule management control unit 220 does not update the highest priority information 243 of schedule management information 240-2 for PE1. Furthermore, the schedule management control unit 220 sets 0 to the group highest priority information 242 for group B, and sets task T6 to the running task ID 244.

[0108] In this example, in the state of Case 5, task T6 in the Running state is terminated on the PE1 side. The task management control unit 210 then performs termination processing for task T6. The task management control unit 210 also updates the task management information 230-6 and the running group management information 250 for task T6, and calls the schedule management control unit 220.

[0109] Next, the schedule management control unit 220 references the ready task information 241 in the schedule management information 240-2 of PE1 and selects task T4, which has the highest priority of 4, as a candidate task to be started. Next, the schedule management control unit 220 references the task management information 230-4 for task T4 and acquires the task group ID 231 (group A). ​​Next, the schedule management control unit 220 references the running group management information 250 and checks the value of the bit corresponding to group A to which task T4 belongs. In case 5, since the bit for group A is set to 1, the schedule management control unit 220 determines that task T4 is a task that cannot be started.

[0110] Next, the schedule management control unit 220 references the ready task information 241 in the schedule management information 240-2 and confirms that there is no task with the next highest priority after task T4. Since there is no task that can currently be started, the schedule management control unit 220 transitions to the state of Case 6 by proceeding to the start-up process of the idle handler.

[0111] [Case 6: Task T2 of group A is in Running state on PE0, and the idle handler is running on PE1] Fig. 23 shows the state of tasks in each PE in Case 6. Fig. 24 shows specific values ​​of the task management information 230 and schedule management information 240 of PE1 in Case 6. The task management information 230, schedule management information 240, and running group management information 250 of PE0 in Case 6 are the same as those in Case 5. As shown in Fig. 23, in Case 6, task T6 (non-group, priority 2) on the PE1 side becomes suspended from the state in Case 5.

[0112] Specifically, when task T6 ends as described above, the task management control unit 210 updates the task state 232 of task management information 230-6 for task T6 from Running to Suspended, as shown in Fig. 24. The task management control unit 210 does not update the running group management information 250. Furthermore, as shown in Fig. 24, the task management control unit 210 deletes task T6 from ready task information 241 in schedule management information 240-2 for PE1, and sets the running task ID 244 to 0.

[0113] In this example, in the state of Case 6, task T2 in the Running state is terminated on the PE0 side. Then, the task management control unit 210 on the PE0 side performs termination processing for task T2. The task management control unit 210 also updates the task management information 230-2 and the running group management information 250 for task T2, and calls the schedule management control unit 220.

[0114] Next, the schedule management control unit 220 references the ready task information 241 in the schedule management information 240-1 of PE0 and selects task T3, which has the next highest priority and is assigned a priority of 4, as a candidate task to be started. Next, the schedule management control unit 220 references the task management information 230-3 for task T3 and acquires the task group ID 231 (group B). Next, the schedule management control unit 220 references the running group management information 250 and checks the value of the bit corresponding to group B to which task T3 belongs. In case 6, since the bit for group B is 0, the schedule management control unit 220 determines task T3 as the next task to be started and updates the management information.

[0115] Next, the schedule management control unit 220 of PE1, where the idle handler was running, checks again whether there is a task to be started next because the running group management information 250 has been updated by PE0. The schedule management control unit 220 references the ready task information 241 in the schedule management information 240-2 of PE1 and selects task T4, which has the highest priority of 4, as a candidate task to be started. Next, the schedule management control unit 220 references the task management information 230-4 for task T4 and acquires the task group ID 231 (group A). ​​Next, the schedule management control unit 220 references the running group management information 250 and checks the value of the bit corresponding to group A to which task T4 belongs. In case 6, since the bit for group A is 0, the schedule management control unit 220 determines task T4 as the next task to be started and transitions to the state of case 7.

[0116] [Case 7: Task T3 of Group B is in the Running state on PE0, and Task T4 of Group A is in the Running state on PE1] Fig. 25 shows the state of tasks in each PE in Case 7. Figs. 26 and 27 show specific values ​​of each task management information 230, each schedule management information 240, and running group management information 250 in Case 7. As shown in Fig. 25, in Case 7, task T2 (group A, priority 4) on the PE0 side changes from the state in Case 6 to the Suspended state. In addition, task T3 (group B, priority 4) on the PE0 side changes to the Running state, and task T4 (group A, priority 4) on the PE1 side changes to the Running state.

[0117] Specifically, when task T2 ends as described above, the task management control unit 210 updates the task state 232 of task T2 in task management information 230-2 from Running to Suspended, as shown in Figure 26. The task management control unit 210 also sets the bit for group A in running group management information 250 to 0. Furthermore, the task management control unit 210 deletes task T2 from ready task information 241 in schedule management information 240-1 of PE0, and sets the running task ID 244 to 0.

[0118] Furthermore, when the schedule management control unit 220 determines task T3 as the next task to be started as described above, it updates the task state 232 of task management information 230-3 for task T3 from Ready to Running, as shown in Fig. 26. Furthermore, the schedule management control unit 220 sets the bit for group B in running group management information 250 to 1, as shown in Fig. 27. Furthermore, the schedule management control unit 220 sets the priority of task T2 to 4 in the group highest priority information 242 for group B in schedule management information 240-1 for PE0, and sets task T3 in the running task ID 244, as shown in Fig. 26.

[0119] Furthermore, when the schedule management control unit 220 determines task T4 as the next task to be started as described above, it updates the task state 232 of task management information 230-4 of task T4 from Ready state to Running state, as shown in Fig. 27. Also, the schedule management control unit 220 sets the bit for group A in running group management information 250 to 1, as shown in Fig. 27. Furthermore, the schedule management control unit 220 sets the priority of task T4 to 4 in the group highest priority information 242 of group A in schedule management information 240-2 of PE1, and sets task T4 in the running task ID 244, as shown in Fig. 27.

[0120] As described above, in the flow from Case 1 to Case 7, a series of tasks T1 to T6 enters the Running state.

[0121] <Comparison with comparative examples> Fig. 28 shows state transitions when specific example tasks T1 to T6 are scheduled in a multiprocessor system of a comparative example before the application of this embodiment. Fig. 29 shows state transitions when specific example tasks T1 to T6 are scheduled in a multiprocessor system according to this embodiment, as described above.

[0122] 28, in the comparative example, tasks T1, T2, and T4 operate shared resource A, and tasks T3 and T5 operate shared resource B. In this case, since there is a possibility that tasks operating shared resources may run in parallel between PEs, lock acquisition and release processing must be added during task processing. In the comparative example, tasks T1, T2, and T4 require lock A acquisition and release processing for shared resource A, and tasks T3 and T5 require lock B acquisition and release processing for shared resource B.

[0123] In FIG. 28, task T1 of PE0 and task T4 of PE1, which use shared resource A, are executed simultaneously. For example, if task T1 acquires lock A before task T4 and occupies lock A, task T4 cannot acquire lock A. Therefore, even if task T4 acquires lock A, it fails to acquire lock A and enters a retry loop. As a result, task T4 enters a busy-wait state until task T1 releases lock A. Also, task T3 of PE0 and task T5 of PE1, which use shared resource B, are executed simultaneously. For example, if task T5 acquires lock B before task T3 and occupies lock B, task T3 cannot acquire lock B. Therefore, even if task T3 acquires lock B, task T3 enters a busy-wait state until task T5 releases lock B. Thus, in the comparative example, task T3 enters a busy-wait state while another PE is acquiring a lock, resulting in unnecessary consumption of PE resources.

[0124] In contrast, in this embodiment, as shown in FIG. 29, tasks T1, T2, and T4 are grouped as group A because they operate shared resource A, and tasks T3 and T5 are grouped as group B because they operate shared resource B. The RTOS then schedules tasks for each group to exclusively control the activation of each task. Therefore, tasks T1, T2, and T4 are not executed simultaneously. Tasks T3 and T5 are also not executed simultaneously. In FIG. 29, tasks T1 and T2 are executed by PE0, and then task T4 is executed by PE1. After task T5 is executed by PE1, task T3 is executed by PE0. As such, in this embodiment, tasks that operate shared resources do not run in parallel between PEs, so lock acquisition and release processes are not required for the tasks. This prevents PE resources from being wasted, as occurs with busy waiting. Furthermore, because task execution is not interrupted by busy waiting, the accuracy of estimating task execution time, which is one of the system performance indicators, is improved.

[0125] In this embodiment, while a task is being executed in another PE, tasks in the same group are not executed, so there may be cases where task execution is delayed compared to before the embodiment is applied. In FIG. 29, the execution timing of task T4 is delayed compared to the comparative example in FIG. 28. For example, by setting a task to a non-group, the restrictions imposed by task scheduling for each group are eliminated, and tasks can be executed by scheduling based only on priority. Therefore, by dividing task T4 and setting the part that is not related to the operation of shared resource A to a non-group, delays in execution timing can be suppressed.

[0126] <Effects> As described above, in this embodiment, task group information and running task group information are managed in an embedded RTOS that runs on a multiprocessor system. Furthermore, based on this information, tasks on each PE are scheduled in advance to prevent conflicting operations on shared resources. Specifically, the highest priority task that belongs to a group that does not have any tasks in a Running state on the multiprocessor system is selected as the next task to be started.

[0127] This allows tasks to be scheduled in a way that prevents conflicting operations on shared resources in a multiprocessor system, eliminating the need for software developers to consider exclusive control of tasks. In other words, there is no need to add spinlocks (lock acquisition and release processes) to tasks. Therefore, by using the RTOS of this embodiment, tasks that run on a single processor can be run on a multiprocessor as is, allowing application programs to be reused.

[0128] (Embodiment 2) Next, a description will be given of a multiprocessor system according to embodiment 2. In this embodiment, the scheduling function of the OS performs exclusive control for each group including tasks and interrupt processes that access shared resources.

[0129] <System configuration> 30 shows the hardware configuration of a multiprocessor system according to this embodiment. As shown in FIG. 30, a multiprocessor system 100 according to this embodiment further includes an interrupt controller (INTC) 105 in addition to the configuration of the first embodiment.

[0130] The interrupt controller 105 is connected to the bus 103. The interrupt controller 105 can access the multiple PEs 101 and the memory 102 via the bus 103. The interrupt controller 105 controls interrupts generated in the multiprocessor system 100. The interrupts include hardware and software interrupts. When an interrupt occurs, the interrupt controller 105 can input an interrupt request to all PEs 101a to 101n. When an interrupt request is input, each PE 101 executes an interrupt service routine (ISR) corresponding to the interrupt cause. For example, the interrupt service routine is included in the RTOS 111, and an interrupt service routine corresponding to the interrupt request (interrupt cause) is called and executed. In this embodiment, interrupt service routines (interrupt causes) that access shared resources are grouped by shared resource. The grouping is the same as the grouping of tasks in the first embodiment. For example, a task and an interrupt service routine that accesses the shared resource SR1 are grouped together as group 1.

[0131] The interrupt controller 105 also includes an interrupt mask register (MREG) 106. The interrupt mask register 106 holds an interrupt mask. The interrupt mask is a mask bit that sets whether or not to accept an interrupt (enable or disable) for each interrupt cause. When a bit corresponding to an interrupt cause is set to 1, the interrupt request for that interrupt cause is disabled, and when a bit corresponding to an interrupt cause is set to 0, the interrupt request for that interrupt cause is enabled. The interrupt mask register 106 can be set by all of the PEs 101a to 101n. The interrupt controller 105 inputs the interrupt request to the PE 101 if the interrupt cause of the generated interrupt is enabled according to the value of the interrupt mask register 106, and reserves the interrupt request if the interrupt cause of the generated interrupt is disabled.

[0132] 31 shows the functional configuration of the RTOS and the data configuration of the RTOS data according to this embodiment. As shown in Fig. 31, the RTOS data 121 further includes interrupt management information 420 and interrupt cause group information 430 in addition to the configuration of the first embodiment.

[0133] The interrupt management information 420 is information for managing interrupt service routines. One piece of interrupt management information 420 is assigned to each interrupt service routine. The interrupt management information 420 includes the priority of the interrupt service routine, identification information for the group of shared resources used by the interrupt service routine, etc. The interrupt management information 420 associates this information with the interrupt service routine.

[0134] The interrupt cause group information 430 is information indicating the group of each interrupt cause. One interrupt cause group information 430 is assigned to each PE 101. The interrupt cause group information 430 includes information indicating the interrupt cause executed by the PE 101 for each group. The interrupt cause group information 430 associates the interrupt cause with the group.

[0135] In this embodiment, the running group management information 250 is information for managing groups of running interrupt service routines in addition to groups of tasks running in the multiprocessor system 100. The running group management information 250 includes information indicating whether or not there is a task or interrupt service routine running for each group in the multiprocessor system 100.

[0136] The RTOS function 111a further includes an interrupt management control unit 410 in addition to the configuration of the first embodiment. The interrupt management control unit 410 manages and controls the operation of the interrupt service routine in the PE 101. The interrupt management control unit 410 is called by the task management control unit 210. The interrupt management control unit 410 acquires interrupt cause group information 430 according to the group of the task executed by the PE 101. Based on this acquisition, the interrupt management control unit 410 updates the interrupt mask register 106 to control the operation of the interrupt service routine. The interrupt management control unit 410 is also called in response to an interrupt request, and controls the operation of the interrupt service routine in response to the request. The interrupt management control unit 410 acquires the interrupt cause group information 430 and sets the running group management information 250.

[0137] The interrupt management control unit 410, together with the task management control unit 210, manages the execution states of tasks that access shared resources in the multiprocessor system 100 and the execution states of interrupt service routines (interrupt processes) that access shared resources. The interrupt management control unit 410 and the task management control unit 210 use the running group management information 250 to manage whether tasks that access shared resources and interrupt service routines that access shared resources are being executed in all PEs 101. The interrupt management control unit 410 and the task management control unit 210 also manage the execution states of tasks that access shared resources for each group and the execution states of interrupt service routines that access shared resources for each group. For example, the interrupt management control unit 410 and the task management control unit 210 manage the execution states of tasks in group 1 that access shared resource SR1 and the execution states of interrupt service routines in group 1 that access shared resource SR1. The interrupt management control unit 410 and the task management control unit 210 also manage the execution states of tasks in group 2 that access shared resource SR2 and the execution states of interrupt service routines in group 2 that access shared resource SR2.

[0138] The interrupt management control unit 410, together with the schedule management control unit 220, determines the next task to be executed in the PE 101 and the interrupt service routine for the next interrupt that will occur. This determination is made based on the execution status of the task that accesses the shared resource and the execution status of the interrupt service routine that accesses the shared resource. When a task that accesses the shared resource and an interrupt service routine that accesses the shared resource are not being executed in all PEs 101, the interrupt management control unit 410 and the schedule management control unit 220 schedule the PE 101 to execute the next task to be executed. When a task that accesses the shared resource or an interrupt service routine that accesses the shared resource is being executed in any PE 101, the interrupt management control unit 410 and the schedule management control unit 220 schedule the PE 101 to suspend execution of the next task to be executed. When executing a task that accesses the shared resource, the interrupt management control unit 410 sets the interrupt mask register 106 to prohibit execution (acceptance) of an interrupt service routine that accesses the shared resource. When execution of the task that accesses the shared resource is completed, the interrupt management control unit 410 sets the interrupt mask register 106 to cancel the prohibition on execution of the interrupt service routine that accesses the shared resource.

[0139] The interrupt management control unit 410 and the schedule management control unit 220 also determine the task of the group to be executed next in the PE 101 and the interrupt service routine for the next interrupt of the group to occur. This determination is made based on the execution status of the tasks for each group and the execution status of the interrupt service routine for each group. For example, the interrupt management control unit 410 and the schedule management control unit 220 determine the task of the group 1 to be executed next in the PE 101 and the processing of the next interrupt of the group 1 to occur based on the execution status of the tasks of the group 1 and the execution status of the interrupt service routine of the group 1. The interrupt management control unit 410 and the schedule management control unit 220 also determine the task of the group 2 to be executed next in the PE 101 and the processing of the next interrupt of the group 2 to occur based on the execution status of the tasks of the group 2 and the execution status of the interrupt service routine of the group 2. The interrupt management control unit 410 and the schedule management control unit 220 determine whether the tasks of the group that access the shared resource and the interrupt service routine of the group that accesses the shared resource are currently being executed in all PEs 101. If the group is not being executed by all PEs 101, the interrupt management control unit 410 and the schedule management control unit 220 schedule the PEs 101 to execute the next task of the group that is scheduled to be executed. Furthermore, if any of the PEs 101 is executing a task of the group or an interrupt service routine of the group, the interrupt management control unit 410 and the schedule management control unit 220 schedule the PEs 101 to suspend execution of the next task of the group that is scheduled to be executed. When executing a task belonging to the group, the interrupt management control unit 410 sets the interrupt mask register 106 to prohibit execution of the interrupt service routine of the group. Furthermore, when execution of the task belonging to the group has ended, the interrupt management control unit 410 sets the interrupt mask register 106 to cancel the prohibition on execution of the interrupt service routine of the group.

[0140] FIG. 32 shows the configurations of the running group management information 250, the interrupt management information 420, and the interrupt cause group information 430 included in the RTOS data according to this embodiment.

[0141] As in the first embodiment, the running group management information 250 is configured as a bitmap table in which a bit is assigned to each group. In this embodiment, the running group management information 250 indicates the group to which the currently running task belongs or the group of the currently running interrupt service routine in any one of the PEs 101 in the multiprocessor system 100. In the running group management information 250, 1 is set in a predetermined bit corresponding to a group in which a running task or interrupt service routine exists on the multiprocessor system 100. In addition, in the running group management information 250, 0 is set in a predetermined bit corresponding to a group in which no running task or interrupt service routine exists on the multiprocessor system 100.

[0142] The interrupt management information 420 includes an interrupt group ID (GrID) 421, an interrupt activation address (Add) 422, and an interrupt initial priority (Pr) 423. The interrupt group ID 421 is identification information that identifies the group to which the interrupt service routine belongs (the shared resource to be accessed). The interrupt activation address 422 is information that indicates the address of the interrupt service routine that is read when processing of the interrupt service routine starts on the PE 101. The interrupt initial priority 423 is information that indicates the initial value of the priority of the interrupt service routine.

[0143] The interrupt cause group information 430 is configured with a bitmap table of interrupt causes for each group. The bitmap table includes a bitmap in which one bit is assigned to each of all interrupt causes (for example, interrupt cause 0 to interrupt cause k) managed by the interrupt controller 105 of the multiprocessor system 100. One bitmap table exists for each group. In the bitmap of the group to which each interrupt cause belongs, a 1 is set to the bit corresponding to the interrupt cause. In other words, the interrupt cause group information 430 is information indicating the group to which each interrupt cause belongs. The group to which each interrupt cause belongs is determined by the user when the RTOS 111 is initialized.

[0144] 33 shows the configuration of the interrupt management control unit 410 included in the RTOS function 111a according to this embodiment. As shown in FIG. 33, the interrupt management control unit 410 includes a group information acquisition unit 411, a reception setting unit 412, an interrupt activation unit 413, and an interrupt return unit 414.

[0145] The group information acquisition unit 411 is called from the storage unit 211 of the task management control unit 210 or the schedule update unit 223 of the schedule management control unit 220. In response to this call, the group information acquisition unit 411 refers to the running group management information 250 to determine the group in which the task or interrupt service routine is running. The group information acquisition unit 411 refers to the interrupt factor group information 430 to acquire the interrupt factor group information 430 of the corresponding group. The reception setting unit 412 changes the setting of interrupt request reception based on the acquired interrupt factor group information 430. When specifying the executable group, the group information acquisition unit 411 and the reception setting unit 412 may refer to the interrupt management information 420 to prohibit the interrupt processing associated with the group. When specifying the executable group, the group information acquisition unit 411 and the reception setting unit 412 may refer to the interrupt factor group information 430 to prohibit the interrupt processing of the interrupt factors associated with the group. When scheduling a task, after the interrupt mask register 106 is set by the reception setting unit 412, the group determination unit 221 of the schedule management control unit 220 or the return unit 212 of the task management control unit 210 is called.

[0146] Also, when an interrupt request is received from the interrupt controller 105, after the interrupt mask register 106 is set by the reception setting unit 412, the interrupt activation unit 413 activates an interrupt service routine in response to the received interrupt request. The interrupt return unit 414 returns the processing to the interrupt source after the end of the interrupt service routine. <​​​​​​​​The generating device 302 initializes the task management information 230, the schedule management information 240, and the active group management information 250, as in the first embodiment, and also initializes the interrupt management information 420 and the interrupt cause group information 430.

[0149] The RTOS initialization file 301 describes the group of each interrupt service routine, the initial priority of each service routine, and the group of each interrupt cause, all set by the user. The generation device 302 sets the interrupt group ID 421 of the interrupt management information 420 based on the group of the interrupt service routine in the RTOS initialization file 301. The generation device 302 also sets the initial interrupt priority 423 of the interrupt management information 420 based on the initial priority of the interrupt service routine in the RTOS initialization file 301. The generation device 302 also sets the interrupt cause group information 430 based on the group of the interrupt cause in the RTOS initialization file 301.

[0150] <System Operation> Next, the operation method of the system of this embodiment will be described. Figure 34 is a flowchart showing the operation method of the multiprocessor system according to this embodiment. In this embodiment, S110 and S111 are added between S102 and S103 compared to the flowchart of embodiment 1. Also, S112 and S113 are added between S107 and S108. The processing added from embodiment 1 will be described.

[0151] Following S102, in S110, the interrupt management control unit 410 acquires the interrupt cause group information 430. That is, the group information acquisition unit 411 is called by the storage unit 211 after S102. In response to this call, the group information acquisition unit 411 refers to the running group management information 250 and identifies the bit position where 1 is set, thereby identifying the group in which an enabled running task or interrupt service routine exists. Next, the group information acquisition unit 411 acquires the interrupt cause group information 430 corresponding to the group of the running task or the running interrupt service routine. If there are multiple groups to which the running task or the running interrupt service routine belongs, the group information acquisition unit 411 acquires the interrupt cause group information 430 corresponding to all of the groups. If there is no group in which a running task or a running interrupt service routine exists, the group information acquisition unit 411 does not acquire the interrupt cause group information 430.

[0152] Next, in S111, the interrupt management control unit 410 sets the interrupt mask register 106. That is, the reception setting unit 412 performs a logical OR operation on all of the interrupt cause group information 430 acquired in S110. The reception setting unit 412 sets the bit of the operation result in the interrupt mask register 106 of the interrupt controller 105. This prohibits the acceptance of interrupts of the corresponding group. That is, when called by a task stop request, the acceptance of interrupts of the group of the stopped task is permitted (prohibition is lifted), and the acceptance of interrupts of the group of the currently running task is prohibited. Thereafter, in S103 and onwards, executable groups and tasks are identified.

[0153] Also, following S107, in S112, similar to S110, the interrupt management control unit 410 acquires the interrupt cause group information 430. That is, the group information acquisition unit 411 is called by the schedule update unit 223 after S107. In response to this call, the group information acquisition unit 411 refers to the running group management information 250 and identifies the bit position where 1 is set, thereby identifying the group in which an enabled running task or interrupt service routine exists. Next, the group information acquisition unit 411 acquires the interrupt cause group information 430 corresponding to the group of the running task or the running interrupt service routine.

[0154] Next, in S113, similarly to S111, the interrupt management control unit 410 sets the interrupt mask register 106. That is, the reception setting unit 412 performs a logical OR operation on all of the interrupt cause group information 430 acquired in S112. The reception setting unit 412 sets the bit of the operation result in the interrupt mask register 106 of the interrupt controller 105. This prohibits the reception of interrupts of the corresponding group. That is, the reception of interrupts of the group of the task to be started and the group currently being executed is prohibited. Thereafter, in S108 and subsequent steps, the task is started.

[0155] In this embodiment, when starting and ending an interrupt service routine, it is necessary to update the interrupt acceptance permission / prohibition setting and the running group management information based on the interrupt group information added in this embodiment. Figure 35 is a flowchart showing the operation method when starting and ending an interrupt service routine according to this embodiment. Note that when multiple interrupt requests occur, the following processing is performed in descending order of the interrupt service routine's initial interrupt priority 423.

[0156] First, in S200, the interrupt management control unit 410 refers to the group ID of the interrupt service routine. That is, the interrupt management control unit 410 accepts an interrupt request from the interrupt controller 105 and starts the interrupt service routine. At this time, the group information acquisition unit 411 refers to the interrupt management information 420 of the requested interrupt service routine and identifies the interrupt group ID 421 of the interrupt service routine.

[0157] Next, in S201, the interrupt management control unit 410 acquires the interrupt cause group information 430. That is, the group information acquisition unit 411 acquires the interrupt cause group information 430 of the group corresponding to the identified group ID 421.

[0158] Next, in S202, the interrupt management control unit 410 sets the interrupt mask register 106. That is, the acceptance setting unit 412 sets the bit of the interrupt cause group information 430 of the acquired group in the interrupt mask register 106 of the interrupt controller 105. This prohibits the acceptance of interrupts of the corresponding group.

[0159] Next, in S203, the interrupt management control unit 410 sets the active group management information 250. That is, the reception setting unit 412 refers to the active group management information 250 and sets to 1 the bit corresponding to the group of the interrupt service routine to be started.

[0160] Next, in S204, the interrupt management control unit 410 starts the interrupt service routine. That is, the interrupt start unit 413 refers to the interrupt management information 420 of the interrupt service routine, acquires the interrupt start address 422 of the interrupt service routine, and starts the interrupt service using the acquired address.

[0161] Next, in S205, the interrupt management control unit 410 acquires the interrupt cause group information 430. That is, when the interrupt service routine is completed, the group information acquisition unit 411 refers to the interrupt management information 420 of the completed interrupt service routine and identifies the interrupt group ID 421 of the interrupt service routine. The group information acquisition unit 411 acquires the interrupt cause group information 430 of the group corresponding to the identified group ID 421.

[0162] Next, in S206, the interrupt management control unit 410 sets the interrupt mask register 106. That is, the acceptance setting unit 412 inverts the bit of the interrupt cause group information 430 of the acquired group, and sets the inverted bit in the interrupt mask register 106 of the interrupt controller 105. This allows acceptance of interrupts of the corresponding group (cancels the prohibition of acceptance).

[0163] Next, in S207, the interrupt management control unit 410 sets the active group management information 250. That is, the reception setting unit 412 refers to the active group management information 250 and sets the bit corresponding to the group of the completed interrupt service routine to 0.

[0164] Next, in S208, the interrupt management control unit 410 returns to the process that caused the interrupt. That is, the interrupt return unit 414 returns to the user routine (task or ISR) that accepted the interrupt request. For example, if an interrupt occurs during task execution, the registers and addresses of the task are saved to a stack, and when the interrupt ends, the registers are restored and the process is resumed from the saved address.

[0165] <Comparison with Embodiment 1> Figure 36 shows task state transitions when tasks T1 to T5 similar to the above specific example are executed and competing interrupts occur in a multiprocessor system according to embodiment 1. Figure 37 shows task state transitions when tasks T1 to T5 similar to Figure 36 are executed and competing interrupts occur in a multiprocessor system according to embodiment 2.

[0166] As shown in FIG. 36, in the first embodiment, tasks T1, T2, and T4 belong to group A because they operate shared resource A, and tasks T3 and T5 belong to group B because they operate shared resource B. For this reason, T1, T2, and T4 are scheduled not to be executed simultaneously, and T3 and T5 are scheduled not to be executed simultaneously. However, in the first embodiment, contention for the shared resource caused by interrupt service routines is not taken into consideration. As shown in FIG. 36, if an interrupt for an interrupt service routine (ISR1) that operates shared resource A occurs simultaneously with task T1 that operates shared resource A, contention for shared resource A occurs, and it is not possible to prevent destruction of shared resource A.

[0167] In contrast, in this embodiment, as shown in FIG. 37, when a task is started, interrupt acceptance from the same group as the task is prohibited, and when the task is terminated, the prohibition on interrupt acceptance is lifted. This prevents interrupt service routines and tasks belonging to the same group from running in parallel between PEs. In FIG. 37, when tasks T1 and T4 are started, interrupt acceptance from group A is prohibited, and when tasks T1 and T4 are terminated, interrupt acceptance from group A is permitted. When tasks T3 and T5 are started, interrupt acceptance from group B is prohibited, and when tasks T3 and T5 are terminated, interrupt acceptance from group B is permitted. The interrupt service routine (ISR1) operates shared resource A, so it is placed in group A and is not executed simultaneously with tasks T1 and T4. In FIG. 37, an interrupt occurs while task T1 is executing. However, because interrupt acceptance from group A is prohibited, the interrupt request is put on hold. After task T1 is terminated and interrupt acceptance from group A is permitted, the pending interrupt request is accepted and the interrupt service routine is executed. This prevents conflicts over shared resources caused by interrupt service routines, and eliminates the need for additional exclusion processing in application programs that operate shared resources from interrupt service routines. Furthermore, because task execution is not interrupted by interrupts, the accuracy of task execution time estimation is further improved. In this embodiment, too, by setting the interrupt service routine (interrupt cause) to non-group, restrictions imposed by task scheduling for each group are eliminated, allowing the interrupt service routine to be executed by priority-only scheduling.

[0168] <Effects> As described above, in this embodiment, the running group management information of the first embodiment is expanded to include group information of running tasks or interrupt service routines, and group information of interrupt causes and interrupt management information are added. The interrupt management control unit then references this information, and if a running task or interrupt service routine exists at the time of task scheduling, sets a prohibition on acceptance of interrupt service routines belonging to the same group. Furthermore, the highest priority task belonging to a group that does not have a running task or interrupt service routine on the multiprocessor system is selected as the next task to be started.

[0169] This eliminates the need for software developers to consider exclusive control not only for tasks but also for interrupt service routines, allowing software developers to reuse application programs that operate shared resources from interrupt service routines in multiprocessor systems without adding spinlocks to tasks and interrupt service routines that run on single-core processors.

[0170] The above-described program can be stored and supplied to a computer using various types of non-transitory computer-readable media. Non-transitory computer-readable media include various types of tangible storage media. Examples of non-transitory computer-readable media include magnetic storage media (e.g., flexible disks, magnetic tapes, hard disk drives), magneto-optical storage media (e.g., magneto-optical disks), CD-ROMs (Read Only Memory), CD-Rs, CD-R / Ws, and semiconductor memories (e.g., mask ROMs, PROMs (Programmable ROMs), EPROMs (Erasable PROMs), flash ROMs, and RAMs (Random Access Memory)). The program may also be supplied to a computer by various types of transitory computer-readable media. Examples of transitory computer-readable media include electrical signals, optical signals, and electromagnetic waves. The transitory computer-readable media can supply the program to a computer via a wired communication path such as an electric wire or optical fiber, or via a wireless communication path.

[0171] The invention made by the inventor has been specifically described above based on the embodiments, but it goes without saying that the present invention is not limited to the embodiments already described, and various modifications are possible within the scope of the gist of the invention. [Explanation of symbols]

[0172] 10 Semiconductor device 11 Processor Element (PE) 12 Shared Resources 13. Memory 14 Programs 15 Task Management Information 16 Running group management information 100 Multiprocessor Systems 101 Processor Element (PE) 102 memory 103 Bus 104 Registers 105 Interrupt Controller 106 Interrupt Mask Register 110 Program Area 111 RTOS 111a RTOS features 112 User Application Programs 120 data area 121 RTOS data 210 Task management control unit 211 Preservation Department 212 Return Section 213 Starting part 220 Schedule Management Control Unit 221 Group Decision Department 222 Group Update Department 223 Schedule Update Department 230 Task Management Information 231 Task Group ID 232 Task Status 233 Task Stack Information 234 Task start address 235 Task Priority 240 Schedule Management Information 241 Lady Task Information 242 Group Highest Priority Information 243 Highest priority information 244 Running Task ID 250 Running group management information 301 RTOS initial setting file 302 Generator 410 Interrupt management control unit 411 Group Information Acquisition Department 412 Reception Settings Department 413 Interrupt Starter 414 Interrupt return part 420 Interrupt Management Information 421 Interrupt Group ID 422 Interrupt start address 423 Interrupt Initial Priority 430 Interrupt source group information

Claims

1. a memory storing programs, task management information, and running group management information; first and second processor elements; first and second shared resources accessible from the first and second processor elements; the task management information is information associating a task executed by the first or second processor element with group identification information that identifies a group corresponding to the first or second shared resource, the executing group management information is information indicating, for each group, whether a task associated with group identification information of the group is being executed by the first or second processor element; The first or second processor element executes the program, referring to the executing group management information, and identifying a group in which a task associated with the group identification information of the group is not being executed by the first or second processor element as an executable group; a processor element that refers to the task management information and determines a task associated with group identification information of the specified executable group as a task to be executed next by the first or second processor element; the memory further stores interrupt management information; the interrupt management information is information that associates an interrupt process with group identification information that identifies a group, the executing group management information indicates, for each group, whether a task associated with group identification information of the group or an interrupt process associated with the group identification information of the group is being executed by the first or second processor element; the first or second processor element is configured to refer to the interrupt management information when identifying the executable group in the first or second processor element, and to prohibit interrupt processing associated with group identification information of the group. Semiconductor device.

2. the memory further stores interrupt cause group information; the interrupt cause group information is information that associates the group with an interrupt cause of the interrupt process, the first or second processor element is configured to refer to the interrupt cause group information when identifying the executable group in the first or second processor element, and to prohibit interrupt processing of the interrupt cause associated with the group; The semiconductor device according to claim 1 .

3. 1. A method for controlling a semiconductor device including first and second processor elements and first and second shared resources accessible from the first and second processor elements, the method comprising: storing task management information that associates a task executed by the first or second processor element with group identification information that identifies a group corresponding to the first or second shared resource; storing, for each of the groups, running group management information indicating whether a task associated with the group identification information of the group is being executed by the first or second processor element; referring to the executing group management information, and identifying a group in which a task associated with the group identification information of the group is not being executed by the first or second processor element as an executable group; referencing the task management information, and determining a task associated with group identification information of the specified executable group as a task to be executed next by the first or second processor element; further storing interrupt management information that associates the interrupt process with group identification information that identifies the group; the executing group management information indicates, for each group, whether a task associated with group identification information of the group or an interrupt process associated with the group identification information of the group is being executed by the first or second processor element; when identifying the executable group in the first or second processor element, the first or second processor element refers to the interrupt management information and prohibits interrupt processing associated with group identification information of the group; A method for controlling a semiconductor device.

4. further storing interrupt cause group information that associates the group with an interrupt cause of the interrupt process; when identifying the executable group in the first or second processor element, the first or second processor element refers to the interrupt cause group information and prohibits interrupt processing of the interrupt cause associated with the group; The method for controlling a semiconductor device according to claim 3 .

5. A program for causing a computer of a semiconductor device to execute a control method for a semiconductor device including first and second processor elements and first and second shared resources accessible from the first and second processor elements, the program comprising: The method for controlling a semiconductor device includes: storing task management information that associates a task executed by the first or second processor element with group identification information that identifies a group corresponding to the first or second shared resource; storing, for each of the groups, running group management information indicating whether a task associated with the group identification information of the group is being executed by the first or second processor element; referring to the executing group management information, and identifying a group in which a task associated with the group identification information of the group is not being executed by the first or second processor element as an executable group; referencing the task management information, and determining a task associated with group identification information of the specified executable group as a task to be executed next by the first or second processor element; further storing interrupt management information that associates the interrupt process with group identification information that identifies the group; the executing group management information indicates, for each group, whether a task associated with group identification information of the group or an interrupt process associated with the group identification information of the group is being executed by the first or second processor element; when identifying the executable group in the first or second processor element, the first or second processor element refers to the interrupt management information and prohibits interrupt processing associated with group identification information of the group; program.

6. further storing interrupt cause group information that associates the group with an interrupt cause of the interrupt process; when identifying the executable group in the first or second processor element, the first or second processor element refers to the interrupt cause group information and prohibits interrupt processing of the interrupt cause associated with the group; The program according to claim 5.

Citation Information

Patent Citations

  • Multiprocessor system and operation method for the same

    JP2011175378A

  • Thread arbitration system, processor, video recording and reproducing device, and thread arbitration method

    JP2012048399A

  • Multi-core processor system, shared resource control method, and thread control device

    JP2012178107A

  • Resource-based scheduler

    JP2013218744A

  • Method, system, and apparatus for scheduling computer micro-jobs for execution without disruption

    JP2013232207A

Cited By

  • Semiconductor device, control method for it, and program

    DE102022213686A1