操作系统总结

本文详细介绍了操作系统的各个方面,包括系统调用、内核结构、进程管理、CPU调度策略、内存管理和虚拟内存机制。重点讨论了进程与线程的区别、死锁的条件与处理方法、以及不同内存管理技术,如页式、段式和段页式。还提到了文件系统的设计,包括目录结构、磁盘管理以及恢复策略。最后,文章提到了虚拟化技术和现代操作系统的一些高级特性。
摘要由CSDN通过智能技术生成

操作系统

操作系统

 

系统调用(API接口)

内核,用户

中断服务程序一定是操作系统编写的

内核分类:

微内核

聚内核

内核中再分(面向对象内核)

混合结构:Macos

虚拟机结构

系统的引导过程:BIOS——>BOOT

room

进程管理:

进程控制块PCB:结构体

进程绝对隔离,线程完全共享

进程效率低,线程效率高

CPU调度:

CPU-IO突发:

进程分类:

CPU绑定的进程,IO绑定的进程

调度:

进程运行-》等待

等待-》就绪

就绪-》运行

退出

 

抢占式:非自愿的(主流),通用操作系统

非抢占式:自愿的,嵌入式

分配:

恢复状态(切换上下文),切换到用户状态,找到合适的位置

分配消耗时间由硬件决定

调度的评价指标:

CPU的利用率,吞吐率,周转时间(进程的所有时间),等待时间,响应时间。

CPU的利用率,吞吐率:评价整个系统

周转时间(进程的所有时间),等待时间,响应时间:针对进程,一般采取平均值

 

优先级调度:多级队列:同一个队列中的优先级相同

常用的数据结构:多级反馈队列——>现在的操作系统常用的处理方式

反馈的实现:基本的策略:所有线程先放在最高优先级,当CPU用的较多的时候优先级下降。动态判断,当从等待状态变为准备状态时,优先级就会上升一点。一般IO绑定的再高优先级。

多核CPU:每一个核心同时只能运行一个进程

特点:负载均衡

核心需均衡:进程迁移,刷新cpu cache

 

进程的同步:当同时访问共享的数据时,有可能破坏数据。

生产者-消费者问题

进程的切换是随机的,即在一条CPU指令执行完毕之后都会有可能进行中断响应(进程切换)。

解决办法要求:

竞争条件——>临界区:一段代码对共享的数据进行了访问,那这段代码就是临界区

解决的办法:对临界区的保护,在任意时刻只有一个进程可以访问临界区。

策略:锁

怎么给临界区加锁:

必须符合三大定律:互斥条件、进度的条件、有限等待(公平性)

终极解决办法:硬件可以控制中断——>关中断(要求时间间隔短),原子硬件指令。

常见两种指令:

Test memory word and set value:testAndSet

Swap countents of tow memory words

加锁,性能下降

信号量:一个整数,P(),V()操作。wait,signal(原子操作)。

计数信号量:特殊:二制信号量(互斥锁)

硬件支持:开关中断 或 TestAndSet

实现中的问题:忙等——>自旋。解决的办法:将其放入等待态。信号量维护了一个等待队列,当有资源时唤醒。

Block,wakeup

经典进程通信问题:

生产者-消费者问题:缓冲区,定义三个信号量:互斥信号量(保护缓冲区),空余缓冲区量,缓冲区中有多少个满的

读者-写者问题:一些进程属于读者,读不会破坏数据。一些进程属于写者,会破坏数据。同一时刻只能有一个写者操作,且不能对读者有影响(只能在没有读者的情况下写)。解决:三个信号量——>读写者互斥信号量、

存储:文件系统、数据库(事务解决了读者写者问题)。策略:更改了指针的指向,回收旧内存

哲学家就餐问题:——>死锁

管程:一种更高阶的对临界区进行保护的方法&#x

In 1998, VMware figured out how to virtualize the x86 platform, once thought to be impossible, and created the market for x86 virtualization. The solution was a combination of binary translation and direct execution on the processor that allowed multiple guest OSes to run in full isolation on the same computer with readily affordable virtualization overhead. The savings that tens of thousands of companies have generated from the deployment of this technology is further driving the rapid adoption of virtualized computing from the desktop to the data center. As new vendors enter the space and attempt to differentiate their products, many are creating confusion with their marketing claims and terminology. For example, while hardware assist is a valuable technique that will mature and expand the envelope of workloads that can be virtualized, paravirtualization is not an entirely new technology that offers an “order of magnitude” greater performance. While this is a complex and rapidly evolving space, the technologies employed can be readily explained to help companies understand their options and choose a path forward. This white paper attempts to clarify the various techniques used to virtualize x86 hardware, the strengths and weaknesses of each, and VMware’s community approach to develop and employ the most effective of the emerging virtualization techniques. Figure 1 provides a summary timeline of x86 virtualization technologies from VMware’s binary translation to the recent application of kernel paravirtualization and hardware-assisted virtualization.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值