Information processing apparatus and program

The information processing device and program efficiently utilize multi-cores by executing asynchronous threads on separate cores, addressing processing bottlenecks and improving performance and maintainability.

JP2024127395AActive Publication Date: 2024-09-20SEIKO SOLUTIONS
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
JP2023036524
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-03-09
Publication Date
2024-09-20
Estimated Expiration
2043-03-09

AI Technical Summary

Technical Problem

Conventional technologies fail to fully utilize multi-cores due to processing bottlenecks when thread pools are placed on main threads, leading to inefficient use of computational resources.

Method used

An information processing device and program that executes multiple asynchronous threads on separate cores, with a main thread and a first sub-thread having a thread pool, allowing the main thread to specify processing modules and notify the sub-thread, which then requests processing from a second sub-thread.

Benefits of technology

This approach enables full utilization of multi-cores, improving operating performance and resource allocation, reducing processing time, and enhancing maintainability by distributing load across multiple cores.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024127395000001
    Figure 2024127395000001
Patent Text Reader

Abstract

To provide an information processing apparatus which can sufficiently use a multi-core processor even when processing is carried out by multithreading.SOLUTION: The present invention is directed to an information processing apparatus for executing a plurality of threads using, in parallel, different cores which are asynchronous with one another. In the information processing apparatus, a main thread and a first sub-thread having a thread pool are disposed. The main thread receives a request with designation of a processing module to notifies the first sub-thread of the designation of the processing module and the request. The first sub-thread request a second sub-thread to carry out the processing in response to the processing module regarding the destination notified from the main thread if the request is notified from the main thread.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present disclosure relates to an information processing device and a program. [Background technology]

[0002] For example, the default JavaScript engine runs on a single thread. Therefore, in order to achieve full asynchronous operation, it is necessary to realize the control of multiple threads.

[0003] The computer described in Patent Document 1 aims to obtain the effects of improved operating performance and power saving by a multi-core processor without modifying the target program. Specifically, in the computer, on a multi-core processor having multiple cores each capable of independently executing multiple threads of a given target program, the target program, a core allocation program that specifies the cores on which the threads of the target program can run, and an operating system that includes a thread generation function that generates a new thread in response to a thread generation request generated by the target program and a core affinity function that runs the new thread on the cores specified as operable, run on the multi-core processor, and the multi-core processor includes a thread generation monitoring function that detects the occurrence of the thread generation request by executing the core allocation program, and a core allocation setting function that specifies the cores on which the new thread generated by the detected thread generation request will run (see Patent Document 1). [Prior art documents] [Patent documents]

[0004] [Patent Document 1] JP 2012-133682 A Summary of the Invention [Problem to be solved by the invention]

[0005] However, in the conventional technology, a configuration in which a thread pool is arranged in the main thread cannot fully utilize multiple cores. For example, in a configuration in which a thread pool is placed on the main thread, which tends to be the focus of processing, there was a problem of it becoming a processing bottleneck.

[0006] The present disclosure has been made in consideration of the above circumstances, and has an objective of providing an information processing device and a program that are capable of fully utilizing multiple cores when processing is multithreaded. [Means for solving the problem]

[0007] One aspect of the present disclosure is an information processing device that executes multiple threads that are asynchronous with each other and use separate cores in parallel, the information processing device being arranged with a main thread and a first sub-thread having a thread pool, the main thread accepts a request that specifies a processing module and notifies the first sub-thread of the processing module specification and the request, and when the first sub-thread receives the request from the main thread, it requests processing from a second sub-thread in accordance with the processing module related to the specification notified from the main thread.

[0008] One aspect of the present disclosure is a program for enabling a computer that executes multiple threads that are asynchronous with each other and use separate cores in parallel to implement a function in which a main thread accepts a request that specifies a processing module, and notifies a first sub-thread having a thread pool of the processing module specification and the request, and a function in which the first sub-thread, when notified of the request from the main thread, requests processing from a second sub-thread according to the processing module specified by the main thread. Effect of the Invention

[0009] According to the information processing device and program disclosed herein, when processing is multithreaded, it is possible to fully utilize multiple cores. [Brief description of the drawings]

[0010] [Figure 1] FIG. 2 is a diagram illustrating an example of a schematic configuration of a program in the information processing device according to the embodiment. [Diagram 2] 11 is a diagram showing an example of a procedure for calling a processing module when a request is generated according to the embodiment; FIG. [Diagram 3] FIG. 2 is a diagram illustrating a schematic configuration example of a processing module according to the embodiment. [Figure 4] FIG. 2 is a diagram illustrating asynchronous processing according to an embodiment. [Diagram 5] FIG. 10 is a diagram illustrating a derivation process according to the embodiment. [Figure 6] 13A to 13H are diagrams showing an example of a result when the front end has a multi-core compatible function according to the embodiment. [Figure 7] 13A to 13H are diagrams showing an example of a result when the front end according to the comparative example does not have a multi-core compatible function. [Figure 8] 13A to 13H are diagrams illustrating an example of a result with a back-end multi-core compatible function according to an embodiment. [Figure 9] 13A to 13H are diagrams showing an example of a result when the back-end does not have a multi-core compatible function according to the comparative example. [Figure 10] FIG. 2 is a diagram illustrating an example of the hardware configuration of an information processing device according to an embodiment. [Figure 11] FIG. 11 is a diagram illustrating an example of a schematic configuration of a program in an information processing device according to a comparative example. [Figure 12] FIG. 11 is a diagram illustrating an example of a procedure for calling a processing module when a request is generated in the comparative example. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0011] Hereinafter, embodiments of the present disclosure will be described with reference to the drawings.

