Communication method and device

By scheduling task requests for different services to the same thread in the Internet of Things devices, the multi-threading management problem caused by device resource constraints is solved, and the effect of improving resource utilization and enhancing communication capabilities is achieved.

CN119938241APending Publication Date: 2025-05-06HUAWEI TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311470124.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-06
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

Due to the limitation of CPU and memory resources, IoT devices are difficult to enable multiple threads at the same time, and cannot effectively maintain communication needs between multiple IoT devices.

Method used

By generating task requests and scheduling them to the same thread for processing, task requests for different businesses share the same thread, thereby increasing the concurrent number of task requests and saving computing and storage resources.

Benefits of technology

It improves resource utilization, can provide services to multiple services, and enhances the communication capabilities of IoT devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119938241A_ABST
    Figure CN119938241A_ABST
Patent Text Reader

Abstract

The communication method and device provided by the embodiment of the invention are applied to first Internet of Things equipment, and the method comprises the steps that the first Internet of Things equipment generates a first task request and a second task request; the first task request is used for indicating to process data of a first service, and the second task request is used for indicating to process data of a second service; the first service and the second service need long-term communication, and the service volume is smaller than a first threshold value; the first service is different from the second service; and the first Internet of Things equipment schedules the first task request and the second task request to a first thread for processing. Therefore, thread scheduling of the task request can be realized, and the resource utilization rate is improved, so that services for multiple businesses are provided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet of Things, and in particular to a communication method and device. Background Art

[0002] In the Internet of Things (IoT) networking, multiple IoT devices (including control devices and controlled devices) communicate through wireless network communication technology (WIFI) or wired connections. When multiple IoT devices communicate, each service usually needs to occupy a thread to manage and store task requests related to the service. However, since the central processing unit (CPU) and memory resources of IoT devices are very limited, it is difficult to start multiple threads at the same time, and it is impossible to serve multiple services at the same time, and it is impossible to maintain the communication needs between multiple IoT devices. Summary of the invention

[0003] The embodiments of the present application provide a communication method and device for implementing thread scheduling of task requests, improving resource utilization, and thus providing services for multiple businesses.

[0004] In a first aspect, applied to a first IoT device, the method includes: the first IoT device generates a first task request and a second task request; the first task request is used to indicate processing of data of a first business, and the second task request is used to indicate processing of data of a second business; the first business and the second business are both businesses that require long-term communication and whose business volume is less than a first threshold; the first business is different from the second business; the first IoT device schedules the first task request and the second task request to the first thread for processing.

[0005] By adopting this method, task requests corresponding to different businesses can share the same thread, thereby increasing the number of concurrent task requests at the same time, saving computing resources and storage resources of IoT devices, improving resource utilization, and being able to provide services for multiple businesses.

[0006] In one possible design, the process of scheduling the first task request and the second task request to the first thread for processing includes: the first IoT device obtains a first correspondence between the first business and the first thread, and a second correspondence between the second business and the first thread; the first IoT device schedules the first task request and the second task request to the first thread for processing based on the first correspondence and the second correspondence.

[0007] With such a design, the first IoT device can schedule the task request to the corresponding thread process for processing based on the stored correspondence, thereby improving communication accuracy.

[0008] In a possible design, the method also includes: when the first task request is the first task request of the first business, the first IoT device stores a first corresponding relationship; when the second task request is the first task request of the second business, the first IoT device stores a second corresponding relationship.

[0009] With such a design, the first IoT device can store the correspondence between services and threads, so that task requests can be scheduled to corresponding thread processes for processing, thereby improving communication accuracy.

[0010] In one possible design, before scheduling the first task request and the second task request to the first thread for processing, the method also includes: the first Internet of Things device determines a first number of task requests to be scheduled; the task requests to be scheduled include the first task request and the second task request; the first Internet of Things device determines that the first number is less than or equal to the concurrency number; the concurrency number is determined based on the second number of task requests currently being processed and the concurrency threshold.

[0011] With such a design, the first IoT device can control the number of task requests processed simultaneously in the first thread to not exceed the concurrency threshold, thereby avoiding congestion within the first thread.

[0012] In one possible design, the method also includes: the first IoT device receives a first message from the second IoT device, the first message is used to indicate the establishment of a first connection between the first IoT device and the second IoT device; the first connection is used to indicate a scheduling method for task requests corresponding to services that require long-term communication and have a business volume less than a first threshold; the first IoT device sends a second message to the second IoT device based on the first message, the second message is used to indicate agreement to establish the first connection; the first IoT device receives a third message from the second IoT device, the third message is used to indicate that the first connection has been established.

[0013] With such a design, a specific connection relationship (e.g., a concurrent connection) is established between the IoT device that initiates the task request (e.g., the first IoT device) and the target device of the task request (e.g., the second IoT device), thereby determining the scheduling method for services that require long-term communication and have a business volume less than a first threshold under the connection relationship, thereby saving resource overhead.

[0014] In one possible design, the first message includes a first field, the second message includes the first field, and the third message includes the first field; wherein the first field is a first value or a second value, the first value is an identifier of a first connection, the second value is an identifier of a second connection, and the second connection is used to indicate a scheduling method for a task request corresponding to a temporary communication or a service whose traffic volume is greater than a first threshold.

