extract the running context from the kernerl

This change put the running queue mnagement out of the kernel, preparing
the multiproc support.