search
Context exchange: specific stepsJun 20, 2017 pm 01:25 PM
contextexchange

Context switch (context switch), also known as environment switch, computer terminology, is a state (context) that stores and reconstructs the CPU, so it allows multiple Processes can share the computing process of a single CPU resource. When you want to swap processes on the CPU, you must first store the status of the current process, and then read the status of the process to be executed back to the CPU.

When to exchange?

There are three possible situations where context exchange will occur, namely:

Multi-tasking

The most common one is that in some scheduling algorithms, a trip sometimes needs to temporarily leave the CPU to allow another trip to come in and run on the CPU. In a preemptive multiplexing system, each trip will be executed in turn for a variable length of time. These time periods are called time slices. If the process does not voluntarily give up the CPU (for example, when performing I/O operations, the process needs to give up the right to use the CPU), when the time limit expires, the system will generate a timed interrupt, and the operating system will schedule other processes to be executed. This mechanism is used to ensure that the CPU is not monopolized by processes that rely more on processor operations. If there is no scheduled interrupt, the process will continue to execute unless it voluntarily gives up the CPU. For trips with a lot of I/O instructions, they often cannot be executed for long before they need to give up the CPU; while trips that rely more on the processor have relatively fewer I/O operations, but can continue to use the CPU, forming a monopoly. Phenomenon. This is the Convoy effect.

Interrupt processing

When receiving an interrupt (Interrupt), the CPU must perform context switching.

Exchange of user mode or kernel mode

When the exchange of user mode and kernel mode occurs, there is no need for context exchange; and the difference between user mode and kernel mode The exchange itself is not a context exchange. However, depending on the operating system, sometimes a context exchange step is performed at this time.

Context exchange:Specific steps

In an exchange, the status of the first trip should be recorded somewhere, so that when When the scheduler returns to this schedule, it can rebuild the schedule and continue the operation.

The so-called "trip status" here includes all registers used by this trip, especially the program counter; plus all specific data that the operating system may require. These data are generally stored in a data structure called a process control block (PCB).

Context exchange: implemented by software or hardware

Context exchange can be divided into mainly implemented by software or implemented by hardware. Some CPUs, such as Intel 80386 or higher-end processors of the same series, have hardware designs that support context switching.


The above is the detailed content of Context exchange: specific steps. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
将自定义上下文菜单项添加到 Windows 11 的文件资源管理器菜单将自定义上下文菜单项添加到 Windows 11 的文件资源管理器菜单Apr 25, 2023 pm 06:19 PM

微软在启动Windows11操作系统时更改了文件资源管理器中的上下文菜单。文件资源管理器在Windows11中有两个上下文菜单:当用户右键单击文件管理器中的文件或文件夹时,新的紧凑菜单首先打开。可以从该新菜单或使用快捷方式打开经典上下文菜单。还有一个选项可以在Windows11的文件资源管理器中恢复经典上下文菜单,使其默认打开。程序可以将它们的条目添加到新的上下文菜单中,但它们需要有正确的编程才能这样做。Windows11用户可以使用Windows应用程序自定义上下文菜单将他们的

如何在 Ubuntu 上添加交换空间 22.04 LTS如何在 Ubuntu 上添加交换空间 22.04 LTSFeb 20, 2024 am 11:12 AM

交换空间在Linux系统中扮演着重要角色,特别是在系统内存不足时。它充当着一个备用的内存存储空间,可以帮助系统平稳运行,即使在负载高的情况下也能保持稳定性。本文为您提供了在Ubuntu22.04LTS上添加交换空间的详细指南,以确保您的系统性能得到优化并能应对各种工作负载。了解交换空间交换空间提供虚拟内存,用于补充系统的物理RAM。当系统的RAM不足时,内核会将数据交换到磁盘,以防止内存不足和系统崩溃。Linux系统常用交换空间来处理这种情况。同时运行多个内存密集型应用程序处理非常大的文件或数据

微软承诺让 Windows 11 右键菜单更快微软承诺让 Windows 11 右键菜单更快May 01, 2023 am 11:13 AM