[0012] In this embodiment, a case is shown in which the information processing device and the program according to this embodiment are applied to asynchronous processing of a JavaScript controller, but they may also be applied to other asynchronous processing. The default JavaScript engine runs on a single thread. Therefore, in order to achieve full asynchronous operation, it is necessary to realize the control of multiple threads. In this embodiment, a JavaScript engine that operates in a single thread by default is made multi-threaded to realize fully asynchronous processing.

[0013] FIG. 1 is a diagram showing an example of a schematic configuration of a program in an information processing device P1 according to an embodiment. The information processing device P1 is a computer. FIG. 1 shows an example of the configuration inside a browser 1 and an example of the configuration outside a browser 2 as schematic configuration examples of programs in an information processing device P1 according to the embodiment.

[0014] In this embodiment, the information processing device P1 includes a multi-core processor, and the program is executed using the multi-core processor. In this embodiment, in the case of the front end, the program in question is, for example, a state control program for a web application, and is the main control program for the browser. In this embodiment, in the case of the backend, the program is, for example, a main control program of a service in a server.

[0015] <Example of browser internal configuration> The browser interior 1 includes, as software, a main thread 11, an adapter 12 which is a worker thread, m (m is an integer equal to or greater than 2) models 111-1 to 111-m which are worker threads, m states 121-1 to 121-m which are worker threads, m actions 131-1 to 131-m which are worker threads, an internal processing unit 112 which is a worker thread and corresponds to the models 111-1 to 111-m, an internal processing unit 122 which is a worker thread and corresponds to the states 121-1 to 121-m, and an internal processing unit 132 which is a worker thread and corresponds to the actions 131-1 to 131-m. Thus, in this embodiment, a plurality of threads exist in the information processing device P1. Each thread is asynchronous and uses separate resources (cores) of a central processing unit (CPU) in parallel.

[0016] Here, the number of models 111-1 to 111-m, states 121-1 to 121-m, and actions 131-1 to 131-m is, for example, variable. Note that, for convenience of explanation, this embodiment shows a case where these numbers (m) are the same, but there may be a situation where these numbers are different. In the present embodiment, it is assumed that the models 111-1 to 111-m, the states 121-1 to 121-m, and the actions 131-1 to 131-m are, for example, threads with relatively long processing times, but this is not limiting.

[0017] In this embodiment, each thread, such as a model, a state, and an action, is assigned a role. In this embodiment, as an example, a model is a thread for recognizing the state of the world outside the system (input processing), a state is a thread for changing the state in the system according to the model, and an action is a thread for influencing the world outside the system according to the state (output processing). Note that such division of roles is merely an example, and the division of roles between models, threads, and actions may be determined arbitrarily for each system to which the models, threads, and actions are applied, for example.

[0018] In the main thread 11, an entrance unit 21, an initiator 22, and a main circuit 23 are arranged as software. Here, the entrance unit 21 is realized by, for example, View or Main. Such an entrance unit 21 may have, for example, a screen display function.

[0019] In this embodiment, View and Main are components that use the multi-core support function according to this embodiment. Here, the multi-core support function according to this embodiment is a function that allows operation by a multi-core processor without modifying the target program (here, the View and Main programs), and can obtain the effects of improved operating performance and power saving by the multi-core processor. The view renders, in the browser, buttons for calling the models 111-1 to 111-m, the states 121-1 to 121-m, and the actions 131-1 to 131-m via the multi-core compatible function. Main has a function of HTTP (Hyper Text Transfer Protocol) for calling the models 111-1 to 111-m, the states 121-1 to 121-m, and the actions 131-1 to 131-m via a multi-core compatible function.

[0020] In this embodiment, the adapter 12 is the first sub-thread (also called a sub-circuit in this embodiment) for the main thread 11. In the adaptor 12, n (n is an integer of 2 or more) sub-circuit worker instances 41-1 to 41-n and a thread pool 42 are arranged as software. Here, the number (n) of the sub-circuit worker instances 41-1 to 41-n is, for example, a fixed value, but as another example, it may be variable. The thread pool 42 is also a dispatcher, a program that assigns tasks to sub-threads.

[0021] Here, in this embodiment, the main thread 11 is one thread, and the adapter 12 is one thread. The main thread 11 calls the adapter 12 when necessary. In this embodiment, since the thread pool 42 is arranged in the sub-thread (adapter 12), the main thread 11 does not need to synchronously wait for the processing result after requesting the adapter 12 to perform processing.

[0022] In this embodiment, multiple cores are provided, and each thread is assigned to a different core. Here, the number of sub-circuit worker instances 41-1 to 41-n is not particularly limited, and may be 6 (i.e., n=6) when the total number of multi-cores is 8. In this case, one core is assigned to each of the main thread 11 and the adapter 12. Furthermore, there is no particular limit to the number of models 111-1 to 111-m, states 121-1 to 121-m, and actions 131-1 to 131-m, and in this embodiment, the total number is a maximum of n at the same time.