[0015] With such a design, the connection mode can be distinguished through the first field in the message, that is, the type of service can be distinguished, thereby determining the scheduling mode corresponding to the service, which can save resource overhead.

[0016] In one possible design, the first thread is used to manage pending task requests. The method also includes: the first IoT device schedules the first task request and the second task request to the second thread for processing, and the second thread is used to store data corresponding to the pending task requests.

[0017] With such a design, the first IoT device can assist the first thread in implementing some functions through the second thread, thereby improving the matching degree of thread work and improving resource utilization.

[0018] In a second aspect, the present application further provides a communication device. The communication device can execute the above method design. The communication device can be a chip or circuit capable of executing the function corresponding to the above method, or a device including the chip or circuit.

[0019] In one possible design, the communication device includes a communication unit for receiving and sending data; the communication device also includes a processing unit for implementing the steps in the above method. The above functions can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more units corresponding to the above functions.

[0020] In a third aspect, the present application also provides a communication device. The communication device can execute the above method design. The communication device includes: a memory for storing computer executable program code; and a processor, the processor is coupled to the memory. The program code stored in the memory includes instructions, and when the processor executes the instructions, the communication device or a device equipped with the communication device executes the method in any possible design above.

[0021] The communication device may further include a communication interface; or, if the communication device is a chip or a circuit, the communication interface may be an input / output interface of the chip, such as an input / output pin.

[0022] In a fourth aspect, the present application provides a communication system, the communication system comprising one or more devices in a terminal device executing the first aspect and / or a network device executing the second aspect.

[0023] In a fifth aspect, the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a device, it executes the method in any possible design described above.

[0024] In a sixth aspect, the present application provides a computer program product, wherein a computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called by a computer, they execute the method in any one of the possible designs described above.

[0025] In a seventh aspect, the present application provides a chip comprising a processor and a memory; the processor is coupled to the memory and is used to read a computer program stored in the memory and execute a method in any possible design described above.

[0026] In addition, the technical effects brought about by the second to seventh aspects can be found in the description of the first aspect above and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 A schematic diagram of the architecture of a communication system provided in an embodiment of the present application;

[0028] Figure 2 A flow chart of a communication method provided in an embodiment of the present application;

[0029] Figure 3a A thread scheduling diagram provided for an embodiment of the present application;

[0030] Figure 3b Another thread scheduling diagram provided for an embodiment of the present application;

[0031] Figure 4a A communication example diagram provided for an embodiment of the present application;

[0032] Figure 4b Another communication example diagram provided for an embodiment of the present application;

[0033] Figure 4c Another communication example diagram provided for an embodiment of the present application;

[0034] Figure 5 A flowchart of another communication method provided in an embodiment of the present application;

[0035] Figure 6a An example diagram of a message provided in an embodiment of the present application;

[0036] Figure 6b Another example diagram of a message provided in an embodiment of the present application;

[0037] Figure 7a An example diagram of a handshake provided in an embodiment of the present application;

[0038] Figure 7b Another handshake example diagram provided for an embodiment of the present application;

[0039] Figure 8A schematic diagram of the structure of a communication device provided in an embodiment of the present application;

[0040] Fig. 9 A schematic diagram of the structure of another communication device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and beneficial effects of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0042] In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this application is merely a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of this application, "at least one" means one or more items, and "multiple items" means two or more items. In the description of this application, words such as "first" and "second" are only used for the purpose of distinguishing the description, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.

[0043] The communication method provided in the embodiment of the present application can be applied to the communication architecture of the Internet of Things, which generally includes multiple IoT devices, and the multiple IoT devices include at least one control device and at least one controlled device, without specific limitation. The IoT device is generally an IoT device with low CPU performance (for example: a low-end IoT device or a high-end IoT device), with limited memory and computing resources; the CPU of the low-end IoT device is a 2-core 1.2GHz ARM, and the memory size of the low-end IoT device is 128MB; the CPU of the high-end IoT device is a 4-core 1GHz ARM, and the memory size of the high-end IoT device is 2GB.

[0044] Optionally, the IoT device may be a terminal device. The following is an example of possible implementation forms and functions of the terminal device. The terminal device, also known as user equipment (UE), mobile station (MS), mobile terminal (MT), etc., is a device that provides voice and / or data connectivity to users. For example, the terminal device 102 includes a handheld device with a wireless connection function, a vehicle-mounted device, etc. At present, the terminal device 102 can be: a mobile phone, a tablet computer, a laptop computer, a PDA, a mobile internet device (MID), a wearable device (such as a smart watch, a smart bracelet, a pedometer, etc.), a vehicle-mounted device (such as a car, a bicycle, an electric car, an airplane, a ship, a train, a high-speed train, etc.), a virtual reality (VR) device, an augmented reality (AR) device, a wireless terminal in industrial control, a smart home device (such as a refrigerator, a television, an air conditioner, an electric meter, etc.), an intelligent robot, a workshop equipment, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, or a wireless terminal in a smart home, a flying device (such as an intelligent robot, a hot air balloon, a drone, an airplane), etc.

