Message from JavaScript discussions
September 2017
— Most event loops will be short
A normal process will do some work, then go into an event loop, or even call EVENT_WAIT
on the dispatcher
— Huh
— But won't the slow jobs run eventually though?
— Yes, giving small event loops time to run
— If an event fires something, then a short job could become a long job on that cycle, which means on the next cycle it runs later
— I see
— Which means, continually, the processes that have the smallest load on the system will always run first
— So processes will be rewarded by being efficient
— Exactly
— Since it is cooperative, a developer can directly implement efficiency by splitting their application up into units of work, yield
ing to the dispatcher frequently
— I will also add HRRN which apparently also gives priority to procs that have to wait a long time