[0023] <Example of configuration outside the browser> The outside browser 2 includes a service 211, an authorization server 212, and the like. Here, in this embodiment, a case is shown in which the browser inside 1 and the browser outside 2 exist inside the same information processing device P1, but as another example, the browser outside 2 may exist on another device (for example, an information processing device other than the information processing device P1). For example, the inside of the browser 1 and the outside of the browser 2 may be connected via a network such as the Internet.

[0024] [Processing example] Referring to FIG. 1, an example of processing inside a browser 1 is shown.

[0025] <Example of processing when an application starts> As an example of the process when an application is started, the procedure of process T1 to process T4 will be shown.

[0026] (Process T1) The entrance unit 21 calls the initiator 22 . This call process is a synchronous process within a thread.

[0027] (Process T2) The initiator 22 then creates a subcircuit worker instance for the adapter 12 . This creation process is a synchronous process within a thread.

[0028] (Process T3) Furthermore, the initiator 22 requests the adapter 12 to create sub-circuit worker instances 41-1 to 41-n equal to the number of cores that can be assigned to the thread pool 42 (six in this embodiment). This request processing is an asynchronous process between threads.

[0029] (Process T4) The adapter 12 creates sub-circuit worker instances 41-1 to 41-n.

[0030] <Example of processing when a request occurs> As an example of processing when a request occurs, steps S1 to S12 are shown.

[0031] (Process S1) The entry unit 21 calls a method for the main circuit 23 using the request as an argument. This call process is a synchronous process within a thread.

[0032] (Process S2) Next, the main circuit 23 sends a message containing the request to the thread pool 42 . This transmission process is an asynchronous process between threads.

[0033] (Process S3) Next, the thread pool 42 requests a subcircuit (here, model 111-i (i is an integer)) for the thread pool 42 to process the request. This request processing is an asynchronous process between threads. Here, model 111-i represents one or more models.

[0034] (Process S4) Next, the model 111-i requests the internal processor 112 to execute the process. This request processing is a synchronous process within the thread.

[0035] (Process S5) Next, the internal processing unit 112 returns the processing result to the model 111-i that made the request. This return process is a synchronous process within the thread.

[0036] (Process S6) Next, in response to receiving the processing result, the model 111-i transmits a processing completion message to the thread pool 42. This transmission process is an asynchronous process between threads.

[0037] (Process S7) Next, for state 121-j (j is an integer), processes similar to steps S2 to S6 are repeated. Here, state 121-j represents one or more states. Specifically, the thread pool 42 requests the state 121-j to process the request. This request processing is an asynchronous process between threads.

[0038] Next, the state 121-j requests the internal processing unit 122 to execute the process. This request processing is a synchronous process within the thread.

[0039] (Process S7a and Process S7b) Here, the internal processing unit 122 may request, for example, AI (Artificial Intelligence) processing to the external browser 2 (processing S7a) and receive a processing result from the external browser 2 (processing S7b). This request process and return process are synchronous processes within a thread.

[0040] Next, the internal processing unit 122 returns the processing result to the state 121-j that originated the request. This return process is a synchronous process within the thread.

[0041] Next, in response to receiving the processing result, the state 121-j transmits a processing completion message to the thread pool 42. This transmission process is an asynchronous process between threads.

[0042] (Process S8) Next, for action 131-k (k is an integer), processes similar to steps S2 to S6 are repeated. Here, the action 131-k represents one or more actions. Specifically, the thread pool 42 requests the action 131-k to process the request. This request processing is an asynchronous process between threads.

[0043] Next, the action 131-k requests the internal processor 132 to execute the process. This request processing is a synchronous process within the thread.

[0044] Next, the internal processing unit 132 returns the processing result (for example, a requested report) to the action 131-k that made the request. This return process is a synchronous process within the thread.

[0045] Furthermore, the action 131-k transmits a processing completion message to the thread pool 42 in response to receiving the processing result. This transmission process is an asynchronous process between threads.

[0046] (Process S9) Here, the internal processing unit 132 may, for example, request the outside browser 2 to perform a derivative process. This request processing is an asynchronous process between threads. Note that the internal processing unit 132 may, for example, after making a request for a derivative process to the outside browser 2, return a processing result (for example, a report on the request) to the action 131-k that made the request.

[0047] (Process S10) The thread pool 42 then sends a message containing the response to the main circuit 23. This transmission process is an asynchronous process between threads.

[0048] (Process S11) Next, the main circuit 23 returns a response to the inlet portion 21 . This return process is a synchronous process within the thread.

[0049] (Process S12) Here, the sub-circuit worker instances 41-1 to 41-n are returned to the thread pool 42 after the processing is completed. Returning the sub-circuit worker instances 41-1 to 41-n to the thread pool 42 after the processing is completed means notifying the thread pool 42 that the sub-circuit worker instances 41-1 to 41-n are no longer in use. In this embodiment, the adapter 12 performs this notification. The thread pool 42 does not store the sub-circuit worker instances 41-1 to 41-n, but manages the states (whether or not they are in use) of the sub-circuit worker instances 41-1 to 41-n.

[0050] <Specifying the processing module (example for processing S2)> FIG. 2 is a diagram illustrating an example of a procedure for calling a processing module when a request is generated according to the embodiment.

