在非RTOS系统中是否可以在任务之间进行中断 [英] Is interruption between task is possible in Non RTOS system

查看:148
本文介绍了在非RTOS系统中是否可以在任务之间进行中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个非RTOS单核系统,一个任务(例如taskA)可以中断另一个任务(例如taskB),而taskA或taskB都不是中断例程吗?还是只能通过非RTOS系统上的ISR(中断服务程序)来中断一项任务?

If I have a non-RTOS single core system, can one task, say taskA interrupt another task, say taskB, where neither taskA or taskB are interrupt routines? Or is interruption of one task by another only possible through ISR(interrupt service routines) on non-RTOS systems?

推荐答案

要让您的系统具有多个非ISR线程,则意味着存在某种多任务处理-并且多任务处理并非RTOS所独有. .一个中断"另一个任务的任务称为抢占".抢占需要一个抢占式调度器,而RTOS则必须是抢占式调度器,例如Windows和Linux也是如此-但它们不是实时,因为调度和抢占不是确定性的.

For your system to have more than one non-ISR thread implies that there is some sort of multi-tasking - and multi-tasking is not exclusive to an RTOS. One task "interrupting" another is known as preemption. Preemption requires a preemptive scheduler, while an RTOS is necessarily a pre-emptive scheduler, so also are Windows and Linux for example - but these are not real-time since scheduling and preemption is not deterministic.

抢占式多任务处理对于支持抢占是必需的,但是不需要实时确定性调度.但是,抢占对于多任务不是必需的.一些系统(尤其是Win95之前的Windows的16位版本和OSX之前的MacOS)是协作多任务系统,其中正在运行的任务必须产生CPU才能允许其他任务运行.

Preemptive multi-tasking is necessary to support preemption, but real-time deterministic scheduling is not required. Preemption however is not necessary to multi-tasking; some systems (Notably 16 bit versions of Windows prior to Win95, and MacOS prior to OSX) are cooperative multitasking systems where a running task must yield the CPU to allow other tasks to run.

在抢占式多任务系统中,调度程序在中断上下文退出时执行,并且每当任务调用可调度事件(例如发出信号量,排队消息或释放互斥锁)时执行.如果调度程序运行时任务准备就绪要运行并且计划策略要求或允许它抢占当前任务,将发生上下文切换.

In a preemptive multitasking system, the scheduler executes on exit from the interrupt context and whenever a task invokes a schedulable event (such as giving a semaphore, queuing a message or releasing a mutex. If when the scheduler runs a task becomes ready to run and the scheduling policy requires or allows it to preempt the current task, a context switch will occur.

因此,简而言之,一个非ISR线程或进程中断"另一个线程需要一个支持抢占的操作系统,而不必是RTOS.

So in short one non-ISR thread or process "interrupting" another requires an OS that supports preemption, which need not be an RTOS.

这篇关于在非RTOS系统中是否可以在任务之间进行中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