Micro-Programs and cooperative scheduling
It used to be that OS used to time share several programs running on a CPU by forcing a context switch over microseconds (or other small time intervals). But the problem with a timed context switch is that there is an overhead of setting and handling an interrupt and then resuming after that interrupt.
What if programs could be compiled into "micro" units (a spin-off of the micro-kernel idea) so that there is no need to interrupt any program: Each micro-program will run at most xyz time units/cycles so that it will let go of the CPU in a fair way. The beauty of this is multi-fold:
Copyright 2007, DannyHSDad, All Rights Reserved.
What if programs could be compiled into "micro" units (a spin-off of the micro-kernel idea) so that there is no need to interrupt any program: Each micro-program will run at most xyz time units/cycles so that it will let go of the CPU in a fair way. The beauty of this is multi-fold:
- OS only does context switch: no need to force a stop and try to recover by restarting the interrupted process
- Easier to distribute the program across multiple cores.
- Easier to synchronize with other micro-programs -- because a micro-program ends ready to switch (give up its CPU slice), it can be stopped and synchronized with other micro-programs waiting on the same event, etc.
- Easier to distribute the micro-program on non-uniform multi-processor systems since each micro-program are self contained.
Copyright 2007, DannyHSDad, All Rights Reserved.
Labels: micro-program, multi-thread programming, scheduler