I knew greedy was the right instinct but fumbled explaining why shortest-processing-time works for flow time specifically versus makespan.
Start by clarifying the objective and constraints, then propose a greedy algorithm that assigns each arriving job to the machine with the smallest current load, leveraging the Shortest Processing Time (SPT) rule to minimize average flow time. Discuss the algorithm's optimality under certain conditions and its practical implementation, including handling real-time arrivals and potential trade-offs.
Pro tip: Mention that while the greedy approach is optimal for minimizing average flow time on identical parallel machines when preemption is allowed, for non-preemptive scheduling it's a 2-approximation; showing awareness of these nuances demonstrates depth.
Restate the problem: jobs arrive over time with known processing times, assigned in real-time to two identical parallel machines, goal is to minimize average flow time (sum of completion times minus arrival times). Confirm if preemption is allowed, if processing times are known upon arrival, and if machines are identical.
Average flow time is minimized by the Shortest Processing Time (SPT) rule on a single machine. For parallel machines, the problem is NP-hard in general, but greedy heuristics like List Scheduling (assign to least loaded machine) perform well. For identical machines and preemption, SPT with preemption (SRPT) is optimal.
Design an algorithm that, upon each job arrival, assigns it to the machine with the smallest current total processing time (load). This is the List Scheduling algorithm. If preemption is allowed, consider preemptive SPT: always process the job with the shortest remaining processing time on any available machine.
Discuss that List Scheduling is a 2-approximation for minimizing average flow time on identical machines. For preemptive case, SRPT is optimal. Mention that in practice, the greedy approach is simple, online, and efficient (O(log n) with priority queues).
Address real-world factors: unknown future arrivals, varying job sizes, potential machine heterogeneity. Suggest using a priority queue to track machine loads, and possibly machine learning to predict processing times if not known. Conclude with recommendation based on assumptions.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.