当前位置:网站首页>进程管理基础
进程管理基础
2022-07-06 18:46:00 【坎坷的程序员】
进程管理也称处理机管理
程序与进程
- 程序的执行顺序:1-2-3,1是2的前驱,2是1的后继
- 同一个作业没有前驱关系的程序断或不同作业的程序段可以分别并行执行。
- 程序并发执行的特征:失去了程序的封闭性,程序和机器的执行顺序不再一一对应,并发程序见的相互制约性
进程的组成
- pcb是进程存在的唯一标准
- 程序:一个程序能被多个进程同时共享执行,那这一部分就应该再入纯码的形式编制,程序执行时不可以修改
- 数据:数据部分包括程序执行时所需的数据以及工作区,该部分只能为一个进程所专用,是进程的可修改部分
进程的状态
- 三态模型
运行:当一个进程在处理机上运行
就绪:一个进程已经准备好了一切,准备运行
阻塞:一个进程运行的过程中需要等待某事才可以运行

五态模型
创建:创建了但是没有提交
终止:当进程执行完之后,就释放内存了

挂起状态
活跃就绪:进程在主存中可以被调度
静止就绪:进程被切换到辅存中,只有等待主存中有位置,才会被调度,或者它的优先级更高
活跃阻塞:进程在主存中,等待的事件一旦完成,就进入就绪
静止就绪:阻塞的时间太久,就会被切换到辅存,只有让等待的事件完成,才可以到静止就绪,等待机会才可以活跃就绪

进程控制
所有进程从创建到消亡的全过程实施有效的控制
进程控制是由操作系统内核中的原语实现的
进程间的通信
- 同步与互斥
- 同步:进程间的相互协调,a进程完成,b进程开始
- 互斥:我的你不能拿
- 管理原则:有空则进,无空等待,有限等待,让权等待
- 有限等待:要保障进程在有限的时间进入临界区
- 让权等待:当进程不能进入临界区,就释放
- 信号量机制:公用:互斥,1 私用;同步 0
高级通信原语
- 共享存储模式:相互通信的进程共享某些数据结构实现通信
- 消息传递模式:通过原语进行通信
- 管道通信:通过pip文件,写进程和读进程
管程
- 将资源集中管理,将系统中的资源抽象的表现出来。
- 管程是由:共享数据,一些能为并发进程所执行的作用在共享数据上的操作集合,初始代码以及存取权组成。
进程调度
- 高级调度:高级调度也叫:长调度,接纳调度,作业调度。将进程丢到就绪状态
- 中级调度:也叫:中程调度,对换调度,将交换区的进程丢到运行,或者将阻塞状态的丢到交换区,让路给其他进程
- 低级调度:也叫短程调度或者进程调度,将内存中的进程丢到运行
- 调度算法:
- 先来先服务:谁先谁用
- 时间片轮转:固定时间片:分配给每个进程的时间片相等,可变时间片:根据实际情况进行变化
- 优先级调度:根据优先级进行调度,静态优先级:开始的时候就会创建一个优先级,不能变化,动态优先级:可以变化
- 多级反馈调度:最高优先级队列可以先运行
- 进程优先级确定:
- 对于I/O型进程,最高级队列,计算性进程,最低级队列,I/O次数不多,主要是cpu的进程,在完成I/O之后,优先返回I/O进程结束的队列
死锁 - 有2个资源,一人一个,但是他们都要抢对方的,就会构成一个环路,造成死锁
- 死锁的解决方法:
- 预先静态分配法:一次性请求所有资源,不给他们抢的机会
- 资源有序分配法:把资源分类按顺序排列,不让他们形成环路
边栏推荐
- A new path for enterprise mid Platform Construction -- low code platform
- 将截断字符串或二进制数据
- Blackfly s usb3 industrial camera: buffer processing
- Use of pgpool II and pgpooladmin
- A new path for enterprise mid Platform Construction -- low code platform
- 【服务器数据恢复】raid损坏导致戴尔某型号服务器崩溃的数据恢复案例
- 最近小程序开发记录
- How can reinforcement learning be used in medical imaging? A review of Emory University's latest "reinforcement learning medical image analysis", which expounds the latest RL medical image analysis co
- New generation cloud native message queue (I)
- 张平安:加快云上数字创新,共建产业智慧生态
猜你喜欢
![[unity] upgraded version · Excel data analysis, automatically create corresponding C classes, automatically create scriptableobject generation classes, and automatically serialize asset files](/img/20/f7fc2204ca165dcea4af25cb054e9b.png)
[unity] upgraded version · Excel data analysis, automatically create corresponding C classes, automatically create scriptableobject generation classes, and automatically serialize asset files

postgresql之整體查詢大致過程

Sensor: introduction of soil moisture sensor (xh-m214) and STM32 drive code

Lombok同时使⽤@Data和@Builder 的坑

go swagger使用
![[paper reading | deep reading] rolne: improving the quality of network embedding with structural role proximity](/img/21/59c4d61b22e7d021b7a72a64a16b48.png)
[paper reading | deep reading] rolne: improving the quality of network embedding with structural role proximity

Processing image files uploaded by streamlit Library

低代码平台中的数据连接方式(上)

TiFlash 源码阅读(四)TiFlash DDL 模块设计及实现分析

机器人队伍学习方法,实现8.8倍的人力回报
随机推荐
FLIR blackfly s industrial camera: auto exposure configuration and code
最近小程序开发记录
Lidar: introduction and usage of ouster OS
Introduction to FLIR blackfly s industrial camera
The boss is quarantined
Recommended collection!! Which is the best flutter status management plug-in? Please look at the ranking list of yard farmers on the island!
阿里云中间件开源往事
Zhang Ping'an: accelerate cloud digital innovation and jointly build an industrial smart ecosystem
[paper reading | deep reading] rolne: improving the quality of network embedding with structural role proximity
FLIR blackfly s usb3 industrial camera: how to use counters and timers
纽约大学 CITIES 研究中心招聘理学硕士和博士后
阿里云易立:云原生如何破解企业降本提效难题?
传感器:土壤湿度传感器(XH-M214)介绍及stm32驱动代码
[unity] upgraded version · Excel data analysis, automatically create corresponding C classes, automatically create scriptableobject generation classes, and automatically serialize asset files
[paper reading | deep reading] dngr:deep neural networks for learning graph representations
解密函数计算异步任务能力之「任务的状态及生命周期管理」
Several classes and functions that must be clarified when using Ceres to slam
Word wrap when flex exceeds width
机器人队伍学习方法,实现8.8倍的人力回报
6 seconds to understand the book to the Kindle