A task processing method and device

A task processing and task technology, applied in the field of network communication, can solve problems such as low task distribution and processing efficiency, and achieve the effects of improving task distribution and receiving efficiency, improving efficiency, and avoiding waiting.
CN109684091AActive Publication Date: 2019-04-26HANGZHOU DPTECH TECH

Patent Information

Authority / Receiving Office
CN ยท China
Current Assignee / Owner
HANGZHOU DPTECH TECH
Publication Date
2019-04-26

Smart Images

  • Figure 1
    Figure 1
  • Figure 2
    Figure 2
  • Figure 3
    Figure 3
Patent Text Reader

Abstract

The invention discloses a task processing method and device. A task processing method is characterized in that a producer thread creates a thread pool comprising at least one consumer thread in advance, and the method comprises the steps that the producer thread monitors whether a new connection request is generated or not, and a new task is created based on the Epoll technology under the condition that the new connection request is monitored; The producer thread determines any consumer thread conforming to a preset task distribution rule from the thread pool according to the preset task distribution rule, and distributes a newly built task to the consumer thread based on an Epoll technology; The consumer thread determines whether a task distributed by the producer thread is received or not based on the Epoll technology, and executes the received task after receiving the task; And under the condition that the consumer thread finishes the received task, determining whether the connection corresponding to the task is closed, if so, ending the task, and if not, keeping holding the task.
Need to check novelty before this filing date? Find Prior Art

Description

technical field

[0001] The embodiments of this specification relate to the field of network communication technologies, and in particular, to a task processing method and device. Background technique

[0002] In the producer-consumer mode of the prior art, usually one producer thread puts tasks into a queue, and multiple consumer threads take out tasks from the queue and execute them. In order to avoid data access exceptions caused by multiple threads of producers and consumers operating on the queue at the same time, generally when one of the threads operates on the queue, it is necessary to add a mutex to the queue.

[0003] However, in the task processing scheme of the prior art, each time a certain thread puts a task into and out of the queue, other threads need to wait, which makes task distribution and processing efficiency low. Based on the existing technology, a more efficient task processing solution is required. Contents of the invention

[0004] In view of thi...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More