Windows11继续定期更新,有报道称SunValley2将解决新操作系统的大部分主要问题。Windows11带来了几项设计大修,包括新的开始菜单、通知中心、任务栏和现代上下文菜单。上下文菜单是操作系统界面(尤其是文件资源管理器)的核心部分,并且已更新为新设计,这似乎导致性能缓慢。当您在文件资源管理器中右键单击文件或文件夹时,Windows11的上下文菜单会出现问题。作为其操作系统现代化努力的一部分,微软减少了上下文菜单中的选项数量,并开始使用图标/按钮来进行复制或可爱等选项。虽然此

Windows 11:如何从文件资源管理器的上下文菜单中删除使用 Clipchamp 编辑Windows 11:如何从文件资源管理器的上下文菜单中删除使用 Clipchamp 编辑May 03, 2023 pm 05:07 PM

Clipchamp是微软Windows11操作系统的新默认应用程序。微软于2021年购买了基于网络的视频编辑器,并于2022年初将其集成到Windows11的开发版本中。Clipchamp的免费版本当时并不能真正使用,因为它有太多的限制。它为所有视频加水印并将导出限制为480p。Microsoft取消了一些限制并更改了可用计划。导出现在支持1080p,免费版导出不再添加水印。微软将Clipchamp作为Windows112022更新中的默认应用程序。Windows1

Windows 11 版本 22H2:文件资源管理器更改Windows 11 版本 22H2:文件资源管理器更改May 01, 2023 pm 08:04 PM

在该系列的第四部分,我们将了解默认文件管理器工具文件资源管理器以及微软计划在Windows112022更新中引入的更改。微软在2021年推出新的Windows11操作系统时,在几个关键领域对文件资源管理器进行了更改。最突出的变化之一是引入了紧凑的上下文菜单,文件资源管理器默认显示该菜单。提示:以下是在Windows11中恢复经典文件资源管理器上下文菜单的说明。这一变化并不是唯一的变化,因为微软简化了文件资源管理器的主工具栏,这导致许多项目只有在额外点击一两次后才能访问。希望微软在即

Python程序:交换矩阵中第一个和最后一个元素在列之间的位置Python程序:交换矩阵中第一个和最后一个元素在列之间的位置Sep 08, 2023 pm 04:29 PM

矩阵是由许多按行和列形式排列的数字组成的二维数组。Python没有任何数据类型来表示矩阵,但我们可以使用嵌套列表或NumPy数组作为矩阵。请参阅以下输入输出场景,了解如何互换矩阵的第一列和最后一列元素。输入输出场景假设我们有一个使用列表列表表示的3X3矩阵。输出矩阵将是交换第一列和最后一列元素的结果矩阵。Inputmatrix:[1,3,4][4,5,6][7,8,3]Outputmatrix:[4,3,1][4,5,6][3,8,7]让我们考虑另一个行和列不相等的矩阵。Inputmatrix:

这个小应用程序为旧的 Windows 10 和 11 上下文菜单添加了亚克力效果这个小应用程序为旧的 Windows 10 和 11 上下文菜单添加了亚克力效果May 16, 2023 pm 06:37 PM

尽管微软夜以继日地致力于使Windows11更加现代和精美,但该操作系统在其表皮下保留了旧时代的残余。例如,有两种上下文菜单:一种是现代的,一种是传统的。如果您对Windows11(和Windows10)中旧菜单的外观不满意,这里有一个小型开源应用程序(通过OnMsft ),感谢他们使用Acrylic效果使它们更漂亮。TranslucentFlyouts是一个小型应用程序,可以用半透明效果替换看起来单调的纯色背景。您可以个性化样式(Acrylic、Aero、Transpare

C++程序以找出通过交换行和列可以生成的唯一矩阵的数量C++程序以找出通过交换行和列可以生成的唯一矩阵的数量Sep 01, 2023 am 11:53 AM

假设我们有一个nxn矩阵。矩阵中的每个元素都是唯一的,并且是1到n2之间的整数。现在我们可以以任意数量和任意顺序执行以下操作。我们选择矩阵中的任意两个整数x和y,其中(1≤x

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version