| input : : jobs running in VMs; |
| : jobs running in VMs; |
| : jobs waiting in the queue. |
| (1) begin |
| (2) / *Step 1: Schedule runnable jobs according to FCFS */ |
| (3) sort according to job arrival time; |
| (4) for do |
| (5) process number of ; idle fg VM number; |
| (6) if then |
| (7) break; |
| (8) else |
| (9) If Deploy (j, 'K') then |
| (10) remove from or , insert it into ; |
| (11) if is empty then |
| (12) return; |
| (13) / *Step 2: Make reservation for the first job in , then backfill */ |
| (14) let = 0 (shadow time), = 0 (extra fg VM number); |
| (15) first job in ; process number of ; |
| (16) current idle fg VM number; |
| (17) Sort in ascending order of their termination time; |
| (18) for each job j in the sorted do |
| (19) processe number in ; ; |
| (20) if then |
| (21) = the termination time of ; = − ; break; |
| (22) / * Backfill runnable jobs */ |
| (23) for each job in do |
| (24) processe number of ; idle fg VM number; |
| (25) if then |
| (26) continue; |
| (27) the runtime of ; current time; |
| (28) if () or then |
| (29) if Deploy (j, 'K') then |
| (30) remove from or , insert it into ; |
| (31) if then |
| (32) = − ; |
| (33) / *Step 3: Try to deploy jobs to the background tier */ |
| (34) sort in ascending order of their runtime; |
| (35) for each job in the sorted do |
| (36) processe number of ; idle bg VM number; |
| (37) if then |
| (38) Dispatch('BG',); |