Server device, multithread processing method and multithread processing program
The server device optimizes CPU resource utilization by employing dual-thread allocation based on CPU usage rates and predetermined rules, addressing communication delays and inefficiencies in high-load processing for vehicle-mounted client-server systems.
Patent Information
- Application Number
- JP2023055764
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-03-30
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2043-03-30
AI Technical Summary
Existing server devices face inefficiencies in CPU resource utilization and communication delays due to high processing loads and frequent context switches when handling multiple threads, particularly in client-server systems with vehicles equipped for data transmission and analysis.
The server device employs a dual-thread allocation mechanism that distributes high-load processes across multiple CPUs, using a thread allocation unit to assign data processing tasks based on CPU usage rates and predetermined rules, optimizing thread allocation for efficient CPU resource utilization.
This approach enhances CPU resource efficiency, reduces communication latency, and improves throughput by effectively managing high-load processing tasks in client-server systems, particularly in vehicle-mounted communication devices.
Smart Images

Figure 2024143213000001_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to a server device, a multi-thread processing method, and a processing program in a client-server system, and more particularly to a server device, a multi-thread processing method, and a multi-thread processing program that are connected to a communication device mounted on a mobile object such as an automobile. [Background technology]
[0002] In recent years, technologies for driving assistance and autonomous driving control, including V2X (vehicle-to-everything) such as vehicle-to-vehicle communication and vehicle-to-infrastructure communication, have been attracting attention. As a result, vehicles are equipped with communication functions, and it is known that the data acquired by the vehicle is transmitted to a server device, which manages and analyzes the data acquired by the vehicle.
[0003] The server device corresponds to the server used in a client-server system, and the communication function of the vehicle corresponds to the client used in a client-server system. The server device uses a communication management application (hereafter referred to as the communication app) to act as a bridge between the vehicle's communication function and data, and the communication management application uses a multi-threaded process so that multiple processes can be processed simultaneously in parallel.
[0004] Patent Document 1 discloses a method for a server to smoothly respond to client connection requests without wasting system resources. The number of free threads to be generated during a process is calculated based on the number of clients permitted by the server, the time limit for allocating clients to threads, the time required to generate threads, etc., and the free threads are placed in a state waiting for client connection requests within the server. This allows the server to allocate a thread to a client when a connection request is made from a client to the server. There is no need to always have threads available for all clients, and memory can be released when there are only a few connected clients. [Prior art documents] [Patent documents]
[0005] [Patent Document 1] Japanese Patent Application Publication No. 9-292998 Summary of the Invention [Problem to be solved by the invention]
[0006] Here, the present inventors have found the following problem. When a server device transmits and receives data to and from an external device (including an external application), there is a risk of delays, waste, and the like when a thread with a high server processing load is processed by a single CPU. On the other hand, in the method disclosed in Patent Document 1, since it is necessary to process data from both the client side, such as a communication management application running on a server device, and the external device side, it is necessary to generate a thread for each function even in the case of one client. Therefore, as the number of clients increases, the number of threads becomes huge. When the number of threads becomes huge in this way, context switching occurs frequently, leading to communication delays and reduced throughput. In addition, even if the number of threads is changed to a processing method that is not dependent on the number of clients in Patent Document 1, the problem of being unable to efficiently process threads with high processing loads with one CPU remains.
[0007] Therefore, an object of the present invention is to realize low communication latency by efficiently using the CPU resources of a server and shortening the overall processing time of the server. [Means for solving the problem]
[0008] The server device of the present disclosure includes: A server device (200) connected to a plurality of client communication devices (10), A receiving unit (101) for receiving a connection request signal and data from the client communication device; a first transmission unit (201) that executes a first thread for transmitting the data to an external device (203); a second transmission unit (202) that executes a second thread to transmit the data to the external device; and a thread allocation unit (102) that allocates, based on the connection request signal, whether the data received from the client communication device is to be transmitted using the first thread or the second thread.
[0009] In addition, the claims and the numbers in parentheses attached to the constituent elements of the invention described in this section indicate the correspondence between the present invention and the embodiments described below, and are not intended to limit the present invention. Effect of the Invention
[0010] With the above-described configuration, the server device of the present disclosure can efficiently use the CPU resources of the server device, and can achieve low communication latency by shortening the overall processing time of the server. [Brief description of the drawings]
[0011] [Figure 1] FIG. 1 is a block diagram showing an example of the configuration of a server device according to each embodiment; [Diagram 2] A flowchart showing the operation of the reception / transmission process of the server device in each embodiment. [Diagram 3] FIG. 2 is an explanatory diagram illustrating the operation of a multi-thread process in a server device according to each embodiment; [Figure 4] FIG. 1 is a block diagram showing an example of the configuration of a server device according to a first embodiment. [Diagram 5] 1 is a flowchart showing the operation of the multi-thread processing of the server device according to the first embodiment. [Figure 6] FIG. 1 is an explanatory diagram showing the operation of multi-thread processing in a server device according to the first embodiment; [Figure 7] FIG. 11 is a block diagram showing a configuration example of a server device according to a second embodiment. [Figure 8] 11 is a flowchart showing the operation of the multi-thread processing of the server device according to the second embodiment. [Figure 9] A flowchart showing the operation of allocating transmission threads in a server device according to a second embodiment. [Figure 10] 11 is a flowchart showing further operations of the server device in the second embodiment for allocating transmission threads. [Figure 11] FIG. 1 is a block diagram showing an example of the configuration of a server device according to each embodiment; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0012] Hereinafter, an embodiment of the present invention will be described with reference to the drawings.
[0013] The present invention means the invention described in the claims or in the Summary of the Invention section, and is not limited to the following embodiments. Furthermore, at least the words in quotation marks mean the words described in the claims or in the Summary of the Invention section, and are not limited to the following embodiments.
[0014] The configurations and methods described in the dependent claims are optional configurations and methods in the invention described in the independent claims. The configurations and methods of the embodiments corresponding to the configurations and methods described in the dependent claims, and the configurations and methods described only in the embodiments without being described in the claims, are optional configurations and methods in the present invention. The configurations and methods described in the embodiments when the description of the claims is broader than the description of the embodiments are also optional configurations and methods in the present invention in the sense that they are examples of the configurations and methods of the present invention. In either case, by being described in the independent claims, they become essential configurations and methods of the present invention.
[0015] The effects described in the embodiments are effects obtained when the configurations of the embodiments are provided as examples of the present invention, and are not necessarily effects that the present invention possesses.
[0016] When there are multiple embodiments, the configurations disclosed in each embodiment are not limited to each embodiment, but can be combined across the embodiments. For example, a configuration disclosed in one embodiment may be combined with another embodiment. Also, configurations disclosed in each of the multiple embodiments may be collected and combined.
[0017] The problem described in the section on problems that the invention is intended to solve is not a publicly known problem, but was discovered independently by the inventor, and this, together with the configuration and method of the present invention, is a fact that affirms the inventive step of the invention.
[0018] 1. Configuration underlying each embodiment (1) A server device that executes a communication management application FIG. 1 is a block diagram showing the configuration of a server device in each embodiment. The server device is "connected" to a plurality of "client communication devices" 10. The server device corresponds to a server in a client-server system, and the client communication devices 10 correspond to clients in the client-server system. In the server device, a communication management application is used to manage input and output of data to and from clients and / or external devices. In this embodiment, three client communication devices 10 are illustrated, but the present invention is not limited to this, and it is sufficient to have at least two or more client communication devices 10. In this embodiment, the client communication device 10 is "mounted" on a "mobile body" such as a vehicle. The client communication device 10 has a function of transmitting information about the mobile body on which it is mounted to the server device. Where: The "client communication device" is equivalent to a client used in a client / server system and may be any device equipped with a communication function. "Connection" refers to a state in which data can be exchanged, and includes not only cases in which different hardware is connected via a wired or wireless communications network, but also cases in which virtual machines realized on the same hardware are virtually connected to each other. "Mobile object" refers to an object that can move and can move at any speed. It also includes cases where the mobile object is stationary. For example, it includes, but is not limited to, automobiles, motorcycles, bicycles, pedestrians, ships, aircraft, and objects mounted on these. "Mounted" includes not only the case where the device is directly fixed to the moving body, but also the case where the device is not fixed to the moving body but moves with the moving body. For example, the case where the device is carried by a person riding on the moving body, or the case where the device is mounted on cargo placed on the moving body, are included.
[0019] The server device is further connected to an “external device” 17 . Here, the "external device" is sufficient as long as it is a device that can be distinguished from the server device in terms of software or hardware, and does not necessarily have to be a device that is physically different from the server device. Examples of "external devices" include storage devices for storing and analyzing data, and cloud apps (i.e., applications provided on the cloud) that analyze images and support processing based on the analysis results.
[0020] Examples of the server device include a virtual server on a cloud and a physical server provided outside the client communication device 10. The server device transmits and receives data to and from the client communication device 10 and an external device 17 using a communication management application. The server device includes a receiver 11 that receives data transmitted from the client communication device 10 and stores the received data in a queue (not shown), a transmitter 12 that extracts data stored in the queue of the receiver 11 and transmits the data to the external device 17, a receiver 14 that receives data transmitted from the external device 17 and stores the received data in a queue (not shown), a transmitter 13 that extracts data stored in the queue of the receiver 14 and transmits the data to the client communication device 10, and "multiple CPUs" 18 that execute the processes of the receiver 11, the transmitter 12, the transmitter 13, and the receiver 14. Of the multiple CPUs 18, individual CPUs are indicated as 1st to Nth CPUs 1 to N (N is an integer of 2 or more). The client communication device 10, the server device, and the external device 17 are connected, for example, in a WAN (Wide Area Network) or LAN (Local Area Network) via the sending and receiving sockets 15, 16. In general, the client communication device 10 and the server device are connected via a WAN, and when the server device and the external device 17 are on the same cloud, the server and the external device are connected via a LAN. The sending and receiving sockets 15, 16 can be provided as desired. Here, the "multiple CPUs" may be distinguished by package, core, or virtual CPU, for example, a multi-core CPU.
[0021] The data transmitted and received between the client communication device 10, the server device, and the external device 17 is, for example, images such as still images and moving images. In particular, any image captured by an imaging device such as a camera installed inside or outside the client communication device 10 may be used, and examples of such images include still images and moving images of the surroundings of the client communication device 10. Another example of the data may be log information of QSEv or SEv transmitted from each client communication device 10.
[0022] (2) Server device transmission and reception flow 2 is a flowchart showing the process flow of the receiving unit 11 and the transmitting unit 12 in each embodiment. The receiving unit 11 executes a receiving thread in one of the multiple CPUs 18, and the transmitting unit 12 executes a transmitting thread in another of the multiple CPUs 18. (Processing flow of the receiving thread) The receiver 11 receives data from the client communication device 10 (S10). The data is received via the send / receive socket 15. If the data received from the client communication device 10 is encrypted, the data is decrypted (S11). The header information added to the packet in the data is analyzed (S12), and the client communication device 10 that sent the data and the data type are identified. The data is then stored in a data queue in the receiver 11 (S13). The transmitter 12 is then notified that the data has been stored in the data queue (S14). Here, the data queue is an area shared by the receiving section and the transmitting section, and may be, for example, a temporary storage memory in the server device.
[0023] (Processing flow of the sending thread) The transmitting unit 12 receives a notification that data has been stored in the data queue (S21). Thereafter, the transmitting unit 12 extracts the data from the data queue of the receiving unit 11 (S22), analyzes the header information added to the packet (S23), and performs byte order conversion (S24) and decodes redundant data (S25) as necessary. The transmitting unit 12 rearranges the packets so that the data sent from the client communication device 10 matches the order in which it was received by the receiving unit 11 (S26), and transmits the data to the external device 17 (S27). Thereafter, the steps following the step of receiving the notification are repeated.
[0024] (3) Multi-threaded processing FIG. 3 is a diagram for explaining the operation of the communication management application in each embodiment, that is, a multi-thread process. FIG. 3(a) is an explanatory diagram of the execution of a plurality of processes indicated by threads A to J. The communication management application of this embodiment executes a multi-thread process that executes a plurality of processes simultaneously in parallel. In this embodiment, each unit of process is defined as a thread. Thread A (i.e., the thread that executes process A) corresponds to, for example, a process of receiving data from the client communication device 10, and is executed in the receiving unit 11 of the server device. Thread J corresponds to, for example, a process of transmitting data from the server device to the external device 17, and is executed in the transmitting unit 12 of the server device. Threads B, C, etc. other than threads A and J correspond to any process executed in the server device, and are executed, for example, in the receiving unit 14, the transmitting unit 13, and any execution unit not shown, respectively.
[0025] FIG. 3(b) is a diagram showing the relationship between CPUs and threads when processing is executed in parallel. In this embodiment, a server device having four CPUs is shown, but the number of CPUs is not limited to four, and may be any number equal to or greater than two. In FIG. 3(b), the first CPU 1 executes thread J, the second CPU 2 executes thread A, the third CPU 3 executes thread B, and the fourth CPU 4 executes thread C. In this embodiment, the number of CPUs is limited to four for the number of threads A to J, so that a scheduler of the OS running on the server device assigns threads that are ready to be executed to a CPU, and each CPU executes processing. Although not shown, for example, after the third CPU 3 executes thread B, thread D that is ready to be executed may be executed before the next thread B is executed. In addition, the allocation of CPUs is not fixed for each thread, and an appropriate CPU can be assigned according to the processing content and processing time of each thread.
[0026] The server device in this embodiment is used for video transmission and vehicle remote control, and therefore the amount of data transmitted from the client communication device 10 to the server is large. This tends to increase the processing load on the receiver 11 and transmitter 12, and the load on the transmission process (thread J) executed by the transmitter 12 is particularly high. In Fig. 3(b), thread J performing the transmission process has the highest CPU usage rate, and therefore thread J corresponds to the "thread performing high-load processing." Therefore, in the following first and second embodiments, a plurality of threads performing high-load processing are provided to distribute the load on a thread performing high-load processing, and one of the plurality of threads performing high-load processing is assigned to one client. Below, a server device 100 is described as an example of the first embodiment, and a server device 200 is described as an example of the second embodiment.
[0027] 2. Embodiment 1 (1) Configuration of Server Device 100 FIG. 4 is a block diagram showing the configuration of the server device 100 of this embodiment. The same reference numbers are used for the same configurations and functions as those disclosed in FIG. 1. The server device 100 of this embodiment includes a receiving unit 101 that receives a "connection request signal" and data from a plurality of client communication devices 10, a first execution unit 103 that executes a "first thread that performs a first high-load processing", a second execution unit 104 that executes a "second thread that performs a second high-load processing", and a thread allocation unit 102 that assigns whether the data received from the client communication device 10 is to be processed in the first thread or the second thread based on a connection request signal received from the client communication device 10. Each time a client communication device 10 is newly connected to the server device 100, the thread allocation unit 102 assigns whether the data received from the newly connected client communication device 10 is to be processed in the first thread or the second thread. This allocation is performed for all client communication devices 10 connected to the server device 100. This allocation may also be performed based on a predetermined rule described below. The main differences between the server device 100 of the first embodiment and the server device shown in FIG. 1 are that the server device 100 is provided with at least two execution units and has a thread allocation unit 102. The number of execution units that execute threads performing high-load processing may be three or more. In that case, the terms "first" and "second" in the first and second execution units refer to two of the three or more execution units. The same applies to the following embodiments. Where: The "thread for high-load processing" may be any thread for executing a task that places a high processing load on the server device, such as a transmission thread for transmitting data from the server device to an external device such as a cloud application or storage, or a thread for analyzing or processing data received from a client communication device within the server device. The "connection request signal" is a signal that is transmitted to request a connection to a server device, for example, after the key in the vehicle is turned on and the communication device in the vehicle is started.
[0028] (2) Multi-thread processing method Fig. 5 is a flowchart showing the operation of the multithread processing of the server device of this embodiment. The operation disclosed in Fig. 5 shows the processing procedure of the multithread processing method executed by the server device 100 disclosed in Fig. 4, or the multithread processing program executable by the server device 100. Note that these processes are not limited to the order shown in Fig. 5. In other words, the order may be changed as long as there is no constraint such as a relationship in which a certain step utilizes the result of the previous step. This point is also true for other figures showing flowcharts of the present application.
[0029] (Initial operation) In the server device 100, a first thread for performing a first high-load processing and a second thread for performing a second high-load processing are started (S101). The first thread is executed by a first execution unit 103, and the second thread is executed by a second execution unit 104. When a new client communication device 10 is connected to the server device 100, the client communication device 10 transmits a connection request signal to the server device 100 (S102). Since there are 1 to N client communication devices 10 (N is any integer equal to or greater than 2), all client communication devices 10 transmit a connection request signal when connecting to the server device. The client communication device 10 also transmits data to the server device 100 at any timing (S104). A receiving unit 101 of the server device 100 receives the connection request signal and data transmitted from the client communication device 10. When the receiving unit 101 receives a connection request signal from a new client communication device 10, the thread allocation unit 102 allocates a thread for processing the data (S103). As explained in the configuration of the server device 100 in Fig. 3, "allocating a thread" refers to a process of allocating whether the first thread or the second thread is to process the data received from the new client communication device 10, based on the connection request signal of the new client communication device 10. This allocation may be performed based on a predetermined rule that will be explained below. As described above, one client communication device 10 is assigned to a first or second high-load processing thread among a plurality of high-load processing threads. In other words, one high-load processing thread (first thread or second thread) processes data received from any number of client communication devices 10.
[0030] (Data Processing) After the receiving unit 101 receives data from the client communication device 10, it identifies the client communication device 10 from header information in the data to determine the thread in which the data is to be stored (S105). If it is determined that the data should be stored in the first thread, it stores the data in the first thread (S106). Similarly, if it is determined that the data should be stored in the second thread, it stores the data in the second thread (S107). Since each client communication device 10 is linked to the first or second thread in the above-mentioned step of allocating threads (S103), after the receiving unit 101 receives data, it is possible to determine whether the thread in which the data is to be stored is the first thread or the second thread by identifying the client communication device 10 that transmitted the data. The data stored in the first thread undergoes a predetermined process in the first execution unit 103, and the data stored in the second thread undergoes a predetermined process in the second execution unit 104. Optionally, the first thread and the second thread are "processed in parallel" (S108). The definition and effects of parallel processing will be described in detail below. Here, "processed in parallel" includes cases where at least a portion of the processing of one thread is executed simultaneously in parallel with at least a portion of the processing of the other thread, as well as cases where all of the processing of one thread is executed simultaneously in parallel with a portion of the processing of the other thread.
[0031] (3) Prescribed allocation rules When the thread allocation unit 102 allocates threads for processing data (S103), the allocation may be performed according to a predetermined allocation rule. The predetermined allocation rule may be any rule (including an algorithm) previously set for determining the thread to be allocated. Examples of the predetermined allocation rule include: (i) determining the thread to be allocated to perform high-load processing according to the CPU utilization rate of the entire system when the client communication device 10 is connected to the server device 100; (ii) determining the thread to be allocated to perform high-load processing according to the order in which the client communication device 10 is connected to the server device 100, for example, in the order of odd number or even number; and (iii) comparing the number of client communication devices 10 already allocated to threads performing high-load processing, and sequentially allocating the client communication devices 10 to the threads performing high-load processing that have the fewest number. The allocation according to the CPU utilization rate of the entire system in the above (i) will be described in detail in the second embodiment.
[0032] (4) Multithreaded processing using two high-load processing threads Fig. 6 is a diagram showing the relationship between the CPU and threads when the processes of this embodiment are executed simultaneously in parallel. The difference from the configuration disclosed in Fig. 3 is that two or more threads performing high-load processing are provided (threads J1 and J2 in Fig. 6(a)), and two threads performing high-load processing are processed in parallel (threads J1 and J2 in Fig. 6(b)). In Fig. 6(b), the first CPU 1 executes thread J1, the third CPU 3 executes thread J2, and the fourth CPU 4 executes threads B and C, which is different from the configuration in Fig. 3(b). In this embodiment, a first thread J1 performing a first high-load process J1 is executed by a first CPU 1, and a second thread J2 performing a second high-load process J2 is executed by a third CPU 3, and the first thread J1 and the second thread J2 are processed in parallel. For example, the thread J1 processes data received from the first, third and fifth client communication devices 10, and the thread J2 processes data received from the second, fourth and sixth client communication devices 10.
[0033] Comparing FIG. 6(b) with FIG. 3(b), the heavy load on the first CPU1 is reduced. In addition, the first CPU1, the third CPU3, and the fourth CPU4 can be used efficiently. The efficient use of the third CPU3 and the fourth CPU4 is noticeable when the processing time of thread B or thread C is shorter than the processing time of thread J. Similarly, the efficient use of the first CPU1 and the third CPU3 is noticeable when thread J1 executed by the first CPU1 and thread J2 processed by the third CPU3 are processed in parallel.
[0034] (5) Summary As described above, according to this embodiment, multiple threads performing high-load processing are used, and a thread performing a first or second high-load processing is assigned to one client communication device 10, thereby efficiently using the CPU resources of the server device 100 and contributing to reducing communication delays and improving throughput.
[0035] 3. Embodiment 2 (1) Configuration of Server Device 200 FIG. 7 is a block diagram showing the configuration of a server device 200 of this embodiment. The same reference numerals are used for the same configurations and functions as those disclosed in FIGS. 1 and 4. The server device 200 of this embodiment has a first transmission unit 201 that transmits data received from a predetermined client communication device 10 to an external device 203, and a second transmission unit 202 that transmits data received from a predetermined client communication device 10 other than the predetermined client communication device 10 to the external device 203, instead of the first execution unit 103 and the second execution unit 104. That is, the server device 200 of the second embodiment corresponds to the case where the first high-load processing and the second high-load processing of the first embodiment are transmission of data to the external device 203, and is a configuration example where the thread performing the high-load processing is a transmission thread. The first transmission unit 201 executes a first transmission thread in a first CPU1 of the multiple CPUs 106, and the second transmission unit 202 executes a second transmission thread in a second CPU2 of the multiple CPUs 106. In this embodiment, the thread allocation unit 102 is further connected to a plurality of CPUs 106, and receives information regarding the utilization rate of each CPU at regular intervals. The receiving unit 101 may also include a data queue 1 corresponding to the first transmitting unit 201 and a data queue 2 corresponding to the second transmitting unit 202. In addition, the device may have a transmitting unit that executes a thread to transmit data to an external device 203, and the transmitting unit executes the thread on a first CPU1, and when the first CPU1 exceeds a predetermined utilization rate, a second thread is started and executed on a second CPU2, thereby becoming a second transmitting unit 202, and the transmitting unit may also be configured as a first transmitting unit 201.
[0036] (2) Multi-thread processing method 8 is a flowchart showing the operation of the multi-thread processing of the server device 200 of this embodiment. The same reference numerals are used for the same methods and functions as those in FIG.
[0037] (Initial operation) In the server device 200, a first transmission thread and a second transmission thread are started (S200). The first transmission thread is executed in the first transmission unit 201, and the second transmission thread is executed in the second transmission unit 202. As in the first embodiment, the thread allocation unit 102 may allocate threads for processing data (S103) according to a predetermined rule. Furthermore, in this embodiment, the first transmission thread or the second transmission thread is allocated according to the CPU usage rate of the entire system when the client communication device 10 is connected to the server device 200. Details will be described later.
[0038] (Data Processing) After the receiving unit 101 receives data from the client communication device 10, the receiving unit 101 identifies the client communication device 10 that is the sender of the data to determine the thread in which the data is to be stored (S105). If the receiving unit 101 determines that the data should be stored in the first transmission thread, the receiving unit 101 stores the data in the first transmission thread (S201). Similarly, if the receiving unit 101 determines that the data should be stored in the second transmission thread, the receiving unit 101 stores the data in the second transmission thread (S202). As an option, the data may be stored in a data queue 1 and a data queue 2 provided in the receiving unit 101 before being stored in the first transmission thread and the second transmission thread (S204, S205). In this case, if the thread allocation unit 102 allocates the first transmission thread, the data is stored in the data queue 1, and the first transmitting unit 201 reads the data from the data queue 1 and transmits it to the external device 203. Similarly, when the thread allocation unit 102 allocates a second transmission thread, the data is stored in the data queue 2 , and the second transmission unit 202 reads the data from the data queue 2 and transmits it to the external device 203 . Optionally, the first transmission thread and the second transmission thread are processed in parallel to transmit the respective stored data to an external device (S203).
[0039] (3) Thread allocation flow based on CPU usage The operation of allocating an appropriate transmission thread (high-load processing thread) to a new client communication device 10 when the new client communication device 10 is connected to the server device 200 in accordance with the CPU usage rate of the entire system at that time will be explained using Figures 9 and 10. FIG. 9 is a flow diagram showing a main routine for thread allocation operated by the thread allocation unit 102. The thread allocation unit 102 receives a connection request signal transmitted from a client communication device 10 newly connected to the server device 200 via the receiving unit 101 (S301). Then, a transmission thread allocation destination is obtained from a subroutine described below (S302). Then, the transmission thread allocated in S302 is allocated to the newly connected client communication device 10 (S303). Then, the average value of the CPU load is cleared (S304). In this manner, each time a new client communication device 10 connects to the server device 200, the main routine for thread allocation is executed.
[0040] FIG. 10 is a flow diagram showing a thread allocation subroutine. The thread allocation unit 102 acquires the usage rate of the first CPU that executes the first transmission thread and the usage rate of the second CPU that executes the second transmission thread (S401). Then, the average value (U1) of the CPU load of the first transmission thread and the average value (U2) of the CPU load of the second transmission thread are calculated (S402). The average value (U1) is compared with the average value (U2) (S403), and if the average value (U1) is larger, that is, if the usage rate of the first CPU that executes the first transmission thread is higher, it is determined that the new client communication device 10 is assigned to the second transmission thread when it is connected (S404). If the average value (U1) is smaller than the average value (U2), that is, if the usage rate of the second CPU that executes the second transmission thread is higher, it is determined that the new client communication device 10 is assigned to the first thread when it is connected (S405). After the assignment destination is determined, the process returns to the first step S401. As an example, if three client communication devices 10 are assigned to a first transmission thread and the average value (U1) of the first CPU load executing the first transmission thread is 50%, and another three client communication devices 10 are assigned to a second transmission thread and the average value (U2) of the second CPU load executing the second transmission thread is 30%, the subroutine determines that the newly connected client communication device 10 will be assigned to the second transmission thread.
[0041] (5) Summary As described above, according to this embodiment, by using multiple transmission threads and assigning a first or second transmission thread to one client communication device 10, the CPU resources of the server device 200 are used efficiently, contributing to reducing communication delays and improving throughput. Furthermore, according to this embodiment, by allocating transmission threads in accordance with the utilization rate of the CPU that executes the transmission threads, it is possible to realize further efficient use of CPU resources.
[0042] 4. Other configurations of the server device 100 of the first embodiment and the server device 200 of the second embodiment 11, the server devices 100, 200 may include multiple CPUs 106 and a memory 300. The memory 300 holds instructions for causing the server devices 100, 200 to execute the above-mentioned multi-thread processing, and the instructions are executed by the multiple CPUs 106.
[0043] The present invention may be described in the following sections.
[0044] Item 1: A computing system (server device) (100, 200), A processor (CPU) (106); at least one memory (300) storing instructions that, when executed by the processor, cause the computing system to perform the steps of: wherein the instructions include: receiving a connection request signal and data from the client communication device (S102, S103); A step (S100) of starting a first thread for performing a first high-load process and a second thread for performing a second high-load process; a step of allocating, based on the connection request signal, whether the data received from the client communication device is to be processed by the first thread or the second thread (S103); A computing system comprising: Item 2: 2. The computing system of claim 1, wherein the first high-load process and the second high-load process are transmission of the data to an external device. Item 3: The server device has multiple CPUs, executing the first thread on a first CPU, the first CPU being one of the plurality of CPUs; executing the second thread on a second CPU that is another CPU of the plurality of CPUs; A step (S203) in which the first thread and the second thread are processed in parallel; 3. The computing system of claim 1 or 2, further comprising: Item 4: A step of obtaining the first CPU utilization rate and the second CPU utilization rate (S401, S402); a step of allocating the first thread when the first CPU utilization rate is lower than the second CPU utilization rate (S403, S405); a step of allocating the second thread when the second CPU utilization rate is lower than the first CPU utilization rate (S403, S404); 4. The computing system of any one of claims 1 to 3, further comprising:
[0045] 5. Summary The features of the server device and the like in each embodiment of the present invention have been described above.
[0046] The terms used in each embodiment are merely examples and may be replaced with synonymous terms or terms having the same functions.
[0047] The block diagrams used to explain the embodiments classify and organize the configuration of the device by function. The blocks showing the respective functions are realized by any combination of hardware or software. In addition, since the block diagrams show the functions, they can also be understood as disclosures of a method invention and a program invention that realizes the method.
[0048] The order of the functional blocks that can be understood as the processes, flows, and methods described in each embodiment may be changed as long as there are no constraints such as a relationship in which one step utilizes the results of another step prior to it.
[0049] The terms first, second, through Nth (N is an integer) used in each embodiment and in the claims are used to distinguish two or more configurations or methods of the same type, and do not limit the order or superiority or inferiority.
[0050] Each embodiment is based on the premise that a server device is connected to a client communication device mounted on a mobile object such as an automobile, but the present invention also includes a server device connected to a dedicated or general-purpose client communication device other than a mobile object, unless otherwise limited in the claims.
[0051] In addition, the present invention can be realized not only by dedicated hardware having the configuration and functions described in each embodiment, but also as a combination of a program for realizing the present invention recorded on a recording medium such as a memory or a hard disk, and general-purpose hardware having a dedicated or general-purpose CPU and memory capable of executing the program. [Industrial Applicability]
[0052] The server device of the present invention is intended primarily for server devices to which client communication devices mounted on mobile objects such as automobiles are connected, but may also be intended for server devices to which client communication devices not mounted on mobile objects are connected. [Explanation of symbols]
[0053] 10 client communication device, 11 receiving unit, 12 transmitting unit, 13 transmitting unit, 14 receiving unit, 15 transmitting / receiving socket, 16 transmitting / receiving socket, 17 external device, 18 multiple CPUs, 100 server device, 101 receiving unit, 102 thread allocation unit, 103 first execution unit, 104 second execution unit, 106 multiple CPUs, 200 server device, 201 first transmission unit, 202 second transmission unit, 203 external device, 300 memory
Claims
1. A server device (200) connected to a plurality of client communication devices (10), A receiving unit (101) for receiving a connection request signal and data from the client communication device; a first transmission unit (201) that executes a first thread for transmitting the data to an external device (203); a second transmission unit (202) that executes a second thread to transmit the data to the external device; a thread allocation unit (102) that allocates whether the data received from the client communication device is to be transmitted using the first thread or the second thread based on the connection request signal; Server device.
2. the receiving unit has a first queue and a second queue; the receiving unit stores the data in the first queue when the thread allocating unit allocates the first thread, and stores the data in the second queue when the thread allocating unit allocates the second thread; the first transmission unit reads the data from the first queue and transmits the data to the external device; the second transmission unit reads the data from the second queue and transmits the data to the external device; The server device according to claim 1.
3. The server device has a plurality of CPUs (106), the first transmission unit executes the first thread on a first CPU that is one of the plurality of CPUs; the second transmission unit executes the second thread in a second CPU that is another CPU among the plurality of CPUs; the first thread and the second thread are processed in parallel. The server device according to claim 1.
4. the thread allocation unit determines the first CPU utilization rate and the second CPU utilization rate; allocating the first thread if the first CPU utilization is lower than the second CPU utilization; allocating the second thread if the second CPU utilization is lower than the first CPU utilization; 4. The server device according to claim 3.
5. a transmission unit that executes a thread for transmitting the data to the external device, the transmission unit executing the thread on the first CPU; when the first CPU exceeds a predetermined usage rate, starting the second thread and executing the second thread in the second CPU to function as the second transmission unit, and causing the transmission unit to function as the first transmission unit; 4. The server device according to claim 3.
6. The client communication device is mounted on a mobile object. The server device according to claim 1.
7. The data is an image captured by an imaging device mounted on the moving object.
7. The server device according to claim 6.
8. A multi-thread processing method executed in a server device connected to a plurality of client communication devices, comprising: A connection request signal and data are received from the client communication device (S102, S104); A first thread for transmitting the data to an external device and a second thread for transmitting the data to the external device are started (S101, S200); Based on the connection request signal, the data received from the client communication device is assigned to either the first thread or the second thread (S103); Multithreading method.
9. The server device has a plurality of CPUs, executing the first thread on a first CPU that is one of the plurality of CPUs; executing the second thread on a second CPU that is another CPU among the plurality of CPUs; The first thread and the second thread are processed in parallel (S108, S203).
9. The multithread processing method according to claim 8.
10. The first CPU utilization rate and the second CPU utilization rate are obtained (S401, S402); If the first CPU utilization rate is lower than the second CPU utilization rate, the first thread is allocated (S403, S405); If the second CPU utilization rate is lower than the first CPU utilization rate, the second thread is allocated (S403, S404).
10. The multithread processing method according to claim 9.
11. A multi-thread processing program executable on a server device connected to a plurality of client communication devices, A connection request signal and data are received from the client communication device (S102, S104); A first thread for transmitting the data to an external device and a second thread for transmitting the data to the external device are started (S101, S200); Based on the connection request signal, the data received from the client communication device is assigned to either the first thread or the second thread (S103); Multi-threaded programs.
Citation Information
Patent Citations
Server
JP2001216260A
Uninterruptible memory replication method
JP2008009797A
Platform device, program, and system
JP2013015968A
Information processor, information processing method, and information processing program
JP2013054451A
Data reference server, database system, and charge management system
JP2022045421A
