how dispatcher works?

后端 未结 4 1016
挽巷
挽巷 2020-12-24 14:37

I have recently started my OS course. As far as i know the work of dispatcher is to save the context of current process and load context of process to be run next. But how d

4条回答
  •  离开以前
    2020-12-24 15:14

    It doesn't generally get loaded in such a way that you lose the information on the current process.

    Often, it's an interrupt that happens in the context of the current process.

    So the dispatcher (or scheduler) can save all relevant information in a task control block of some sort before loading up that information for the next process.

    This includes the register contents, stack pointer and so on.

    It's worth noting that the context of the next process includes its state of being in the dispatcher interrupt itself so that, when it returns from the interrupt, it's to a totally different process.

提交回复
热议问题