[0045] The method provided in the embodiment of the present application can be executed by an IoT device, or by a component of the IoT device (such as a processor, a chip, or a chip system, etc.).

[0046] Figure 1 The structure of a communication system applicable to the embodiment of the present application is shown. Figure 1 As shown, the communication system 100 includes a control device 101 and at least one controlled device 102, and the control device 101 and the controlled device 102 communicate via WIFI (illustrated by thick arrows in the figure) or a wired connection (not shown in the figure). Figure 1 As shown, when communication is achieved through WIFI, one or more access points (APs) may be deployed between the control device 101 and the controlled device 102 .

[0047] Exemplarily, the communication system 100 can be applied in a smart home scenario; the control device 101 can be a control center device (such as a mobile phone, watch, or other IoT device), and the control device 101 is connected to the WIFI in the smart home scenario; the controlled device 102 can be any smart home appliance (such as a computer, lamp, rice cooker, refrigerator, washing machine, socket, or other IoT device), and the controlled device 102 is connected to the WIFI in the smart home scenario.

[0048] In order to implement thread scheduling of task requests, improve resource utilization, and thus provide services for multiple businesses, the present application embodiment provides a communication method. The communication method can be in the aforementioned Figure 1 The communication method provided in the embodiment of the present application will be introduced below in conjunction with the accompanying drawings.

[0049] Figure 2 A communication method provided in an embodiment of the present application may include the following steps:

[0050] S201: The first IoT device generates a first task request and a second task request; the first task request is used to instruct the processing of data of the first service, and the second task request is used to instruct the processing of data of the second service; the first service and the second service are both services that require long-term communication and whose service volume is less than a first threshold; the first service and the second service are different. Figure 1 In the communication system shown in the figure, the first IoT device in the embodiment of the present application may be the aforementioned control device 101 or the aforementioned controlled device 102.

[0051] S202: The first IoT device schedules the first task request and the second task request to the first thread for processing.

[0052] Optionally, the first thread is used to manage (including memory management, congestion management, and reliability management) pending task requests, and the first IoT device can also dispatch the first task request and the second task request to the second thread for processing, and the second thread is used to store data corresponding to the pending task request. In this way, the second thread can match the shared cache, and can allocate resources according to the working modes of different threads during the processing of task requests, thereby reducing the consumption of memory resources.

[0053] Optionally, the first IoT device may generate different task requests for the same business, which is not limited in this application. For example, assuming that the first task request is used to indicate the processing of the first data of the first business, the first IoT device may also generate a third task request, and the third task request is used to indicate the processing of the second data of the first business. Accordingly, different task requests generated for the same business may be processed in the same manner. For example, assuming that the first task request is successively scheduled to the first thread and the second thread process for processing, the first IoT device may successively schedule the third task request to the first thread and the second thread for processing.

[0054] In traditional communication methods, IoT devices manage and store task requests corresponding to different services separately, and schedule them to different threads for processing.

[0055] For example, Figure 3a A thread scheduling diagram is provided for an embodiment of the present application, assuming that the thread scheduling process is processed based on the transmission control protocol (TCP).

[0056] The IoT device establishes a connection identified as TCP 1 for service 1, and dispatches the task request related to service 1 to thread 1 for processing; the IoT device establishes a connection identified as TCP 2 for service 2, and dispatches the task request related to service 2 to thread 2 for processing; the IoT device establishes a connection identified as TCP p for service p, and dispatches the task request related to service p to thread p for processing; in the process of each thread sending the corresponding message to the WIFI network (or the receiving end), each thread competes in an unordered manner. With such a communication method, the IoT device needs to start a thread for each service to process the task request of the service. Each thread is managed and stored independently, and the communication overhead is very large, occupying a large amount of computing resources and storage resources. Since the IoT device usually has poor CPU performance and small memory space, it cannot support the simultaneous startup of hundreds or thousands of threads, and cannot meet the processing requirements of more services.

[0057] However, using the communication method shown in the aforementioned steps S201 to S202, for different services (such as the first service and the second service) that require long-term communication and whose service volume is less than the first threshold, the first IoT device only starts the first thread (and the second thread), thereby processing the task request process corresponding to the different services. Among them, the second thread can be identified by an adaptive transmission protocol (ATP) agent. ATP is a data transmission protocol constructed in the embodiment of the present application. The content of the protocol will be described in detail later and will not be expanded here.

[0058] For example, Figure 3b Another thread scheduling diagram provided for the embodiment of the present application, the first IoT device establishes a connection identified as ATP a for service a, establishes a connection identified as ATP b for service b, and establishes a connection identified as ATP q for service q; accordingly, the aforementioned q types of connections share the resources of thread a (and thread b), and the first IoT device schedules all task requests related to services a, b, and q to thread a (and thread b) for processing; in the process of thread a (and thread b) sending the corresponding message to the WIFI network (or the receiving end), orderly competition is carried out between the data transmissions within the threads. In this way, task requests corresponding to different services can share thread a (and thread b), reducing the communication overhead corresponding to each connection.

