What does it mean to say “linux kernel is preemptive”?

前端 未结 9 1959
野性不改
野性不改 2020-12-08 14:02

I read that Linux kernel is preemptive, which is different from most Unix kernels. So, what does it really mean for a kernal to be preemptive?

Some analogies or exam

9条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-08 14:34

    The preemption allows the kernel to give the IMPRESSION of parallelism: you've got only one processor (let's say a decade ago), but you feel like all your processes are running simulaneously. That's because the kernel preempts (ie, take the execution out of) the execution from one process to give it to the next one (maybe according to their priority).

    EDIT Not preemptive kernels wait for processes to give back the hand (ie, during syscalls), so if your process computes a lot of data and doesn't call any kind of yield function, the other processes won't be able to execute to execute their calls. Such systems are said to be cooperative because they ask for the cooperation of the processes to ensure the equity of the execution time

    EDIT 2 The main goal of preemption is to improve the reactivity of the system among multiple tasks, so that's good for end-users, whereas on the other-hand, servers want to achieve the highest througput, so they don't need it: (from the Linux kernel configuration)

    • Preemptible kernel (low-latency desktop)
    • Voluntary kernel preemption (desktop)
    • No forced preemption (server)

提交回复
热议问题