Multiprocessor scheduling problem (NP)

Source: Internet
Author: User
Problem description

There are n separate tasks, assigned to m the same processor for processing, each task takes a time of t[i], i = 1..N, each task independent, indivisible, non-interruptible. Question: What is the shortest time it takes for these processors to handle these tasks?

Problem solving

The problem is also NP-like, similar to the boxing problem in the previous blog: http://blog.csdn.net/nisxiya/article/details/45533811
Packing problem, is a given capacity of the box, ask at least a few boxes to meet the conditions.
Multiprocessor scheduling problem is given a fixed number of processors, each processor is asked to process as soon as possible, the longest need to process how long. Similar to a given fixed box, but the box capacity can vary, ask these same box maximum capacity design, can meet the conditions, and maximum capacity to be as small as possible.

The most idle adaptive algorithm

This kind of multiprocessor problem, also has not found the relatively good polynomial solution, at present uses the greedy algorithm, gives the comparison approximate optimal solution the answer.
1) Sort tasks according to time spent from long to short, time complexity is O (n log n)
2) Assign task one by one to the most idle of M machines. The so-called most idle, refers to the current task he has to deal with the total time and minimum. How to quickly find the machine with the smallest number of tasks in the M machine? The use of balanced binary tree, minimum heap, etc. can be resolved in good condition, the time complexity of O (log m). So in the second step, the total time complexity is O (n log m)

Because M <= N, (otherwise it is not so laborious to solve, directly each processor assigned a task can be), t (n) = O (n log n) + O (n log m), that is, t (n) = O (n log n).

Examples

There are 7 independent tasks, 3 machines to complete processing, each task time is {2,14,4,16,6,5,3}, the specific solution is as follows:

Multiprocessor scheduling problem (NP)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.