[0051] (Process S21) In this embodiment, when the entrance unit 21 receives a request from a client (for example, a user who operates a client terminal), the entrance unit 21 receives a designation of a processing module to be called. The main circuit 23 receives, from the inlet unit 21, a request from a client and a specification of a processing module to be called. Thus, in this embodiment, in process S1 shown in FIG. 1, the main circuit 23 receives from the entry unit 21 the request and a designation of the processing module to be called.

[0052] (Process S22) Next, the main circuit 23 calls the processing module specified in the request. Specifically, in this embodiment, in process S2 shown in FIG. 1, the main circuit 23 transmits to the thread pool 42 a message including a request having a designation of a processing module.

[0053] (Process S23) Thereafter, when the main circuit 23 receives a message including a response of the specified processing module from the thread pool 42 , it returns the processing result of the specified processing module to the inlet unit 21 . As described above, in this embodiment, in process S11 shown in FIG. 1, the main circuit 23 returns to the inlet unit 21 a response including the processing result of the specified processing module.

[0054] Here, the processing module is not particularly limited, and may be, for example, a user registration processing module related to user registration processing, a user deletion processing module related to user deletion processing, or a user update processing module related to user update processing.

[0055] As described above, in this embodiment, the client includes in the request the processing module (functional module) to be called, and the main circuit 23 of the main thread 11 calls the specified processing module. Therefore, in this embodiment, when processing is multi-threaded inside the browser 1, even if the number of processes that may be requested to be executed increases, there is no need to modify the inside of the browser 1 (for example, the main circuit 23 of the main thread 11), thereby improving maintainability. An example of a case where the number of processes that can be requested to be executed increases is when a new processing module is added.

[0056] <Example of processing module configuration> FIG. 3 is a diagram illustrating a schematic configuration example of a processing module according to the embodiment. In this embodiment, a processing module is prepared for each process, and the contents of each processing module are divided by phase. In this way, the processing of each phase is contained as a submodule in one processing module for each process. This makes it easier to understand the code because a series of processes is organized into one module, and efficiency is improved in multithreading.

[0057] In this embodiment, there are three phases: a model phase, a state phase, and an action phase. In this embodiment, the model phase is a phase for recognizing the state of the world outside the system (input processing), the state phase is a phase for changing the state within the system according to the model, and the action phase is a phase for influencing the world outside the system according to the state (output processing). In the example of FIG. 3, a user registration process, a user deletion process, and a user change process are shown as processing modules. Each processing module includes a model phase processing module, a state phase processing module, and an action phase processing module.

[0058] As a comparative example, consider a configuration in which a continuous process is divided into three phases, namely model, state, and action, and executed in different threads. In this configuration, if the process is modularized by phase, the continuous process will be divided into three places in the code, reducing the readability of the code. In this way, when a process that is originally a continuous process is divided, the readability is reduced. In contrast, this embodiment can solve such problems.

[0059] A specific example is given. As a specific example of this embodiment, a user registration processing module will be described below, which also applies to other processing modules (user deletion processing module, user change processing module). When a user registration processing module is executed, the processing module includes a model phase process, a state phase process, and an action phase process. Each of the model, state, and action phases included in the user registration processing module is executed in a different worker thread.

[0060] In this embodiment, when a request including a user registration processing module is received, an example of a procedure in which the adapter 12 responds to the request is shown. Note that the user registration processing module includes submodules (model submodule, state submodule, action submodule) corresponding to each phase of the model, state, and action. When the adapter 12 receives a request including a user registration processing module, it first requests a model worker thread to execute processing of the model submodule included in the request. In response to this, the model worker thread returns the processing execution result of the model submodule to the adapter 12. The adapter 12 receives the processing execution result. Next, the adapter 12 requests the state worker thread to execute the processing of the state submodule of the user registration processing module using the processing execution result of the model submodule as an argument. In response to this, the state worker thread returns the processing execution result of the state submodule to the adapter 12. The adapter 12 receives the processing execution result. Then, the adapter 12 requests the action worker thread to execute the processing of the action submodule of the user registration processing module using the processing execution result of the state submodule as an argument. In response to this, the action worker thread returns the processing execution result of the action submodule to the adapter 12. The adapter 12 receives the processing execution result.

[0061] In this embodiment, a case has been shown in which synchronization processing is performed in the order of model, state, and action in a processing module such as a user registration processing module. As another example, asynchronous processing may be performed when a phase does not use the processing results of another phase, such as when the processing results of a model are not used in a state. In other words, asynchronous processing may be performed depending on the contents of the processing module.

[0062] On the other hand, as a specific example of the above-mentioned comparative example, a user registration process will be described. The same applies to other processes (user deletion process, user change process). The procedure for performing user registration processing in the above comparative example will be described below. Each of the model module, state module, and action module includes a sub-module corresponding to the user registration processing. When the adapter receives a user registration request, it first requests the model worker thread to execute the processing of the user registration submodule of the model module. The model worker thread returns the processing execution result of the user registration submodule to the adapter. The adapter receives the processing execution result. Next, the adapter requests the state's worker thread to execute the processing of the user registration processing submodule of the state module using the processing execution result of the model module as an argument. The state's worker thread returns the processing execution result of the user registration submodule to the adapter. The adapter receives the processing execution result. The adapter then requests the action's worker thread to execute the processing of the user registration processing submodule of the action module using the processing execution result of the state module as an argument. The action's worker thread returns the processing execution result of the user registration submodule to the adapter. The adapter receives the processing execution result.

