Information processing device and information processing method
The information processing device addresses inefficient parallel processing by assigning task IDs and resource sharing, enabling efficient multitasking and data exchange, thus enhancing processing efficiency.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- CASIO COMPUTER CO LTD
- Filing Date
- 2022-09-20
- Publication Date
- 2026-06-02
AI Technical Summary
Existing systems face challenges in properly parallelizing and distributing processes running on microcontrollers due to limitations in programming languages used on virtual machines, leading to inefficient processing of multiple related tasks.
An information processing apparatus and method that assigns task IDs to processes executed by a real-time operating system, associating context IDs, program counters, and stack pointers for each task, enabling efficient parallel execution of main and dependent tasks through a virtual machine on a real-time operating system.
Facilitates easy parallel operation of multiple related processes, improving processing efficiency by allowing flexible multitasking and resource sharing among tasks, reducing memory usage and data exchange bottlenecks.
Smart Images

Figure 0007868468000001 
Figure 0007868468000002 
Figure 0007868468000003
Abstract
Description
Technical Field
[0001] This invention relates to an information processing apparatus and an information processing method.
Background Art
[0002] An arithmetic processing unit (processor) that performs processing of a certain degree of complexity or more is controlled in its processing operation by an operating system (OS). The OS manages the processes to be executed by ID (task ID). The OS defines a program counter (PC), which is the number of the next process to be executed for each such ID, and a stack pointer (SP), which is the write destination of data by the execution of the content of the process. When a plurality of processes are executed in parallel, the CPU sequentially switches the PCs and SPs of the plurality of processes for execution control. The CPU can further generate threads as child processes from each process and perform parallel processing of a plurality of related processes.
[0003] Even in an arithmetic processing unit such as a microcontroller specialized for specific processing, which has significant limitations in conventional processing capabilities and power consumption, etc., there are demands for diversification and complexity of operations related to recent IoT (Internet of Things), etc. In accordance with these demands, the number of arithmetic processing units (microcontrollers) operating on a real-time OS (RTOS) is increasing.
[0004] On the other hand, in an arithmetic processing unit operating on a certain OS, there is a technology for setting a virtual machine (VM) that enables application operations described in a specific programming language and pseudo operations by other OSs. By appropriately allocating memory, CPU load, etc. in the VM, the processing efficiency can be improved (for example, Patent Document 1).
Prior Art Documents
Patent Documents
[0005]
Patent Document 1
Summary of the Invention
[0006] Even in application processing using programming languages running on a VM on an RTOS, it can sometimes be more efficient to have a parent process call and execute child processes or threads. However, depending on the programming language running on the VM, multiple related processes may not be processed properly as parallel threads. As a result, there is a problem that processes running on the microcontroller may not be properly parallelized and distributed.
[0007] The object of this invention is to provide an information processing apparatus and an information processing method that can more easily operate multiple related processes in parallel. [Means for solving the problem]
[0008] To achieve the above objective, the present invention A processor whose operation is controlled by the operating system, Memory unit and, Equipped with, The aforementioned processor, A task that executes a process written in a programming language using a virtual machine on the operating system is executed after setting the identification information of the task on the operating system. When a related task is launched from the aforementioned task, the operating system is instructed to set the identification information corresponding to the related task. For each of the aforementioned task and the aforementioned related task, the specific information of the processing corresponding to the identification information is associated with and stored in the storage unit. When executing a task related to any of the aforementioned identification information, the specific information corresponding to that identification information is read from the storage unit and executed. It is an information processing device. [Effects of the Invention]
[0009] According to the present invention, there is an effect that multiple related processes can be operated in parallel more easily. [Brief explanation of the drawing]
[0010] [Figure 1] This is a block diagram showing the functional configuration of the information processing device of this embodiment. [Figure 2] This diagram schematically shows a virtual machine deployed on RAM. [Figure 3] This figure shows an example of the contents of task management information. [Figure 4] (a) This flowchart shows the control procedure for the program execution control process related to the execution of the main task in MicroPython. (b) This flowchart shows the control procedure for the instruction execution process called within the program execution control process. [Figure 5] This flowchart shows the control procedure for program execution control processing related to dependent tasks. [Modes for carrying out the invention]
[0011] Hereinafter, embodiments of the present invention will be described based on the drawings. Figure 1 is a block diagram showing the functional configuration of the information processing device 1 of this embodiment.
[0012] The information processing device 1 is, for example, a control microcontroller built into a video camera or a digital camera primarily used for taking still images, but is not limited to this. The information processing device 1 includes a CPU 11 (Central Processing Unit), RAM 12 (Random Access Memory), a storage unit 13, a communication unit 14, an operation reception unit 15, a display unit 16, an image processing module 17, and an input / output I / F 18 (Interface).
[0013] The CPU 11 is the processor of the control microcontroller and may be a general-purpose processor or one designed to suit specific processing requirements or power consumption (heat generation) specifications. The CPU 11 has an arithmetic unit for performing calculations and registers, and it comprehensively controls (operates) the operation of the information processing device 1. The registers include a program counter 111 (PC) and a stack pointer 112 (SP). The program counter 111 holds a value indicating the address where the content of the instruction to be executed is stored. The stack pointer 112 holds a value indicating the destination address of the value saved from the register. The operation of the CPU 11 is controlled by a real-time operating system (RTOS). The type of RTOS is not particularly limited.
[0014] RAM12 provides the CPU11 with a working memory space and stores temporary data. RAM12 may be DRAM, or it may include SRAM or other memory that can be used as RAM. RAM12 includes addresses specified by the program counter 111 and the stack pointer 112, among others.
[0015] The memory unit 13 is a non-volatile memory, such as flash memory. The memory unit 13 stores the program 131, various setting data, video camera shooting data and its processing data, etc. In addition to the RTOS mentioned above, the program 131 also includes programs related to shooting control and image control. The storage medium for shooting data, etc., may include a removable portable storage medium, such as an SD card. The memory unit 13 may also be other storage devices such as an HDD (Hard Disk Drive). Furthermore, the memory unit 13 may include a network drive or cloud server connected via the communication unit 14.
[0016] The communication unit 14 controls communication with external devices. The communication unit 14 includes a network card or the like according to a certain communication standard such as LAN (Local Area Network) or WiFi. The communication unit 14 transmits and outputs captured image data and the like to external devices, or receives update programs and the like.
[0017] The operation reception unit 15 has operation reception members not shown in the figure, such as push button switches, rotary switches, and rocker switches. The operation reception unit 15 receives operations of these operation reception members and outputs an input signal corresponding to the received operation reception member and operation content to the CPU 11.
[0018] The display unit 16 has, for example, a liquid crystal display screen and may be able to display the status of the video camera (itself) and a preview of the captured image. The status may include setting information related to shooting, shooting information of the captured image, basic date and time information, and connection information such as Xin connection information.
[0019] The image processing module 17 performs appropriate processing on the image data or video data captured by the shooting unit R1. The image processing module 17 is for performing specific image processing on the captured image data and may have a control unit (processor) such as a dedicated hardware circuit.
[0020] The input / output I / F 18 has connection terminals for communicating with peripheral devices, external devices, and the like. Here, the input / output I / 18 has connection terminals with the shooting unit R1 (camera), the speaker R2 (audio output unit), the microphone R3 (sound collection unit), the sensor R4 (measurement unit), and the communication connection terminals related to the above-mentioned LAN. The specifications of the connection terminals may be those widely used conventionally. Also, when it is possible to connect to an external device via a USB cable, the input / output I / F 18 may have a USB terminal.
[0021] Furthermore, some or all of these components—the imaging unit R1, speaker R2, microphone R3, and sensor R4—may be built into the video camera along with the configuration of the information processing device 1. In this case, the connection wiring may include signal wiring located on and passing through the circuit board inside the video camera.
[0022] Sensor R4 may include, but is not limited to, an accelerometer or tilt sensor as a level indicator for detecting horizontality. Sensor R4 may also further include an orientation sensor, an accelerometer, and the like.
[0023] Next, the control operation of this embodiment will be described. In this embodiment of the information processing device 1, program 131 includes a program written in microPython (registered trademark: Python) (programming language). microPython deploys a virtual machine (VM) area (CPU resources and memory capacity) on the RTOS. microPython then performs processing by executing bytecode within the VM.
[0024] When a microPython instance is started, the RTOS issues a task ID (identification information) depending on the main task being started. Based on the task ID, the RTOS controls the timing of multitasking between processes related to microPython and processes other than microPython. However, due to functional limitations of the commands related to thread creation, it is difficult for microPython to flexibly perform multitasking.
[0025] In the information processing device 1, when a MicroPython program (parent process, main task) generates (starts) child processes (dependent tasks, related tasks) within the VM, it requests the issuance (setting) of a task ID on the RTOS corresponding to that child process, and associates the obtained task ID with the child process. In this way, the execution timing of the MicroPython main task and dependent tasks is managed on the RTOS.
[0026] On the other hand, a dependent task created as a child process can be configured to reference the resources of the main task, thereby allowing those resources to be shared among multiple tasks. This enables the use of common settings between the main task and dependent tasks, and facilitates the exchange of input and output data between each task.
[0027] Figure 2 schematically shows the state in which a VM is deployed on RAM 12. When a microPython program is executed, a VM (virtual machine) area 120 is dynamically allocated and secured within RAM 12. The VM area 120 is further allocated a main task information area 125 and a dependent task information area 126. When the number of dependent tasks increases to two or more, an area is allocated to each dependent task. Note that multiple dependent tasks may be child processes called in parallel from a parent process (main task). Alternatively, multiple dependent tasks may be arranged in series, such as a child process and a grandchild process called from that child process.
[0028] In addition to the above, the VM area 120 of RAM 12 stores a shared resource 121, which is a resource that can be commonly read and written (referenced) by all processes. As mentioned above, data generated by one task can be retrieved by other tasks via the shared resource 121.
[0029] Figure 3 shows examples of the contents of task management information 1251 and 1261. Each task's information area stores task management information 1251 and 1261, respectively. Each task is assigned an ID within MicroPython (context ID), and each ID is associated with an RTOS task ID. In addition, the PC and SP for each task are stored. The context ID, PC, and SP constitute the specific information of this embodiment.
[0030] In an RTOS, when any task ID is designated as the next process to be executed, MicroPython identifies the corresponding context ID from task management information 1251 and 1261. The PC and SP of the task with the identified context ID are read and set in the CPU 11's program counter 111 and stack pointer 112, and the program is executed.
[0031] Task management information 1251 and 1261 may be integrated into a single management table independently of each task. Alternatively, the correspondence between IDs and RTOS task IDs may be maintained and managed in a single management table. In this case, the program counter and stack pointer values are read from the information area of each task based on the identified ID.
[0032] Figure 4(a) is a flowchart showing the control procedure by the CPU 11 for the program execution control process related to the execution of the main task of the micropython. Therefore, in Figure 4(a), the process name is labeled "(main)". Figure 4(b) is a flowchart showing the control procedure for the instruction execution process called within the program execution control process. This program execution control process is started, for example, automatically in conjunction with the shooting operation, or independently in response to a certain input operation to the operation reception unit 15.
[0033] When the program execution control process starts, the CPU 11 generates resources (shared resources 121) and initializes settings such as variables (step S101). At this time, the CPU 11 also sets the ID of its own task. The CPU 11 obtains the task ID for this process that was set in the RTOS (step S102).
[0034] CPU 11 allocates an area to store the program counter and other data for its own task and sets initial values (step S103). CPU 11 also allocates a stack pointer area for its own task (step S104). The ID obtained from steps S101 to S104, the RTOS task ID, PC, and SP become the task management information 1251.
[0035] The CPU 11 performs instruction execution processing (step S105). This executes each operation instruction defined in program 131 in order. When the operation is complete, the CPU 11 releases the allocated memory (step S106). In this case, the CPU 11 releases the entire VM area 120, freeing all memory allocated for micropython. Then, the CPU 11 terminates the program execution control process.
[0036] The instruction execution process shown in Figure 4(b) is called in step S105, and also supports the processing of instruction execution processes that are called further within the program execution control process of a dependent task (see Figure 5) which is called within that instruction execution process. Therefore, multiple instruction execution processes may be executed in parallel.
[0037] When the instruction execution process begins, the CPU 11 obtains the ID of its own task (step S121). The CPU 11 identifies the context ID associated with the task ID and obtains the corresponding PC. The CPU 11 sets the PC in the program counter 111 and reads and obtains the corresponding processing content (instruction) (step S122).
[0038] CPU 11 retrieves and updates the saved data from the stack pointer (step S123). CPU 11 executes the retrieved processing content. Based on the execution result, CPU 11 updates the value of the next program counter (step S124). As is well known, if there are no branches or jumps in the processing content, 1 is added to the value of the program counter. In the case of branching or jumping in the processing, the program counter value is updated to reflect the selected processing or the jump destination.
[0039] The CPU 11 determines whether it has executed all the processing steps of the task defined in program 131 (step S125). If it is determined that not all processing steps have been executed (that there are processing steps that have not been executed) ("NO" in step S125), the CPU 11 returns to step S121. If it is determined that all processing steps have been executed ("YES" in step S125), the CPU 11 terminates the instruction execution process and returns control to the program execution control process that called the instruction execution process.
[0040] Furthermore, a lock is applied to prevent the process from being interrupted (preempted) during steps S122 to S124 and transitioning to the processing of another task. If processing is performed for two or more cycles consecutively, the CPU 11 does not need to obtain its own task ID again. The CPU 11 simply needs to execute the following processing according to the program counter 111 and stack pointer 112 in the registers.
[0041] Figure 5 is a flowchart showing the control procedure by the CPU 11 for program execution control processing related to dependent tasks. This program execution control process is initiated by a startup command for a dependent task, which is defined as the processing content within the command execution process related to the main task or other dependent tasks. Therefore, in Figure 5, the process name is denoted with "(dependent)".
[0042] The processing in steps S143 to S146 of this program execution control process is identical to the processing in steps S103 to S106 of the program execution control process related to the main task. Therefore, a detailed explanation of steps S143 to S146 will be omitted.
[0043] When program execution control processing begins, CPU 11 sets the address of a resource (shared resource) already set for the main task as the resource reference (step S141). CPU 11 requests the setting of a task ID in the RTOS and obtains the set task ID (step S142). Then, CPU 11 proceeds to step S143. The ID obtained through the processing in steps S141 to S144, the RTOS task ID, PC, and SP become the task management information 1261.
[0044] Furthermore, in the process of step S146, the CPU 11 only needs to release the area of its own task and does not need to release the entire VM area 120, including the shared resource 121. Also, when this program execution control process finishes, if it is necessary to return variables as arguments to the calling task, the CPU 11 will return the arguments to the calling task.
[0045] Here, the processing of instructions defined in the instruction execution process does not necessarily have to be performed entirely by the CPU 11. For example, the processing may include simply requesting the control unit of the image processing module 17 to process specified data and waiting for its completion. Alternatively, the processing may include acquiring image data from an external source via the input / output interface 18 and writing it to RAM 12 using DMA (Direct Memory Access). Conversely, the processing may include DMA processing that reads image data from RAM 12 and outputs it externally. By flexibly executing such processing in a multitasking manner on a VM related to micropython, processing efficiency can be greatly improved.
[0046] As described above, the information processing device 1 of this embodiment comprises a CPU 11 whose operation is controlled by an RTOS and a storage unit 13. The CPU 11 executes tasks (main tasks) that are executed by a virtual machine on the RTOS, which are written in a programming language (microPython), by setting the task ID of the task in the RTOS. When a subordinate task of the main task is started by the main task, the CPU 11 causes the RTOS to set the task ID corresponding to the subordinate task. For both the main task and the subordinate task, the CPU 11 stores in the storage unit 13 the context ID, PC, and SP corresponding to the task ID. When the CPU 11 executes a task related to any of the above task IDs, it reads the context ID, PC, and SP corresponding to the task ID from the storage unit 13 and executes it. In this way, the information processing device 1 assigns a task ID to a dependent task and stores the context ID, PC, and SP associated with that task ID. Therefore, the information processing device 1 can easily process the main task and dependent tasks in parallel. As a result, the information processing device 1 can easily perform multitasking (thread processing) on the RTOS. In particular, it can easily perform appropriate multitasking when the system does not support flexible execution of thread settings, such as MicroPython.
[0047] Furthermore, when a dependent task is started, the CPU 11 is configured to refer to the shared resource 121, which is a resource of the main task, as the resource related to the processing of that dependent task. This allows the information processing device 1 to make the common shared resource 121 available to the main task and dependent tasks, which have different context IDs set. As a result, the information processing device 1 can easily reduce memory usage and facilitate the exchange of input / output data between related tasks.
[0048] Furthermore, dependent tasks may include calling and executing processes that are performed by systems other than the CPU 11. In this way, processes that do not involve the CPU 11 can be executed in parallel, allowing the information processing device 1 to efficiently carry out multiple processes without overloading the CPU 11.
[0049] Furthermore, the information processing method of this embodiment is an information processing method by a CPU 11 whose operation is controlled by an RTOS, and executes a main task that executes processing written in a programming language (microPython) on the RTOS using a virtual machine, by setting the task ID of the main task on the RTOS. When a dependent task related to the main task is started from the main task, the RTOS is made to set the task ID corresponding to the dependent task. For each of the main task and the dependent task, the context ID, PC, and SP of the processing corresponding to the task ID are associated and stored in the storage unit 13. When executing a task related to any of the task IDs, the context ID, PC, and SP corresponding to the task ID are read from the storage unit 13 and executed. Therefore, this information processing method makes it possible to easily and efficiently perform multitasking related to programming languages in a virtual machine.
[0050] It should be noted that the present invention is not limited to the embodiments described above, and various modifications are possible. For example, terms such as task, process, and thread mentioned above may be used differently depending on the type of OS, but they should be used in accordance with the definitions of the embodiments described above.
[0051] Furthermore, while the above embodiment assumes that the related tasks fully share the shared resource 121, it is not limited to this. Each task may have some independent resources.
[0052] Furthermore, although the above description assumes that a dependent task performs the process of operating the image processing module 17, the main task may also perform the process of operating the image processing module 17. Also, the external processing is not limited to the operation of the image processing module 17. It may be any external processing such as audio processing or numerical processing. In addition, the task does not have to include external processing such as the image processing module 17. As mentioned above, data reading and writing and communication control tend to become processing bottlenecks, so these processes may be appropriately executed in parallel with other processes.
[0053] Furthermore, the programming language does not have to be MicroPython, as long as it is also executed on a virtual machine.
[0054] Furthermore, although the above embodiment describes the information processing device 1 as being built into or attached to a video camera, it is not limited to this. It may be built into or attached to any other device having any function. Furthermore, the specific configurations, processing operations, and procedures shown in the above embodiments can be modified as appropriate without departing from the spirit of the present invention. The scope of the present invention includes the scope of the invention described in the claims and its equivalents. [Explanation of Symbols]
[0055] 1. Information Processing Device 11 CPU 111 Program Counter 112 Stack Pointer 12 RAM 120 areas 121 Shared Resources 125 Main task information area 126 Dependent Task Information Area 1251, 1261 Task Management Information 13 Storage section 131 Programs 14 Communications Department 15 Operation reception section 16 Display section 17 Image Processing Module 18 Input / Output Interfaces R1 Photography Department R2 Speaker R3 Mike R4 Sensor
Claims
1. A processor whose operation is controlled by the operating system, Memory unit and, Equipped with, The aforementioned processor, A task that executes a process written in a programming language using a virtual machine on the operating system is executed after setting the identification information of the task on the operating system. When a related task is launched from the aforementioned task, the operating system is instructed to set the identification information corresponding to the related task. For each of the aforementioned task and the aforementioned related task, the specific information of the processing corresponding to the identification information is associated with and stored in the storage unit. When executing a task related to any of the aforementioned identification information, the specific information corresponding to that identification information is read from the storage unit and executed. Information processing device.
2. The processor is configured to refer to the resources of the task as resources related to the processing of the associated task when the associated task is started. The information processing apparatus according to claim 1.
3. The information processing apparatus according to claim 1, wherein the related task includes calling and executing a process that is performed by a system other than the processor.
4. An information processing method using a processor whose operation is controlled by an operating system, A task that executes a process written in a programming language using a virtual machine on the operating system is executed after setting the identification information of the task on the operating system. When a related task is launched from the aforementioned task, the operating system is instructed to set the identification information corresponding to the related task. For each of the aforementioned task and the aforementioned related task, the specific information of the processing corresponding to the identification information is associated with and stored in the storage unit. When executing a task related to any of the aforementioned identification information, the specific information corresponding to that identification information is read from the storage unit and executed. Information processing methods.