首页 > 系统相关 >process scheduling (进程调度)& practice 1 process operation

process scheduling (进程调度)& practice 1 process operation

时间:2024-04-15 16:36:03浏览次数:39  
标签:队列 process interrupt practice 进程 中断 scheduling 切换

进程切换

  1. 并发进程的切换
  • 并发进程中,一个进程在执行过程中可能被另一个进程替换占有CPU,这个过程称为“进程切换”
  • 是什么触发了进程切换?
  • 进程切换时要做什么?
    • 操作系统到底做了什么操作
      2 中断技术
  • 中断是指程序执行过程中
    • 当发生某一个事件时,中止cpu上现行的程序的运行
      • interrupt:excption:异常中断,interrupt:中断
    • 引出该事件的处理程序执行
      • 使用了陷阱机制(系统调用),系统调用也是中断的一种。
  • 执行完毕返回原程序中断点继续执行
  1. 中断源
  • 外中断:来自处理器之外的硬件中断信号
    • 如时钟中断,键盘中断,外围设备中断。
    • 外部中断均是异步中断(异步就是随机中断)
  • 内中断(异常exeption):来自于处理器内部,指令执行过程中发生的中断,属同步中断。
    • 硬件异常:掉电,奇偶检验错误等
    • 程序异常:非法操作,地址越界,断电,除数为0
    • 系统调用
  1. 中断处理过程
  • save the context of the executing process:保存上下文信息,
  • exeption/interrupt handler
    • determine the cause of the exception or interrupt(确定中断的原因)
    • handle the exception/interrupt(处理中断)
  • 选择需要重新加载和重新开始的进程,恢复上下文信息
  1. 特权指令和非特权指令
  • privileged instructions
    • I/0 instructions and Halt instuctions
    • Turn off all insterrupts
    • set the timer
    • process switching
  • Non-privileged instructions
    • the instructions that can run only in user mode
  1. 模式切换
  • 中断是用户态向核心态转换的唯一途径!系统调用实质上也是一种中断
  1. 进程切换
  • 切换时机
  • 进程需要进入等待状态,(这种是running状态,然后主动去切换状态)
  • 进程被抢占CPU而进入就绪状态
  • 切换过程
    • 保存被中断进程的上下文信息(Context)
    • 修改被中断进程的控制信息(如状态)
    • 将被中断的进程加入响应的状态队列
    • 调度一个新的进程并恢复它的上下文信息
  1. 进程控制块
  • A Process Control (PCB) contain many pieces of information associated with a specific process.
    • process state:进程状态
    • process number:pid
    • program counter:pc值,这个进程下一条要执行的值
    • registers:寄存器的值,包括使用到的寄存器
    • memory limits:内存
    • list of open files:打开的文件
  1. 进程队列(process queues)
  • 就绪队列:就绪只有一条队列,使用链表的方式连接起来,每一个链表节点中只包括pcb,
  • 等待队列:多个队列,不同设备使用不同的队列进行管理
  • 运行:运行没有队列

标签:队列,process,interrupt,practice,进程,中断,scheduling,切换
From: https://www.cnblogs.com/zhudachang/p/18133121

相关文章

  • SpringBoot项目中对定义的多个BeanPostProcessor排序
    前言BeanPostProcessor是Spring提供的一种扩展机制,可以让我们在bean初始化前后做一些额外的操作,Spring中的@Async,@Scheduled,@RabbitHandler等注解的底层实现都是BeanPostProcessor在起作用,如RabbitListenerAnnotationBeanPostProcessor。代码示例@Configurationpub......
  • process concept
    进程的定义程序和进程Aprogramisapassiveentity(是被动的主体),suchasafilecontainingalistofinstructionsstoredondisk(oftencalledanexecutablefile(就是可执行文件))Aprogrambecomesaprocesswhenanexecutablefileisloadedintomemory.(可执......
  • shell practice 04
    #!/bin/bash#author:Chiweiming#version:v1#date:2024-03-26<<COMMAND检查某个目录下的所有文件和目录,看是否满足下面条件:1)所有文件权限为6442)所有目录权限为7553)文件和目录所有者为xxx,所属组为xxx如果不满足,改成符合要求注意:不要直接修改权限,一定要有判断的......
  • shell practice 05
    #/bin/bash#autuor:ChiWeiming#version:v1#date:2024-03-27<<COMMAND针对某个目录,该目录下有数百个子目录,比如/data/att/chiweiming/data/att/linux然后再深入一层是以日期命名的目录,比如/data/att/linux/20240324,每天都会生成一个日期新目录,由于磁盘空间快满了,......
  • shell practice 06
    #!/bin/bash#author:Chiweiming#version:v1#date:2024-03-28<<COMMAND监控系统负载,如果系统负载超过10,记录系统状态信息1)系统负载命令使用uptime看,过去1分钟的平均负载2)系统状态使用如下工具标记:top、vmstat、ss3)要求每隔20s监控一次4)系统状态信息需要保存......
  • shell practice 08
    #!/bin/bash#author:ChiWeiming#version:v1#date:2024-04-12<<COMMANT输入一个数字,然后运行对应的一个命令。显示命令如下:*cmdmeau**1-date2-ls3-who4-pwd当输入1时,执行date命令,输入2时执行ls命令,依此类推COMMANTecho"*cmdmeau**1-date2-ls3-......
  • Kaggle自然语言处理入门 推特灾难文本分类 Natural Language Processing with Disaste
    和新闻按照标题分类差不多,用的朴素贝叶斯#导入必要的包importrandomimportsysfromsklearnimportmodel_selectionfromsklearn.naive_bayesimportMultinomialNBimportjoblibimportre,stringimportpandasaspdimportnumpyasnpdeftext_to_words(file_path)......
  • 52 Things: Number 2: What is the difference between a multi-core processor and a
    52Things:Number2:Whatisthedifferencebetweenamulti-coreprocessorandavectorprocessor?52件事:数字2:多核处理器和矢量处理器有什么区别?Onthefaceofit,youmaybeconfusedastowhatthedifferenceisbetweenthesetwoprocessors.Afterall,yo......
  • 52 Things: Number 1 : Different Types of Processors
    52Things:Number1:DifferentTypesofProcessors52件事:数字1:不同类型的处理器Thisisthefirstinaseriesofblogpoststoaddressthelistof '52ThingsEveryPhDStudentShouldKnow' todoCryptography.Thesetofquestionshasbeencompiledt......
  • Understanding the linux kernel Chapter 7 Process Scheduling
    SchedulingPolicyLinuxschedulingisbasedonthetimesharingtechnique:severalprocessesrunin“timemultiplexing”becausetheCPUtimeisdividedintoslices(called,quantum),oneforeachrunnableprocess.Analternativeclassificationdistinguis......