context_switch invoked by framework