Home > Back-end >  Multithreading a queue
Multithreading a queue

Time:09-22

Queue or list, I do not understand, also called queue temporarily,
Step 1, with a thread from a database table select article n unhandled records, stored in a queue, n can be artificially adjust,
Step 2, with m a thread to handle each record in the queue, keep the processing results of each record to the queue of each record in the corresponding field, in order to improve the efficiency, so use m thread, m values can be artificial adjusted according to actual condition,
Step 3, use a thread to check whether each record in the queue have been processed, if it is, the processing results of each record update database tables to step 1,
Step 4. Repeat step 1.

What knowledge needs to be?
Hope can imitate a example to do,
http://blog.sina.com.cn/s/blog_78024c8601012ewv.html
Research about this, but don't know how to use on me this question,

CodePudding user response:

At least consider thread synchronization and multi-point concurrent problems

CodePudding user response:

You can set a temporary table, stored in processing data,
Timer timing check whether there is a temporary table, data, a processing, processing after delete,
It queue way to handle it,
  • Related