什么是可抢占内核

什么是可抢占内核

本文介绍了什么是抢占/什么是可抢占内核?到底有什么好处呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用您自己的话解释,抢占是什么,对(linux)内核意味着什么?

Explained in your own words, what is preemption and what does it mean to a (linux) kernel?

拥有抢占式内核有什么优缺点?

What are advantages and disadvantages in having a preemptible kernel?

推荐答案

抢先式多任务处理-在单个处理器上运行多个进程/线程,从而产生一种幻觉,即它们实际上在为每个进程/线程分配了较小的多路复用时间片以在其中运行时同时运行.当某个进程被安排为不执行且等待下一个时间片运行时,该进程将被抢占".

Preemptive multitasking - Running several processes/threads on a single processor, creating the illusion that they run concurrently when actually each is allocated small multiplexed time slices to run in. A process is "preempted" when it is scheduled out of execution and waits for the next time slice to run in.

抢占式内核是可以在执行代码的过程中被打断的内核(例如,响应系统调用),以执行其他操作并运行其他线程(可能不是内核中的那些线程).

A preemptive kernel is one that can be interrupted in the middle of executing code - for instance in response for a system call - to do other things and run other threads, possibly those that are not in the kernel.

抢占式内核的主要优点是系统调用不会阻塞整个系统.如果系统调用需要很长时间才能完成,那么这并不意味着内核此时无法执行任何其他操作.主要缺点是,这给内核代码带来了更多的复杂性,必须处理更多的最终情况,执行更细粒度的锁定或使用无锁结构和算法.

The main advantage of a preemptive kernel is that sys-calls do not block the entire system. If a sys-call takes a long time to finish then it doesn't mean the kernel can't do anything else in this time.The main disadvantage is that this introduces more complexity to the kernel code, having to handle more end-cases, perform more fine grained locking or use lock-less structures and algorithms.

这篇关于什么是抢占/什么是可抢占内核?到底有什么好处呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 05:45