[0059] By adopting the communication method shown in step S201 to step S202, task requests corresponding to different businesses can share the same thread, thereby increasing the concurrent number of task requests at the same time, saving computing resources and storage resources of IoT devices, improving resource utilization, and being able to provide services for multiple businesses.

[0060] In a possible design of the aforementioned step S202, the process of the first IoT device scheduling the first task request and the second task request to the first thread for processing includes: the first IoT device obtains the first correspondence between the first service and the first thread, and the second correspondence between the second service and the first thread; the first IoT device schedules the first task request and the second task request to the first thread for processing according to the first correspondence and the second correspondence. In this way, the first IoT device can schedule the task request to the corresponding thread process for processing based on the stored correspondence, thereby improving communication accuracy.

[0061] Optionally, when the first task request is the first task request of the first business, the first corresponding relationship is stored; when the second task request is the first task request of the second business, the second corresponding relationship is stored. For example, the first IoT device can add the socket corresponding to the first business to the first thread, and the first IoT device can also add the socket corresponding to the second business to the first thread. In this way, for the first task request of any business, the first IoT device can store the corresponding relationship between multiple businesses (the first business and the second business) and the first thread, so that the first IoT device can schedule the subsequently generated task requests for the business based on the corresponding relationship.

[0062] It should be understood that if the first IoT device also needs to enable other threads (such as the second thread) to process task requests corresponding to services that require long-term communication and whose service volume is less than the first threshold, the first IoT device can also use the aforementioned design method to store the corresponding relationship between the aforementioned multiple services (the first service and the second service) and other threads (such as the second thread). For example, the first IoT device can also add the socket corresponding to the first service and the socket corresponding to the second service to other threads (such as the second thread).

[0063] In the communication architecture of the Internet of Things (IoT), the complete processing of a task request includes: the IoT device sends a request message (usually less than 1KB) corresponding to the task request, and the IoT device receives a response message (such as an ACK message) corresponding to the task request. In other words, as long as the IoT device does not receive a response message corresponding to the task request, the IoT device determines that the task request is still being processed. Since the data volume of the request message is small, usually only one message is required. If the request message is lost, the corresponding response message will not be received; based on the timeout retransmission mechanism (retransmission timeout, RTO) of the point-to-multipoint master (point2multiple point, P2MP), when the IoT device does not receive a response message within a period of time after sending the request message, the IoT device needs to resend the request message; until the IoT device receives the response message or receives the indication information to interrupt the task request.

[0064] In traditional communication methods, the IoT device needs to start a thread for each service. When the IoT device does not receive a response message, the IoT device initiates a retransmission on the corresponding thread, that is, resends the request message corresponding to the task request. In the case of a weak WIFI network, a large number of retransmission operations will cause a retransmission storm within the thread. Taking the IoT device as the sender (or server) as an example, based on the traditional way of processing task requests, this application provides the following example (Example A).

