What makes the execution order of threads unpredictable?

The scheduler is, usually, the OS’s scheduler. It is influenced by many factors, including what other processes on the machine are doing, what the hardware is doing (interrupts), etc. Depending on the OS, I suppose there may sometimes be random numbers involved, but I suspect generally not. It’s more just the unpredictable way that multiple variable time intervals can overlap.

Leave a Comment