Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

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.

Active Publication Date: 2019-04-26
HANGZHOU DPTECH TECH
View PDF5 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[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, making the task distribution processing efficiency low

Method used

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
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • A task processing method and device
  • A task processing method and device
  • A task processing method and device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0022] In order for those skilled in the art to better understand the technical solutions in the embodiments of this specification, the technical solutions in the embodiments of this specification will be described in detail below in conjunction with the drawings in the embodiments of this specification. Obviously, the described implementation Examples are only some of the embodiments in this specification, not all of them. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments in this specification shall fall within the scope of protection.

[0023] In a multi-threaded network data processing device, usually one producer thread produces a product, and provides the produced product to several consumer threads for consumption. In order to enable the producer thread and the consumer thread to execute concurrently, multiple task queues are usually set between the two. The producer thread puts the produced products into the queue, and the c...

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

PUM

No PUM Login to View More

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.

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

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F9/50G06F9/54G06F9/46
CPCG06F9/466G06F9/5027G06F9/546
Inventor 李绍辉
Owner HANGZHOU DPTECH TECH
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products