3.4 The Sun UltraSPARC processor has multiple register sets. Describe what happens when a context switch occurs if the new context is already loaded into one of the register sets. What happens if the new context is in memory rather than in a register set and all the register sets are in use?

答案: 因为暂时还没找到多寄存器集的处理器在上下文切换时的工作原理, 所以无法好好理解此问题。 只能根据自己的猜测来回答此题。

  在单寄存器集处理器中, 上下文切换时需要先将当前进程的上下文保存到PCB中, 并读取下一个进程的上下文。多寄存器集, 进行上下文切换时, 如果新的上下文早已经读取到一个新的寄存器集中,  处理器应该会把切换到这个新的寄存器集, 使用新的上下文继续执行进程, 旧的寄存器集同时会将上下文信息保存到其进程PCB中, 新的上下文的读取和旧的上下文的保存应该是并发进行的, 所以context switch的时间开销要比单寄存器集少很多。

  如果新的上下文是在内存中而不是寄存器里, 那么在读取新的上下文时的时间开销要比读取寄存器里的上下文时间开销大。

扩展

  上下文包含CPU寄存器里的值, 进程状态, 内存管理信息。 上下文并不等于PCB, 它只是由PCB中的部分信息构成。

  要完成上下文的奇幻, 内核要将当前执行的进程上下文存储到当前进程在内存中的PCB中, 然后将新进程的上下文从其内存的PCB中读取到CPU寄存器中。

[Chapter 3 Process]Practice 3.4 Describe what happens when a context switch occurs if the new context is already loaded into one of the register sets.的更多相关文章

  1. [Chapter 3 Process]Practice 3.9 Describe the actions token by a kernel to content-switch between processes.

    3.9 Describe the actions token by a kernel to content-switch between processes. 答案: 内核在进行进程上下文切换时, 首 ...

  2. [Chapter 3 Process]Practice 3.8: Describe the differences among short-term, medium-term, long-term scheduling

    3.8 Describe the differences among short-term, medium-term, and longterm scheduling. 答案: 长期调度决定哪些进程进 ...

  3. [Chapter 3 Process]Practice 3.12 Including the initial parent process, how many processes are created by the program shown in Figure 3.32?

    3.12 Including the initial parent process, how many processes are created by the program shown in Fi ...

  4. [Chapter 3 Process]Practice 3.5 When a process creates a new process using the fork() operation

    3.5 When a process creates a new process using the fork() operation, which of the following state is ...

  5. [Chapter 3 Process]Practice 3.3 Discuss three major complications that concurrent processing adds to an operating system.

    3.3  Original version of Apple's mobile iOS operating system provied no means of concurrent processi ...

  6. [Chapter 3 Process]Practice 3.2 Including the initial parent process, how many processes are created by the program shown in Figure?

    3.2 Including the initial parent process, how many processes are created by the program shown in Fig ...

  7. [Chapter 3 Process]Practice 3.1 相关知识:进程创建、fork函数

    3.1 Using the program shown in the Figure3.30, explain what the output will be at LINE A 答案:LINE A 处 ...

  8. 查看上下文切换的多的进程(find which process take the most context switch)

    这是原文链接http://serverfault.com/questions/190049/find-out-which-task-is-generating-a-lot-of-context-swi ...

  9. .NET:CLR via C# Thread Basics

    A thread is a Windows concept whose job is to virtualize the CPU. Thread Overhead Thread kernel obje ...

随机推荐

  1. CRM 403错误

    1 IIS 正常 2 CRM 各项服务正常. 3  应该程序池--CRMAppPool 停止

  2. EXT 省市三级联动及默认选择

    var provinceStore = Ext.create('Ext.data.Store', { fields: ['id', 'name'], proxy: { type: 'ajax', ur ...

  3. Codeforces 724C [坐标][乱搞][模拟]

    /* 不要低头,不要放弃,不要气馁,不要慌张 题意: 从(0,0)出发与x轴正方向呈45度角的射线,在给定的矩形区域内不断发射,直到射入矩形的某个角停止. 给出多个坐标,问光线最早经过某坐标的时间. ...

  4. CGContextAddArcToPoint和CGContextAddArc

    比较难的是CGContextAddArcToPoint 代码如下: CGContextRef context=UIGraphicsGetCurrentContext(); CGContextSetRG ...

  5. Windows 下动态链接库和静态链接库

    1.静态链接库:就是在编译的时候把库中代码复制进工程中,导致工程变大,但是速度快. 缺点在于一套代码可能在内存中有多份拷贝,占用内存. 2.动态链接库:库由windos api加载库代码,内存中只有一 ...

  6. log4j按级别输出日志文件

    log4j.properties: BASE_DIR= /home/admin/preprocess-tmc-city/logs log4j.rootLogger=debug,stdout,debug ...

  7. 有了第一台自己开发的pro,开心,明天分享最近整理逆向分析ios的一些东西

    最近都在忙于ios深入研究,研究别人的代码,别人的app.然后顺藤摸瓜的找到了关键:逆向,动态特性等. 相关工具:reveal, cycript等. 特别感谢前人的分享,为了打开学习ios的另外一扇大 ...

  8. [转载]:Fortran字符串的故事

    一. Fortran 字符串与 C 字符串的区别  Fortran的字符串处理能力其实很弱,关于字符串的语法还很落后.它与 C 字符串最大的区别就是:Fortran字符串是固定长度的,没有 \0 结束 ...

  9. SQL笔记 [SQL判断是否存在] [长期更新] (-2015.4)

    --判断某个存储过程是否存在if exists (select * from sysobjects where id = object_id(N'[p_CreateTable]') and OBJEC ...

  10. MsSqlServer 复制分发概述

    Replication方案可以分为Snapshot Replication, Transactional Replication, Peer-2-Peer Replication, Merge Rep ...