[0065] Example A: Figure 4a As shown, the sending end may include multiple sending windows, and the sending end establishes a total of 100 connections corresponding to the services. The sending end generates task requests (ie, sends data) based on different connections; Figure 3aAs can be seen from the communication method shown, in the traditional communication method, task requests corresponding to different services are dispatched to different threads for processing. Each thread corresponds to a sending window. Different threads process independently (for example, send a request message identified as Pkt#1) and perform congestion control. There is no interaction between different threads (sending windows). The size of the sending window is related to the amount of data currently processed. The size of the sending window determines the size of the message sending rate in the sending window; when the IoT device receives a response message in a certain sending window, the size of the sending window increases; if there is packet loss (request message loss), the IoT device cannot receive the response message and needs to retransmit, then the size of the sending window is reduced. Based on this, in the case of a weak WIFI network, the IoT device may experience a retransmission storm in one thread, while another thread may be idle, resulting in a waste of resources.

[0066] Using the communication method shown in the aforementioned steps S201 to S202, the same thread processes task requests corresponding to multiple services, and the number of task requests may exceed the concurrency threshold that the thread can support. Therefore, in the case of a weak WIFI network, if the IoT device sends a large number of request messages in one thread at the same time, it may trigger a large number of retransmission messages based on RTO, causing a retransmission storm, thereby congesting the network and making it worse. Based on this, the present application provides the following design to avoid congestion:

[0067] Before executing step S202, the first IoT device may also determine a first number of task requests to be scheduled; the task requests to be scheduled include the aforementioned first task request and the aforementioned second task request; the first IoT device determines that the first number is less than or equal to the concurrent number; the concurrent number is determined based on the second number of task requests currently being processed and the concurrent threshold.

[0068] Optionally, the number of concurrent requests = the concurrent threshold - the second number.

[0069] Optionally, the task request currently being processed includes a task request for which the first IoT device has sent a request message and the first IoT device has not received a response message. Accordingly, assuming that the first IoT device receives a response message to a task request, it is determined that the processing of the task request has been completed and the corresponding concurrent resources are released (i.e., the second number is reduced and the number of concurrent resources is increased).

[0070] Based on the above design, the first IoT device may include a concurrency management module (or unified window), and the first IoT device controls the number of task requests processed simultaneously according to the concurrency threshold through the concurrency management module, and simultaneously controls the RTO of each task request through the concurrency management module. In this way, the first IoT device can ensure that the number of task requests processed simultaneously (including the number of retransmissions of the request message initiated) does not exceed the concurrency threshold, which can avoid retransmission storms and reduce transmission delays. Still taking the first IoT device as the server (or sending end) as an example, the first IoT device processes multiple task requests through the concurrency management module, and the present application provides the following examples (Example B and Example C).

[0071] Example B: Figure 4b As shown, assuming that the sending end establishes a total of 100 connections corresponding to the services, the sending end generates 100 task requests (i.e., sends data) based on different connections, the concurrency threshold of the first thread is n (e.g., n=10), and the second number of task requests being processed in the first thread (e.g., task requests corresponding to connection 1 and connection 2) is m (e.g., m=2), then the concurrency number i=nm (e.g., i=8); accordingly, the first IoT device schedules any 8 of the aforementioned 100 task requests (e.g., task requests corresponding to connection 3 to connection 10) to the first thread for processing (sending request messages and receiving response messages) through the concurrency management module, and the remaining 90 task requests need to wait for the next scheduling of the concurrency management module. Based on the processing method of example B, the number of task requests processed simultaneously by the first thread does not exceed the concurrency threshold, which can avoid congestion.

[0072] Example C: Figure 4c As shown, based on Figure 4b The processing method shown, assuming that after a period of time (preset time period), the sending end receives response messages corresponding to 7 task requests, then the concurrency management module releases 7 processing resources, and the second number of task requests being processed (retransmission due to connection timeout) is m' (m'=3), then the concurrency number i'=n-m' (i'=7), that is, the first IoT device can schedule any 7 of the aforementioned 90 task requests to the first thread for processing through the concurrency management module, and the remaining 83 task requests wait for the next scheduling of the concurrency management module; the subsequent processing methods are similar and will not be repeated here. Based on the processing method of example C, the task request waiting to be scheduled does not need to be retransmitted based on RTO, which can ensure that the number of task requests (including retransmissions) processed simultaneously by the first thread does not exceed the concurrency threshold, and congestion can be avoided.

[0073] With such a design, the first IoT device can control the number of task requests processed simultaneously in the first thread to not exceed the concurrency threshold, thereby avoiding congestion within the first thread.

[0074] Before processing a task request, it is necessary to ensure that a connection has been established between the IoT device that initiates the task request and the target device of the task request. An IoT device can maintain hundreds or even thousands of connections with multiple IoT devices at the same time. This application divides the connections between IoT devices into the following two types:

[0075] (1) Concurrent connection: A connection established between two IoT devices for long-term communication. In this connection mode, the amount of data transmitted between IoT devices is small.

[0076] (2) Data connection: A connection established between two IoT devices for temporary communication. In this connection mode, the amount of data transmitted between IoT devices is large. For data connection, IoT devices usually establish a connection when data transmission is required and disconnect after data transmission is completed.

[0077] It should be understood that the first service and the second service are services that require long-term communication and whose service volume is less than the first threshold. Therefore, the communication method shown in the aforementioned steps S201 to S202 is implemented on the basis of having established concurrent connections.

[0078] In one possible design, the first IoT device can interact with the second IoT device to establish a concurrent connection or a data connection. Figure 1 In the communication system shown in FIG. 1 , the second IoT device in the embodiment of the present application may be the aforementioned control device 101 or the aforementioned controlled device 102 . Figure 5 A method for establishing a connection provided in an embodiment of the present application comprises the following steps:

[0079] S501: The second IoT device sends a first message to the first IoT device; correspondingly, the first IoT device receives the first message from the second IoT device. The first message is used to indicate the establishment of a first connection between the first IoT device and the second IoT device; the first connection is used to indicate the scheduling method of a task request corresponding to a service that requires long-term communication and whose service volume is less than a first threshold.

[0080] S502: The first IoT device sends a second message to the second IoT device according to the first message; correspondingly, the second IoT device receives the second message from the first IoT device, wherein the second message is used to indicate that the first connection is agreed to be established.

[0081] S503: The second IoT device sends a third message to the first IoT device; correspondingly, the first IoT device receives the third message from the second IoT device, wherein the third message is used to indicate that the first connection has been established.

[0082] Optionally, the second IoT device is a target device of the first task request and / or the second task request.

[0083] Optionally, the first message includes the first field, the second message includes the first field, and the third message includes the first field; wherein the first field is a first value or a second value, the first value is an identifier of the first connection, the second value is an identifier of the second connection, and the second connection is used to indicate the scheduling method of the task request corresponding to the temporary communication or the service whose service volume is greater than the first threshold. For example, the first field is a setsocketopt field, and the setsocketopt field stores a type (type) parameter, and the value of the type parameter is a first value (01) or a second value (10), and the first value is used to indicate the scheduling method of the task request under the concurrent connection, and the second value is used to indicate the scheduling method of the task request under the data type connection. Optionally, the value of the type parameter can also be a third value (11), and the third value is used to identify the scheduling method under other connections, which is not specifically limited in this application.

[0084] Optionally, a corresponding transmission protocol stack is deployed in the first IoT device and the second IoT device, and the first IoT device (or the second IoT device) can generate the aforementioned first message (or the second message, the third message) according to the protocol corresponding to the transmission protocol stack. This application provides the following three protocols.

[0085] The first protocol: a protocol based on TCP; compared with TCP, the first protocol provided in the present application adds a first field in the message.

[0086] like Figure 6a As shown, the message generated based on the first protocol includes a source port field, a destination port field, a sequence number field, an acknowledgment number field, a data offset field, a reserved field, an urgent (URG) field, an acknowledgment (ACK) field, a push (PSH) field, a reset (RST) field, a synchronous (SYN) field, a finish (FIN) field, a window field, a checksum field, an urgent pointer field, an options field, a padding field, and a data field. The first protocol may be a field with a length of two bits (e.g., the two leftmost bits) in the aforementioned reserved field as the first field.

[0087] The second protocol: a protocol based on the user datagram protocol (UDP). Compared with UDP, the second protocol provided by the present application adds a first field in the message. Referring to the composition of the first protocol, it will not be expanded here.

[0088] The third protocol: a protocol constructed in this application, referred to as ATP.

[0089] like Figure 6b As shown, the message generated based on the third protocol includes a sequence field, a synchronous (SYN) field, an acknowledgment (ACK) field, a finish (FIN) field, a push (PSH) field, a type (type) field, a reserved (Rsv) field, and a window (Win) field. The value of the type field (i.e., the first field mentioned above) is 01, 10, or 11.

[0090] In this way, by adopting the method shown in steps S501 to S503, a specific connection relationship (e.g., a concurrent connection) is established between the IoT device that initiates the task request and the target device of the task request, thereby determining the scheduling method of services that require long-term communication and have a business volume less than a first threshold under the connection relationship, which can save resource overhead; in addition, a specific connection relationship (e.g., a data type connection) is established between the IoT device that initiates the task request and the target device of the task request, thereby determining the scheduling method of services that require temporary communication, which can improve resource utilization.

[0091] Based on the foregoing design, the embodiments of the present application provide two handshake examples.

[0092] Example 1: Handshake based on the first protocol. For example, in the embodiment of the present application, the first IoT device is the sender (or server), and the second IoT device is the receiver (or client); for another example, in the embodiment of the present application, the first IoT device is the receiver (or client), and the second IoT device is the sender (or server). Figure 7a As shown in the figure, the handshake process between the sender and the receiver includes:

[0093] First handshake: The sender sends a message 1 (eg, the first message) to the receiver. The message 1 includes a SYN field and a sequence number field. The message 1 also includes a field for identifying a concurrent connection.

[0094] Second handshake: The receiving end determines from message 1 that the sending end requires to establish a concurrent connection, and sends message 2 (for example, the second message) to the sending end. Message 2 is used to confirm that the request to establish a concurrent connection has been received. Message 2 includes a SYN field, an ACK field, and a sequence number field. Message 2 also includes a field for identifying a concurrent connection.

[0095] Third handshake: After receiving message 2, the sender sends message 3 (for example, the third message) to the receiver. Message 3 is used to confirm the establishment of a concurrent connection. Message 3 includes an ACK field and a sequence number field. Message 3 also includes a field for identifying a concurrent connection.

[0096] Example 2: Handshake based on any of the above protocols (general). Figure 7b As shown in the figure, the handshake process between the sender and the receiver includes:

[0097] First handshake: The sending end sends a message a (eg, a first message) to the receiving end, where the message 1 includes a field for identifying a concurrent connection.

[0098] Second handshake: The receiving end determines from message a that the sending end requires to establish a concurrent connection, and sends message b (eg, a second message) to the sending end. Message b is used to confirm that the request to establish a concurrent connection has been received. Message b includes a field for identifying a concurrent connection.

[0099] Third handshake: After receiving message b, the sender sends message c (for example, the third message) to the receiver. Message c is used to confirm the establishment of a concurrent connection. Message 3 includes a field for identifying a concurrent connection.

[0100] After completing the three-way handshake, the sending end and the receiving end can transmit data of the service corresponding to the concurrent connection, that is, perform the actions shown in the aforementioned steps S201 to S202.

[0101] After the handshake phase, the IoT device (sender and / or receiver) can allocate different transmission resources to the connection based on the established connection. For example, the IoT device can call the setsocketopt() interface to set the socket parameters, thereby storing the correspondence between different connections and different threads.

[0102] Resource allocation method 1: For concurrent connections, all connections are managed in a unified thread, and the threads corresponding to the concurrent connections are enabled to share the cache, reducing the cache overhead of each connection. For example, the IoT device adds the socket corresponding to the connection (or service) to the preset thread, and the method for storing the first corresponding relationship (and the second corresponding relationship) in the aforementioned embodiment can be referred to, which will not be repeated here.

[0103] Resource allocation method 2: For data-type connections, since a large amount of data needs to be transmitted efficiently, each connection corresponds to an independent thread for processing and uses an independent cache. Although it occupies more memory and thread resources, it can ensure the transmission efficiency of data-type connections and improve communication accuracy.

[0104] The method provided in the embodiment of the present application is introduced above in combination with the accompanying drawings. The communication device provided in the embodiment of the present application is introduced below in combination with the accompanying drawings.

[0105] Based on the same technical concept, the present application also provides a communication device, which is used to implement the communication method provided in the above embodiment. Figure 8 As shown, the communication device 800 includes a communication unit 801 and a processing unit 802, wherein the communication unit 801 is used to receive and send data; the processing unit 802 is used to implement Figure 2 The steps in the communication method shown.

[0106] In a possible example, the processing unit 802 is used to: generate a first task request and a second task request; the first task request is used to indicate processing of data of a first business, and the second task request is used to indicate processing of data of a second business; the first business and the second business are both businesses that require long-term communication and whose business volume is less than a first threshold; the first business is different from the second business; the processing unit 802 is also used to: schedule the first task request and the second task request to the first thread for processing.

[0107] In one possible design, the processing unit 802 is specifically used to: obtain a first correspondence between the first business and the first thread, and a second correspondence between the second business and the first thread; and schedule the first task request and the second task request to the first thread for processing according to the first correspondence and the second correspondence.

[0108] In a possible design, when the first task request is the first task request of the first business, the processing unit 802 is also used to: store the first corresponding relationship; when the second task request is the first task request of the second business, the processing unit 802 is also used to: store the second corresponding relationship.

[0109] In one possible design, the processing unit 802 is also used to: determine a first number of task requests to be scheduled; the task requests to be scheduled include a first task request and a second task request; the processing unit 802 is also used to: determine that the first number is less than or equal to the concurrency number; the concurrency number is determined based on the second number of task requests currently being processed and the concurrency threshold.

[0110] In one possible design, the communication unit 801 is also used to: receive a first message from a second IoT device, the first message being used to indicate establishment of a first connection between the first IoT device and the second IoT device; the first connection being used to indicate a scheduling method for task requests corresponding to services that require long-term communication and whose service volume is less than a first threshold; the communication unit 801 is also used to: send a second message to the second IoT device according to the first message, the second message being used to indicate agreement to establish the first connection; the communication unit 801 is also used to: receive a third message from the second IoT device, the third message being used to indicate that establishment of the first connection is complete.

[0111] In one possible design, the first message includes a first field, the second message includes the first field, and the third message includes the first field; wherein the first field is a first value or a second value, the first value is an identifier of a first connection, the second value is an identifier of a second connection, and the second connection is used to indicate a scheduling method for a task request corresponding to a temporary communication or a service whose traffic volume is greater than a first threshold.

[0112] In one possible design, the first thread is used to manage pending task requests, and the processing unit 802 is further used to: schedule the first task request and the second task request to the second thread for processing, and the second thread is used to store data corresponding to the pending task requests.

[0113] Based on the same technical concept, the embodiment of the present application also provides another communication device, the communication device 900 can implement the communication method provided in the above embodiment, and has the function of the communication device 800 provided in the above embodiment. Fig. 9 As shown, the communication device 900 includes: a memory 902 and a processor 901. Optionally, the communication device 900 further includes a communication interface 903. The communication interface 903, the processor 901 and the memory 902 are interconnected.

[0114] Optionally, the communication interface 903, the processor 901 and the memory 902 are interconnected via a bus 904. The bus 904 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0115] The communication interface 903 is used to receive and send signals to achieve communication with other devices other than the communication device.

