With a hardware timer. ie. Time slice, time splitting.
The same way other platforms and threading languages (C) do it.