技术根儿扎得深,不怕“首都”狂风吹!

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" 始终相信那句话 “种下一棵树最好的时候是十年前,其次是现在”。对于如何构建知识体系我有自己的门道。其实就是基础知识,它就像一颗树的根,要扎的经可能的深,汲取大地中更多养分已供养大树的枝繁叶茂。操作系统就是其中一条根!","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"《重拾操作系统》","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"第一篇:成长之路","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"操作系统是一种复杂的系统软件,是不同代码程序,数据结构,数据初始化文件的集合,可执行。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"1.职业目标","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"1.与硬件部分相互作用,为包含在硬件平台上的所用底层可编程部件提供服务。","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"显示器,必须为驱动显示器工作的一些寄存器赋值。","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2.为运行在计算机上的应用程序提供执行环境。","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"高级语言的应用程序是不能在裸机上运行的,必须运行再次操作系统上。","attrs":{}}]}],"attrs":{}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"2.岗位职责","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"2.1.用户与硬件的接口","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"软件接口","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"c 语言中的调用函数 print()等。","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"硬件接口","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"USB 接口,串口,并口等。","attrs":{}}]}],"attrs":{}},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"2.2.资源管理者","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/c0/c0467eff4b88bac550e0d0925a4b0420.png","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"heading","attrs":{"align":null,"level":5},"content":[{"type":"text","text":"2.2.1.管理","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"现代计算机的特点就是支持多任务,即允许在同一个系统内驻留多个应用程序。多个计算机程序共同使用计算机硬件和软件资源的时候,就需要操作系统对这些资源进行有效管理。一方面保证用户程序的顺利执行。另一方面使计算机资源得到尽可能高效的利用。保证计算机的系统性能。","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}}],"text":"延伸 - 个人的自我管理也许需要一套适合自己的操作系统(方法论),来管理和约束自己。有效利用资源使自己的“性能”不断提高。","attrs":{}}]}],"attrs":{}},{"type":"heading","attrs":{"align":null,"level":5},"content":[{"type":"text","text":"2.2.2.资源","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"处理机管理","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"程序的执行必须依赖处理机,任意时刻的处理机只能执行一个程序流。因此在单处理机的系统中执行多个程序流,必须有操作系统的处理机调度程序来管理处理机的分配,以使多个程序共享处理机,宏观上是多个程序是同时运行。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"内存管理","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在多任务系统中,内存不在是独占资源,而是可能被多个应用程序共同占用。如何为多个应用程序分配内存并使不同的应用程序的地址空间互不干扰,如何在应用程序执行完成后回收其所占用的内存,已完成逻辑地址到物理地址的转换。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"设备管理","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"设备主要完成用户的i/o 请求,为用户分配i/o设备,管理i/o的缓存 和驱动i/o设备等功能。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"文件管理","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"计算机系统把大量需要长时间保留的数据信息已文件的形式存放在外存设备中,操作系统需要根据自己的文件管理程序完成外存空间的分配,回收,文件的按名存取,文件的组织,共享与保护。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"3.成长历程","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/3b/3b5d8f414f74a951200d621680f994f4.png","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"3.1.无操作系统","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"硬件环境:电子管,没有用来存储程序的内存。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"使用方式:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"1.操作人员把作业挂到输入设备上。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2.启动设备。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"3.运算结束取出结果。","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"例子:操作员用穿孔卡片表示程序和数据,需要运行这些穿孔卡表示作业时,程序要把卡片和交给输入室的计算机输入员,然后程序员等待输出结果。计算机运行当前作业后,将计算机结果打印输出,操作员到打印机上撕下运算结果送到输出室,程序员可以在这里渠道自己的运行输出结果。","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"新问题:机器速度很快的时候cpu长时间等待人工操作,造成来cpu资源的浪费。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"3.2.单道批操作系统","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"硬件环境:晶体管,开始使用磁性存储设备,内外存容量增加。计算机的运算速度提高。","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"解决无操作系统的问题,利用磁性存储设备提高输入/输出速度。同时程序常驻内存并自动装入作业,撤销作业,输出运算结果。","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"使用方式: ","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"1.使用一台相对偏移的,专门用来输入的计算机把作业从穿孔卡输入到磁带上,一盘磁带可以存储多个作业。 ","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2.操作员把存有批量作业的磁带装入到磁带机。 ","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"3.操作员在专门技术的,性能较高的计算机上装入早期的操作系统,也称为“监控程序”,它能自动从磁带读入作业并运行。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"4.把作业运行结果写入专门存放输出结果的磁带上。 ","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"5.每当一个作业运行结束之后,操作系统自动从磁带中读取下一个作业并使之运行。 ","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"6.当一批作业完成后,操作员取下输入和输出磁带,将输入磁带换成下一批作业。","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"特点:内存中只能驻留一道用户作业,cpu 和 内存作业被用户作业独占。","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"新问题:在设备控制器控制设备完成输入/输出的一段时间内不需要 cpu 干预,此段时间内 cpu 空闲,无事可做。对于租用计算的用户而言,损失了cpu 的机时,而计算损失了系统的吞吐量。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"3.3.多道批操作系统","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"硬件环境:集成电路","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"商业活动中一些商人尝试生产一种通用计算机试图把用于科学计算,工程计算及磁带归档,打印处理的两类计算机合二为一。","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"通用计算机的新问题","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"1.cpu 密集型的工作 ,输入输出设备操作较少。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2.输入/输出 密集型的工作 ,cpu 等待最多产生 80%~90%浪费。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"最开始的想法:将内存分成几个部分,每一部分存放不同的作业,当一个作业等待输入/输出操作完成时候,另位一个作业可以使用cpu,任何时刻,当一个作业运行完毕,操作系统会自动从外存装入另一个作业到空闲的内存区域。这就是产生了多道批操作系统。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"新问题:早期的多到批操作系统不具备交互功能,提交作业之后,等待很长时间可能获取的只是一个语法的error。后面就产生了分时操作系统。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"3.4.微机器操作系统","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"个人计算机","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"3.5.实时操作系统","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"支持实时计算的系统,要求规定时间内计算出 1 + 1 = 2。不仅是计算出 1 +1 =2;","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"3.6.反思与对比","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":5},"content":[{"type":"text","text":"单道批操作系统","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"自动性:自动将作业装入内存内存运行,当运行完成后自动撤销运行完毕的作业,并异常装入下一个作业。使之运行。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"顺序性: 按照顺序依次将作业装入内存,先装入内存的作业先运行完毕。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"单道性:任何时刻只有一道作业","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":5},"content":[{"type":"text","text":"多道批操作系统","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"多道性:在内存中可以同时驻留多道程序,当cpu上对工作执行i/0操作时候,该cpu可以执行其他作业,从而提高系统资源的利用率和吞吐量。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"无序性:多个任务完成的顺序与他们进入内存的顺序之间没有严格的对应关系,同时驻留内存中的作业,其获得cpu的顺序和执行的进度无法预知。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"调度性:多道程序系统必须具备作业的调度功能。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"复杂性:多道程序系统对作业共享资源的管理,作业的并发执行,及分时系统的终端用户管理问题。因此其功能和实现计算比单到批覆杂的多。","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"优点与不足:提高 cpu,io,内存的利用率和系统的吞吐量。系统的平均运行周期长,缺乏交互能力。","attrs":{}}]}],"attrs":{}},{"type":"heading","attrs":{"align":null,"level":5},"content":[{"type":"text","text":"分时系统","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"分时系统是多道批系统的自然延伸,支持多任务用户同时驻留内存,每个用户终端与主机交互时都能得到相应。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"多路性:运行一台主机同时存在多个连接的终端。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"独立性:各个终端用户彼此独立操作,互不干扰。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"及时性:用户在很短的时间内获取相应。交互性:用户可通过终端与系统进行广泛对话。","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"优点:提供了人机交互的方便性,使多个用户通过不同的终端共享主机。分时系统的实现解决了两个关键性问题,即及时接收和及时处理。","attrs":{}}]}],"attrs":{}},{"type":"heading","attrs":{"align":null,"level":5},"content":[{"type":"text","text":"实时系统","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"多路性:除了具备分时系统的多路性特点外,主要表现在对多路现场信息进行采集,以及对各个对象或者执行机构进行控制。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"独立性:具备分时系统的特点,信息的采集和对对象的控制彼此互不干扰。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"及时性:实时信息处理系统对实时性的要求是已人能接收的等待时间来确认,而实时控制系统的及时性则是已控制对象的开始时间和完成截止时间来确定的。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"交互性:实时系统的交互仅限于访问系统某些特定的专用服务程序。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"可靠性:实时系统比分时系统更可靠。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#F5222D","name":"red"}}],"text":"需要注意的是,批处理系统,分时系统和实时系统是三种基本的操作系统类型,而一个实际的操作系统可能兼容三者或其中两者的功能特点。","attrs":{}}]}],"attrs":{}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"4.特征展现","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"并发","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"并发是指两个或多个事件在同一时间间隔内发生。并强调“同一时间间隔”,与并行是有区别的两个概念,并行是指多个事件同时发生。","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"共享","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"共享是指系统中的资源可供内存中多个并发的进程使用。资源共享有两种方式:互斥共享,同时共享","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"虚拟","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"是指通过某种技术把物理实体,变成若干逻辑上的对应物。","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"异步性","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"进程已不可预知的速度向前推进。","attrs":{}}]}],"attrs":{}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"5.体系结构演变","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/ef/ef49b6f5b1e4a2979948ad774307701a.png","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"5.1.简单的监控程序模型","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"系统功能相对简单,任意时刻只能运行一个任务,保证了对系统的互斥访问,保护了系统数据的安全。","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"不足:缺乏可伸缩性,任务独占整个系统大大降低了系统中潜在的并发性,是系统的效率严重受损。在设计方面缺乏结构性的指导,整个系统的所有功能全部集中在一个单一模块中。","attrs":{}}]}],"attrs":{}},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"5.2.单结构模型","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"所有的软件和数据结构都放置在一个逻辑模块中,对外出的用户程序提供一个完整的内核界面(系统调用)。结构简单,便于理解和实现,而系统所有部分都集中在一个内核中,效率较高。","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"不足:整个系统由若干具有独立功能的子程序组成,系统部分之间没有明确的位置概念,彼此没有信息隐藏,运行一个子程序调用其他子程序。由于各个子程序之间可以相互调用,系统关系复杂,容易引起循环调用和死锁。修改一个子程序往往导致若干相关部分的变动,系统的可修改性和可维护性较差。","attrs":{}}]}],"attrs":{}},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"5.3.层次结构模型","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"单结构体之间的各个部分紧密依赖,互相调用,当系统模块较多时候,无序的相互调用\b,造成系统的复杂度难以驾驭。层次结构的基本思想将系统分解为多个小的,容易理解的层,系统功能被隔离在不同的层中,每一层提供对系统功能的部分“抽象”,然后采用单向的调用顺序,形成一串彼此联系的对系统功能的“抽象串”,最终形成对整个功能的抽象。“分层”结构使操作系统中的各个模块之间的组织和依赖关系清晰明了,系统的可读性,可靠性,可移植性得到了增强。此外,对某一层的修改或替换只影响临近两层。","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"不足:分层设计的困难之处在于如何确定各层的顺序和内容,处理不好将会出现“循环依赖”问题。另外一个就是系统性能问题,有时候系统完成一个功能需要穿越多个层才能实现,系统的颗粒度越小,所花费的时间就越大。","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"将所有功能模块放在内核模型中现有不足是功能和代码的增加结构变得复杂\b\b,这种系统的代码变得可扩展性,可移植性,可维护性越来越差。错误也随之增多。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"5.5.客户/服务器模型与微内核","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"微内核用水平分层结构代替了原来的传统的纵向分层的结构,这样带来的好处是系统结构清晰,就有较高的灵活性,可靠性,可维护性;首先只要接口规范,操作系统可以方便的增加和删除服务功能,系统具有很好的灵活性。","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"不足:微内核的设计有一个严重的不足就是效率不高;微内核采用消息传递机制来实现组件之间的通信,消息收发的代价比传统的操作系统要大。应为任何消息的传递潜在的地方都有可能跨越系统的边界。那么参数需要被复制而不是从发送者的栈引用。另外,发送者和接收着消息之间的同步也增加了系统的开销。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"改进:一,直接优化系统的消息传递机制。二,扩大微内核并把关键性服务程序和驱动程序加入到内核中从而减少系统在用户态和核心态直接的切换。","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"微内核技术是现在操作系统额一个发展趋势,结合面向对象设计的方法,微内核具有更多地应用空间。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"5.6.动态可扩展结构模型","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" 20世界80年代提出,基本思想是在运行过程中,能够动态实现系统的行为扩展。具体实现动态可扩展结构,首先要解决的问题就是如何实现系统行为的动态改变。目前实现的方式就是通过动态的增删除系统中代码,采用的主要技术由 UPCALL 和 DOWNLOAD。(元编程的感觉)","attrs":{}}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"UPCALL 技术是指在微内核操作系统中通过核心层到用户层的调用方式来扩展的技术。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"DOWNLOAD技术的核心思想就是将软件构件动态下载到内核中,以达到改变操作系统的目的。","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"以上为 《重拾操作系统》系列的第一篇\"成长之路\",欢迎大家的留言讨论。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"italic","attrs":{}},{"type":"size","attrs":{"size":12}},{"type":"strong","attrs":{}}],"text":"最后用《爱丽丝梦游仙境》里红皇后对爱丽丝的一句话与大家共勉【你必须尽力不停的跑,才能使你保持在原地】。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"color","attrs":{"color":"#40A9FF","name":"blue"}}],"text":"今天北京的天气太应景了,还是把这篇文章发了吧!","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/31/31d9a63532d5643b903f02529afd06f2.png","alt":null,"title":"","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章