[0116] The functions of the processor 901 can refer to the description in the above embodiments, which will not be repeated here. Among them, the processor 901 can be a central processing unit (CPU), a network processor (NP) or a combination of a CPU and a NP, etc. The processor 901 can further include a hardware chip. The above-mentioned hardware chip can be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above-mentioned PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. When the processor 901 implements the above-mentioned functions, it can be implemented by hardware, and of course, it can also be implemented by executing the corresponding software through hardware.

[0117] The memory 902 is used to store program instructions, etc. Specifically, the program instructions may include program codes, which include computer operation instructions. The memory 902 may include random access memory (RAM), and may also include non-volatile memory (non-volatile memory), such as at least one disk storage. The processor 901 executes the program instructions stored in the memory 902 to implement the above functions, thereby implementing the method provided in the above embodiment. Exemplarily, the memory 902 may include the network device or terminal device shown in the embodiment of the present application.

[0118] Based on the same technical concept, an embodiment of the present application further provides a computer program, which, when executed on a computer, enables the computer to execute the method provided in the above embodiment.

[0119] Based on the same technical concept, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program runs on a computer, the computer executes the method provided in the above embodiment.

[0120] The storage medium may be any available medium that can be accessed by a computer. For example, but not limited to, a computer-readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer.

[0121] Based on the same technical concept, an embodiment of the present application further provides a chip, which is used to read a computer program stored in a memory to implement the method provided in the above embodiment.