[0063] <Example of asynchronous processing> FIG. 4 is a diagram illustrating asynchronous processing according to the embodiment. FIG. 4 shows a processing request source 411 and a processing request destination 412 . A request source 411 makes a request for processing A to a request destination 412 . The request destination 412 executes the process A in response to the request. After the request, the request source 411 also executes process B as an asynchronous process. When the process A is completed, the request destination 412 notifies the request source 411 of the result of the process A. The request source 411 obtains the result of the process A from the request destination 412 . In addition, the request source 411 obtains the result of process B. In this way, an asynchronous process is a next process that the requester 411 begins executing without waiting for the program of the requestee 412 to complete.

[0064] Here, in this embodiment, for example, the source of the processing request 411 is a main circuit (e.g., main circuit 23), and the destination of the processing request 412 is a sub-circuit (here, adapter 12, beyond which is a worker thread assigned by thread pool 42). In this embodiment, the main circuit and the sub-circuit are separate threads, and therefore the premise (premise 1) that the request source 411 and the request destination 412 are separate is met. Furthermore, in this embodiment, data is exchanged between threads using the postMessage method of the worker instance, and the premise (premise 2) that the request destination 412 transmits the processing result to the request source 411 is met. Furthermore, in this embodiment, the main circuit switches tasks by an event loop, and the request source 411 obtains the processing result from the request destination 412 (premise 3) is satisfied. In this way, since the process requested by the main circuit to the sub-circuit (processing at request destination 412) satisfies the three prerequisites (prerequisites 1 to 3), the process (processing B) at request source 411 becomes an asynchronous process.

[0065] <Example of derived processing> FIG. 5 is a diagram illustrating a derivation process according to the embodiment. FIG. 5 shows a processing request source 511 and a processing request destination 512 . A request source 511 makes a request for processing A to a request destination 512 . In response to the request, the request destination 512 executes process A as a derived process. Furthermore, the request source 511 executes process B after the request. In the case of a derived process, the request destination 512 does not notify the request source 511 of the result of process A even when process A is completed. The request source 511 obtains the result of process B. In this way, a derived process is a process in which the request destination 512 does not return a result to the request source 511 .

[0066] [Example of the effect of multi-core support function] 6 to 9, the verification results for the front end and the back end are shown. 6 and 8 show a case where the multi-core compatible function according to this embodiment is used. 7 and 9 show a comparative example in which the multi-core compatible function according to the present embodiment is not present. In this comparative example, an entry part (e.g., View or Main) directly (synchronously) calls a model, a state, and an action. The case of View is shown as an example of the front end, and the case of Main is shown as an example of the back end.

[0067] 6 to 9 show the case where the number of cores in the multi-core is eight, but in this embodiment, the number of cores in the multi-core may be other numbers. Also, one CPU may have substantially the function of two or more cores. It should be noted that the examples in FIGS. 6 to 9 are illustrative only to show general trends and do not necessarily show precise numerical values, and the configuration according to the present embodiment is not limited to these examples.

[0068] <Front end> 6A to 6H are diagrams showing an example of the results when the front end according to the embodiment has a multi-core compatible function. In FIG. 6, graphs (A) to (H) correspond to each of the eight cores of the CPU. In each graph, the horizontal axis represents time, and the vertical axis represents CPU operation status. FIG. 6(A) shows the timing of "load start", and the horizontal axis time range is the same for (B) to (H). 6A to 6H, when the multi-core compatible function according to this embodiment is enabled, the processing is sufficiently distributed among multiple cores, and the processing capacity of each core can be fully utilized. As a result, the processing time is also reduced.

[0069] 7A to 7H are diagrams showing an example of the results when the front end according to the comparative example does not have a multi-core compatible function. In FIG. 7, graphs (A) to (H) correspond to each of the eight cores of the CPU. In each graph, the horizontal axis represents time, and the vertical axis represents CPU operation status. FIG. 7(A) shows the timing of "load start", and the horizontal axis time range is the same for (B) to (H). As shown in (A) to (H) of FIG. 7, without the multi-core compatible function according to this embodiment, although the load is distributed to multiple cores, only one thread's worth of computational resources can be used. In this way, the multi-core compatible function according to this embodiment is more efficient than the multi-core compatible function according to this embodiment.

[0070] <Backend> 8A to 8H are diagrams showing an example of the results when the back-end multi-core compatible function according to the embodiment is present. In FIG. 8, graphs (A) to (H) correspond to each of the eight cores of the CPU. In each graph, the horizontal axis represents time, and the vertical axis represents CPU operation status. FIG. 8(A) shows the timing of "load start", and the horizontal axis time range is the same for (B) to (H). 8(A) to (H), when the multi-core compatible function according to this embodiment is used, the processing is sufficiently distributed among multiple cores, and the processing capacity of each core can be fully utilized. As a result, the processing time is also shortened.

