Procedure: SKEW
Input: Number of processors P, ZP sets of sorted runs, {ai,p,r | i = 1, ..., CARDp,r|, one for each processor p ∈ {1, .., P} and each relation r ∈ {1, 2}, where CARDp,r is the cardinality of the sorted run of relation r at processor p, and ai,p,r is the ith tuple in this sorted run.
Output: The creation of tasks and a heuristic assignment of those tasks to the processors which approximately minimizes the makespan.
Set the number of tasks N = 1.
Set the top and bottom of the first task to be TOPN,p,r = 1 and BOTN,p,r = CARDp,r for each processor p = 1, .., P and each relation r = 1, 2.
Determine the type(1 or 2) of the first task.
Do forever
Determine the optimal multiplicities MULTn of each type 2 task n ∈ {1, .., N}. (Set MULTn = 1 for each type 1 task n ∈ {1, .., N}.) Compute the total number of tasks to be NN = ∑n=1NMULTn. Compute the task times {TIMEnMULTn | n = 1, .., N}.
If NN >= P then apply LPT.
If [solution is unacceptable] then begin
Apply GM to find the median element μ(η) for the region {TOPn,p,r, .., BOTn,p,r | p = 1, .., P, r = 1,2} consisting of the largest type 1 task n.
The median element corresponds to a type 2 task with region {TOPn,p,r2, ..., BOTn,p,r2 | p = 1, ..., P, r = 1,2}
Relabel this new type 2 task as task number n.
Determine its optimal multiplicity MULTn and task time TIMEnMULTn.
There also exist(1 or) 2 tasks, most likely of type 1, corresponding to regions {TOPn,p,r1, ..., BOTn,p,r1 | p = 1, ..., P, r = 1, 2} and {TOPn,p,r3, ..., BOTn,p,r3 | p = 1, ...,P, r = 1, 2}. Increment N (by 1 or 2) to add these tasks and their optimal multiplicities and task times.
Sort the tasks in order of decreasing task times, so that n1 <= n2 implies TIMEn1MULTn1 >= TIMEn2MULTn2.
End
Else halt with solution from final LPT.
End do
End SKEW