[0122] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0123] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0124] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0125] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0126] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A communication method, characterized in that: Applied to a first IoT device, the method includes: Generate a first task request and a second task request; the first task request is used to instruct processing of data of a first service, and the second task request is used to instruct processing of data of a second service; both the first service and the second service are services that require long-term communication and whose service volume is less than a first threshold; the first service is different from the second service; The first task request and the second task request are dispatched to a first thread for processing.

2. The method according to claim 1, characterized in that The step of scheduling the first task request and the second task request to a first thread for processing includes: Acquire a first corresponding relationship between the first service and the first thread, and a second corresponding relationship between the second service and the first thread; According to the first corresponding relationship and the second corresponding relationship, the first task request and the second task request are scheduled to the first thread for processing.

3. The method according to claim 2, characterized in that The method further comprises: When the first task request is the first task request of the first service, storing the first corresponding relationship; When the second task request is the first task request of the second service, the second corresponding relationship is stored.

4. The method according to any one of claims 1 to 3, characterized in that: Before scheduling the first task request and the second task request to the first thread for processing, the method further includes: Determine a first number of task requests to be scheduled; the task requests to be scheduled include the first task requests and the second task requests; Determine that the first number is less than or equal to the concurrency number; the concurrency number is determined according to the second number of task requests currently being processed and a concurrency threshold.