[0071] 9A to 9H are diagrams showing an example of the results when the back-end multi-core compatible function is not used according to the comparative example. In FIG. 9, graphs (A) to (H) correspond to each of the eight cores of the CPU. In each graph, the horizontal axis represents time, and the vertical axis represents CPU operation status. FIG. 9(A) shows the timing of "load start", and the horizontal axis time range is the same for (B) to (H). As shown in (A) to (H) of FIG. 9, without the multi-core compatible function according to this embodiment, although the load is distributed to multiple cores, only one thread's worth of computational resources can be used. In this way, the multi-core compatible function according to this embodiment is more efficient than the multi-core compatible function according to this embodiment.

[0072] [Example of information processing device hardware configuration] FIG. 10 is a diagram showing an example of the hardware configuration of an information processing device 601 according to the embodiment. The configuration of an information processing device 601 shown in FIG. 10 may be applied to the information processing device P1 according to this embodiment. The information processing device 601 is configured from a computer and executes the program according to this embodiment. The information processing device 601 includes an input / output unit 621 , a storage unit 622 , a communication unit 623 , and a control unit 624 .

[0073] The input / output unit 621 includes an input section and an output section. The input unit includes, for example, an operation unit that accepts operations performed by a user. The output unit includes a display unit that displays information on a screen for the user. The storage unit 622 includes various types of memory. The communication unit 623 communicates with an external device. The communication may be wired communication or wireless communication. The control unit 624 includes a multi-core processor 641 and performs various types of processing and control.

[0074] [Configuration Example According to Comparative Example] FIG. 11 is a diagram showing an example of a schematic configuration of a program in an information processing device Q1 according to a comparative example. FIG. 11 shows an example of the configuration of a browser inside 1001 and an example of the configuration of a browser outside 1002 as schematic configuration examples of programs in the information processing device Q1.

[0075] <Example of browser internal configuration> Inside the browser 1001, there are arranged a main thread 1011, m (m is an integer greater than or equal to 2) models 1111-1 to 1111-m that are worker threads, m states 1121-1 to 1121-m that are worker threads, m actions 1131-1 to 1131-m that are worker threads, an internal processing unit 1112 that is a worker thread and corresponds to the models 1111-1 to 1111-m, an internal processing unit 1122 that is a worker thread and corresponds to the states 1121-1 to 1121-m, and an internal processing unit 1132 that is a worker thread and corresponds to the actions 1131-1 to 1131-m.

[0076] In the main thread 1011, an entry unit 1021, an initiator 1022, a main circuit 1023, n (n is an integer of 2 or more) sub-circuit worker instances 1041-1 to 1041-n, and a thread pool 1042 are arranged.

[0077] <Example of configuration outside the browser> The outside of the browser 1002 includes a service 1211, an authorization server 1212, and the like.

[0078] <Processing when the application starts> FIG. 11 shows process T101 and processes T103 to T104 as processes performed when an application is started. These processes T101 and T103 to T104 are similar to processes T1 and T3 to T4 shown in FIG. 1 according to this embodiment, except that in the comparative example, sub-circuit worker instances 1041-1 to 1041-n and a thread pool 1042 are included in the main thread 1011.

[0079] <Processing when a request occurs> FIG. 11 shows steps S101 to S112 as the process when a request is generated. Of these processes S101 to S112, processes S101 and S103 to S112 are similar to processes S1 and S3 to S12 shown in FIG. 1 according to this embodiment, except that in the comparative example, sub-circuit worker instances 1041-1 to 1041-n and a thread pool 1042 are included in the main thread 1011.

[0080] <Specifying a processing module (example for process S102)> FIG. 12 is a diagram illustrating an example of a procedure for calling a processing module when a request is generated according to the comparative example.

[0081] (Process S1021) In the comparative example, an entrance unit 1021 receives a request from a client. At this time, in the comparative example, the entrance unit 1021 does not receive a specification of a processing module to be called. The main circuit 1023 receives a request from a client via the inlet 1021 . Thus, in the comparative example, in process S101 shown in FIG.

[0082] (Process S1022) Next, the main circuit 1023 determines, based on the request, which processing module to call.

[0083] (Process S1023) Next, the main circuit 1023 calls the determined processing module. Specifically, in the comparative example, in process S102 shown in FIG. 11, the main circuit 1023 transmits to the thread pool 1042 a message including a request having a designation of a processing module determined by the main circuit 1023 itself.

[0084] (Process S1024) Thereafter, when the main circuit 1023 receives a message including a response of a specified processing module from the thread pool 1042, it returns the processing result of the processing module to the inlet unit 1021. In the example of Fig. 11, in process S111, the main circuit 1023 returns a response including the processing result of the processing module to the inlet unit 1021.

[0085] Here, the processing module is not particularly limited, and may be, for example, a user registration processing module related to user registration processing, a user deletion processing module related to user deletion processing, or a user update processing module related to user update processing.

[0086] In this way, in the comparative example, the main circuit 1023 determines a processing module (functional module) to be called based on a request from a client, and calls the determined processing module.

[0087] Here, in the comparative example, the main circuit 1023 has a determination logic for determining the processing module to be called based on a request, and determines the processing module to be called based on the determination logic. For this reason, in the comparative example, for example, every time a new processing module is added, the decision logic of the program in the information processing device Q1 needs to be modified, resulting in a problem of low maintainability. Such a problem is associated with multi-threading processing. In contrast, in this embodiment, a processing module is specified in a request from a client, so that such problems can be solved.

