中断技术如何帮助实现多线程? [英] How do interruption technique help to implement multithreading?

查看:134
本文介绍了中断技术如何帮助实现多线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

中断技术如何帮助实现多线程? 还是多线程与中断之间是什么关系?

How do interruption technique help to implement multithreading? Or what's the relationship between multithreading and interruption?

非常感谢!

推荐答案

'或者多线程与中断之间是什么关系?'

'Or what's the relationship between multithreading and interruption?'

在大多数现代的抢占式OS上,中断是进入OS的方式-除非存在中断,否则OS不会执行任何操作.中断分为两种:设备/驱动程序的硬件中断(即磁盘,键盘,NIC,鼠标,USB,内存管理硬件,计时器硬件)和软件中断".系统调用.两种类型的中断都可以更改就绪/正在运行的线程集.从本质上讲,该操作系统是一个强大的中断处理程序,可以选择更改在中断返回后将运行的线程集.

On most modern preemptive OS, an interrupt is how the OS is entered - unless there is an interrupt, the OS does nothing. Interrupts come in two flavours - hardware interrupts from devices/drivers, (ie. disk, keyboard, NIC, mouse, USB, memory-management hardware, timer hardware), and 'software interrupts', ie. system calls. Either type of interrupt can change the set of ready/running threads. Essentially, the OS is a big interrupt-handler that can choose to change the set of threads that will run after an interrupt return.

对硬件中断的重新安排使抢先的多线程OS能够在需要注意硬件(和/或其关联的驱动程序)时快速做出响应.

The rescheduling on hardware interrupts allow a preemptive, multithreaded OS with the ability to respond quickly when hardware, (and/or its associated driver), requires attention.

线程级对硬件信令的高性能响应是抢先式多任务处理程序相对于协作系统的最大优势,这也是我们忍受线程间信令,同步等复杂性的主要原因.

This high-performance response at thread level to hardware signaling is the single biggest advantage that a preemptive multitasker has over cooperative systems and is the main reason why we put up with the complication of inter-thread signaling, synchronization etc.

在没有中断和抢占的情况下,磁盘,网络,USB,显示器的性能,几乎我们台式机系统上的所有内容都非常糟糕,以至于视频流之类的应用程序将无法正常工作.当NIC芯片具有很好的大视频缓冲区时,它会引发硬件中断,运行其驱动程序并使用数据加载用户缓冲区,并在正在等待I/V的视频流应用程序中创建线程. O,准备就绪/正在运行,以便可以显示数据.

Without interrupts and preemption, the performance of disks, networks, USB, displays, almost everything on our desktop systems would be so apallingly bad that apps like video streaming would just not work. When a NIC chip has a nice, big buffer of video, it can raise a hardware interrupt, have its driver run and load up a user buffer with the data and make a thread in the video streaming app, that was waiting on the I/O, ready/running so that it can display the data.

这篇关于中断技术如何帮助实现多线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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