5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Receiving a first message from a second IoT device, wherein the first message is used to indicate establishment of a first connection between the first IoT device and the second IoT device; the first connection is used to indicate a scheduling method for a task request corresponding to a service that requires long-term communication and whose service volume is less than a first threshold; Sending a second message to the second IoT device according to the first message, where the second message is used to indicate consent to establish the first connection; A third message is received from the second IoT device, where the third message is used to indicate that the first connection has been established.

6. The method according to claim 5, characterized in that The first message includes a first field, the second message includes the first field, and the third message includes the first field; The first field is a first value or a second value, the first value is an identifier of the first connection, the second value is an identifier of the second connection, and the second connection is used to indicate a scheduling method for a task request corresponding to a temporary communication or a service with a business volume greater than a first threshold.

7. The method according to any one of claims 1 to 6, characterized in that: The first thread is used to manage pending task requests, and the method further includes: The first task request and the second task request are dispatched to a second thread for processing, and the second thread is used to store data corresponding to the task requests to be processed.

8. A communication device, characterized in that: include: a communication unit and a processing unit; The communication unit is used to: receive and send data; The processing unit is used to: generate a first task request and a second task request; the first task request is used to instruct processing of data of a first service, and the second task request is used to instruct processing of data of a second service; the first service and the second service are both services that require long-term communication and whose service volume is less than a first threshold; the first service is different from the second service; The processing unit is further configured to schedule the first task request and the second task request to a first thread for processing.

9. The device according to claim 8, characterized in that The processing unit is specifically used for: Acquire a first corresponding relationship between the first service and the first thread, and a second corresponding relationship between the second service and the first thread; According to the first corresponding relationship and the second corresponding relationship, the first task request and the second task request are scheduled to the first thread for processing.

10. The device according to claim 9, characterized in that The processing unit is also used for: When the first task request is the first task request of the first service, storing the first corresponding relationship; When the second task request is the first task request of the second service, the second corresponding relationship is stored.

11. The device according to any one of claims 8 to 10, characterized in that: The processing unit is also used for: Determine a first number of task requests to be scheduled; the task requests to be scheduled include the first task requests and the second task requests; Determine that the first number is less than or equal to the concurrent number; The concurrency number is determined according to the second number of task requests currently being processed and a concurrency threshold.

12. The device according to any one of claims 8 to 11, characterized in that: The communication unit is also used for: Receiving a first message from a second IoT device, wherein the first message is used to indicate establishment of a first connection between the first IoT device and the second IoT device; the first connection is used to indicate a scheduling method for a task request corresponding to a service that requires long-term communication and whose service volume is less than a first threshold; Sending a second message to the second IoT device according to the first message, where the second message is used to indicate consent to establish the first connection; A third message is received from the second IoT device, where the third message is used to indicate that the first connection has been established.

13. The device according to claim 12, characterized in that The first message includes a first field, the second message includes the first field, and the third message includes the first field; The first field is a first value or a second value, the first value is an identifier of the first connection, the second value is an identifier of the second connection, and the second connection is used to indicate a scheduling method for a task request corresponding to a temporary communication or a service with a business volume greater than a first threshold.

14. The device according to any one of claims 8 to 13, characterized in that: The first thread is used to manage pending task requests, and the device further includes: The first task request and the second task request are dispatched to a second thread for processing, and the second thread is used to store data corresponding to the task requests to be processed.

15. A communication device, characterized in that: include: at least one processor and memory; The at least one processor is coupled to the memory, and the at least one processor is configured to read the computer program stored in the memory to execute the method according to any one of claims 1 to 7.

16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called by a computer, the computer executes the method according to any one of claims 1 to 7.

17. A chip system, characterized in that: Including communication interface and processor: The communication interface is used to input and / or output signaling or data; The processor is used to execute a computer executable program so that a device equipped with the chip system executes the method as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Communication method and apparatus

    EP4793770A1