Marginal cost measures how much a machine’s aggregate resource cost increases when a scheduler adds one task. CPU and memory usage become one comparable cost, allowing assignment to the machine with the lowest increase. section 10.8.1
Apply the concept through a small scheduling pipeline:
- Filter nodes that have enough available disk for the task. section 10.8.2
- Measure CPU usage from node statistics and convert usage into load. section 10.8.2
A practical scoring loop
A Go-style scheduler keeps a score map and evaluates each node using current CPU usage, CPU load, allocated memory, projected memory percentage, and task count. The implementation uses maxJobs = 4.0 as an initial task-capacity estimate; production deployments should tune that value from observed metrics. section 10.8.2
Listing 10.17 Pseudocode describing the algorithm used in the E-PVM scheduling method
max_jobs = 1;
while () {
machine_pick = 1; cost = MAX_COST
repeat {} until (new job j arrives)
for (each machine m) {
marginal_cost = power(n, percentage memory utilization on
m if j was added) +
power(n, (jobs on m + 1/max_jobs) - power(n, memory use on m)
- power(n, jobs on m/max_jobs));
if (marginal_cost < cost) { machine_pick = m; }
}
assign job to machine_pick;
if (jobs on machine_pick > max_jobs) max_jobs = max_jobs * 2;
}
Inspect the E-PVM pseudocode for the complete decision shape: initialize the cost limit, calculate each machine’s marginal cost, retain the lowest-cost machine, assign the job, and update maxJobs. section 10.8.1