[0088] [About the above embodiment] As described above, in the information processing device P1 according to this embodiment, when processing is multithreaded, it is possible to fully utilize multiple cores. In the program P1 according to this embodiment, the thread pool 42 independent of the main thread 11 is arranged in the first sub-thread (in this embodiment, the adapter 12).

[0089] For example, under the assumption that some processes, such as heavy-duty drawing, can only be performed on the main thread, there is a tendency for the load to be concentrated on the main thread. Under this assumption, placing a thread pool on the main thread can reduce the performance of the thread pool and cause a processing bottleneck. In contrast, this embodiment can solve such problems.

[0090] In the information processing device P1 according to this embodiment, it is possible to realize general-purpose middleware for multithreading. In the information processing device P1 according to this embodiment, for example, code for multithreading is collected, and a developer may pass a processing module to the information processing device P1 to perform multithreading. For example, to use multithreading in JavaScript, developers need to write multithreading code for each process. Therefore, to make every process multithreaded, it is necessary to write a huge amount of multithreading code. In contrast, in this embodiment, the code for multithreading is consolidated in one middleware, and all processes can use that middleware. This is expected to reduce the amount of code compared to the case where the code for multithreading is repeatedly written individually for all processes. This makes it possible to solve the above problems.

[0091] In the information processing device P1 according to this embodiment, complete asynchronous processing makes it possible to use up hardware resources in order to satisfy user requests. In the information processing device P1 according to the present embodiment, by arranging a thread pool 42 in the first sub-thread for the main thread 11 (the adapter 12 in the present embodiment), it becomes possible to sufficiently distribute the load among a plurality of cores.

[0092] In the information processing device P1 according to this embodiment, for example, by preparing the same number of threads as the number of cores, it is possible to prevent overhead due to an excess of threads.

[0093] Even when the multi-core compatible mechanism according to this embodiment is not used, the load of one thread is distributed across all cores, but in the raw state, only the computational resources allocated to one thread can be used, and the computational resources of the hardware cannot be fully utilized. In contrast, by using the multi-core compatible mechanism according to this embodiment, it is possible to fully utilize the computational resources of the hardware.

[0094] Previously, the initiator and thread pool were placed on a single main thread, meaning they could only use one core. In this embodiment, the main thread 11 and the adapter 12 can be separated and use different cores, and they communicate with each other, making completely asynchronous processing possible.

[0095] The differences between this embodiment and Patent Document 1 will now be described. This embodiment differs from the disclosure of Patent Document 1 in that a thread pool that assigns processing to sub-threads (in this embodiment, models, states, and actions) is fixedly placed in the first sub-thread (in this embodiment, adapter 12). This makes it possible to solve the problem that a thread pool is placed in a main thread where processing tends to be concentrated, causing a processing bottleneck. In conventional technology, threads are generated and assigned as needed for each process. In this embodiment, however, for example, the required process is broken down and assigned as multiple processes to a fixed number of sub-threads, thereby reducing the overhead incurred in thread management, such as thread generation or deletion.

[0096] Here, in this embodiment, a case has been shown in which the multi-core compatible mechanism has been applied to JavaScript, but it may also be applied to other programming languages. Further, in the present embodiment, a case has been described in which a model, a state, and an action are used as sub-threads, but this is not limiting, and any thread may be used as a sub-thread.

[0097] In addition, in this embodiment, a one-to-one relationship between the main thread 11 and the adapter 12 is shown, but as another example, a one-to-multiple relationship between the main thread 11 and the adapter 12 may also be shown, in which case a meta adapter that manages multiple adapters 12 may be provided between the main thread 11 and the adapter 12 as an interface function.

[0098] A program for implementing the functions of any of the components of any of the above-described devices may be recorded in a computer-readable recording medium, and the program may be read into a computer system and executed. The term "computer system" as used herein includes hardware such as an operating system or peripheral devices. The term "computer-readable recording medium" refers to portable media such as flexible disks, optical magnetic disks, ROMs, and CDs (Compact Discs)-ROMs (Read Only Memory), and storage devices such as hard disks built into computer systems. The term "computer-readable recording medium" also refers to storage devices that hold a program for a certain period of time, such as volatile memory inside a computer system that becomes a server or a client when a program is transmitted via a network such as the Internet or a communication line such as a telephone line. The volatile memory may be, for example, a RAM (Random Access Memory). The recording medium may be, for example, a non-transitory recording medium.

[0099] The above-mentioned program may be transmitted from a computer system in which the program is stored in a storage device or the like to another computer system via a transmission medium or by transmission waves in the transmission medium. Here, the "transmission medium" that transmits the program refers to a medium that has a function of transmitting information, such as a network such as the Internet or a communication line such as a telephone line. The above program may be for implementing some of the above functions. Furthermore, the above program may be a so-called differential file that can implement the above functions in combination with a program already recorded in the computer system. The differential file may be called a differential program.

[0100] In addition, the function of any of the components in any of the above-described devices may be realized by a processor. For example, each process in the embodiment may be realized by a processor that operates based on information such as a program and a computer-readable recording medium that stores information such as a program. Here, the functions of each part of the processor may be realized by individual hardware, or the functions of each part may be realized by integrated hardware. For example, the processor may include hardware, and the hardware may include at least one of a circuit that processes digital signals and a circuit that processes analog signals. For example, the processor may be configured using one or more circuit devices mounted on a circuit board, or one or both of one or more circuit elements. An IC (Integrated Circuit) or the like may be used as the circuit device, and a resistor or a capacitor or the like may be used as the circuit element.

