linux-sysprog · beginner · ~15 min

Ideal parallel runtime

Estimate perfect-scaling runtime.

Challenge

Implement long ideal_runtime(long serial_ms, int threads) returning the work split evenly across threads (ceiling division), or serial_ms if threads <= 1.

Starter code

long ideal_runtime(long serial_ms, int threads) {
    /* TODO */
    return serial_ms;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.