[0101] Here, the processor may be, for example, a CPU. However, the processor is not limited to a CPU, and various processors such as a GPU (Graphics Processing Unit) or a DSP (Digital Signal Processor) may be used. The processor may be, for example, a hardware circuit using an ASIC (Application Specific Integrated Circuit). The processor may be, for example, a plurality of CPUs, or a hardware circuit using a plurality of ASICs. The processor may be, for example, a combination of a plurality of CPUs and a hardware circuit using a plurality of ASICs. The processor may include, for example, one or more of an amplifier circuit or a filter circuit that processes an analog signal.

[0102] Although the embodiments of this disclosure have been described in detail above with reference to the drawings, the specific configuration is not limited to this embodiment, and designs that do not deviate from the gist of this disclosure are also included.

[0103] [Note] Configuration examples 1 to 5 are shown below.

[0104] (Configuration example 1) An information processing device that executes a plurality of threads that are asynchronous with each other and use different cores in parallel, A main thread and a first sub-thread having a thread pool are arranged; the main thread receives a request with a processing module designated, and notifies the first sub-thread of the designation of the processing module and the request; When the first sub-thread is notified of the request from the main thread, the first sub-thread requests a second sub-thread to perform processing in accordance with the processing module related to the designation notified from the main thread. Information processing device.

[0105] Here, in the example of Figure 1, information processing device P1 is an example of an information processing device, main thread 11 is an example of a main thread, adapter 12 is an example of a first sub-thread, and models 111-1 to 111-m, states 121-1 to 121-m, and actions 131-1 to 131-m are examples of a second sub-thread.

[0106] (Configuration example 2) The processing module is prepared for each processing, The contents of the processing module are divided into phases, The processing of each phase is submodulated and included in one processing module for each process. The information processing device according to (Configuration Example 1).

[0107] (Configuration example 3) the main thread accepts the designation of the processing module and the request from a front end or a back end; The information processing device according to (Configuration Example 1) or (Configuration Example 2).

[0108] (Configuration Example 4) the main thread accepts the designation of the processing module and the request in response to an operation performed by a user on a display screen; The information processing device according to any one of (Configuration Example 1) to (Configuration Example 3).

[0109] It is also possible to provide a program (computer program) that is executed on a computer constituting an information processing device. (Configuration Example 5) A computer running multiple threads that are asynchronous to each other and use different cores in parallel A function in which a main thread receives a request with a processing module designated thereto, and notifies a first sub-thread having a thread pool of the designation of the processing module and the request; a function of the first sub-thread, when the first sub-thread is notified of the request from the main thread, requesting a second sub-thread to perform processing in accordance with the processing module related to the designation notified from the main thread; A program to achieve this. [Explanation of symbols]

[0110] 1, 1001... Inside the browser, 2, 1002... Outside the browser, 11, 1011... Main thread, 12... Adapter, 21, 1021... Entry section, 22, 1022... Initiator, 23, 1023... Main circuit, 41-1 to 41-n, 1041-1 to 1041-n... Subcircuit worker instance, 42, 1042... Thread pool, 111-1 to 111-m, 1111-1 to 1111-m... Model, 112, 122, 132, 1112, 1122, 1 132... internal processing unit, 121-1 to 121-m, 1121-1 to 1121-m... state (State), 131-1 to 131-m, 1131-1 to 1131-m... action (Action), 211, 1211... service, 212, 1212... authorization server, 411, 511... request source, 412, 512... request destination, 601, P1, Q1... information processing device, 621... input / output unit, 622... storage unit, 623... communication unit, 624... control unit, 641... multi-core processor

Claims

1. An information processing device that executes a plurality of threads that are asynchronous with each other and use different cores in parallel, A main thread and a first sub-thread having a thread pool are arranged; the main thread accepts a request with a processing module designated, and notifies the first sub-thread of the designation of the processing module and the request; When the first sub-thread is notified of the request from the main thread, the first sub-thread requests a second sub-thread to perform processing in accordance with the processing module related to the designation notified from the main thread. Information processing device.

2. The processing module is prepared for each processing, The contents of the processing module are divided into phases, The processing of each phase is submodulated and included in one processing module for each processing. The information processing device according to claim 1 .

3. the main thread accepts the designation of the processing module and the request from a front end or a back end; 3. The information processing device according to claim 1 or 2.

4. the main thread accepts the designation of the processing module and the request in response to an operation performed by a user on a display screen; 3. The information processing device according to claim 1 or 2.

5. A computer running multiple threads that are asynchronous to each other and use different cores in parallel A function in which a main thread receives a request with a processing module designated thereto, and notifies a first sub-thread having a thread pool of the designation of the processing module and the request; a function of the first sub-thread, when the first sub-thread is notified of the request from the main thread, requesting a second sub-thread to perform processing in accordance with the processing module related to the designation notified from the main thread; A program to achieve this.

Citation Information

Patent Citations

  • Computer, core allocation method and program

    JP2012133682A