读书笔记系列 - Operating Systems: Three Easy Pieces - Intro

简介: 读书笔记系列 - Operating Systems: Three Easy Pieces - Intro

Preface

The three easy pieces refer to the three major thematic elements the book is organized around: virtualization, concurrency, and persistence.


1. Dialogue

1.I hear and I forget. I see and I remember. I do and I understand.

2.According to http://www.barrypopik.com (on, December 19, 2012, entitled “Tell me and I forget; teach me and I may remember; involve me and I will learn”) Confucian philosopher Xunzi said “Not having heard some thing is not as good as having heard it; having heard it is not as good as having seen it; having seen it is not as good as knowing it; knowing it is not as good as putting it into practice.” Later on, the wisdom got attached to Confucius for some reason.


2. Introduction

1.Well, a running program does one very simple thing: it executes instructions.

2.Many millions (and these days, even billions) of times every second, the processor fetches an instruction from memory, decodes it (i.e., figures out which instruction this is), and executes it (i.e., it does the thing that it is supposed to do, like add two numbers together, access memory, check a condition, jump to a function, and so forth). After it is done with this instruction, the processor moves on to the next instruction, and so on, and so on, until the program finally completes.

3.THE CRUX OF THE PROBLEM: HOW TO VIRTUALIZE RESOURCES – One central question we will answer in this book is quite simple: how does the operating system virtualize resources? This is the crux of our problem. Why the OS does this is not the main question, as the answer should be obvious: it makes the system easier to use. Thus, we focus on the how: what mechanisms and policies are implemented by the OS to attain virtualization? How does the OS do so efficiently? What hardware support is needed?

4.The primary way the OS does this is through a general technique that we call virtualization. That is, the OS takes a physical resource (such as the processor, or memory, or a disk) and transforms it into a more general, powerful, and easy-to-use virtual form of itself. Thus, we sometimes refer to the operating system as a virtual machine.

5.A typical OS, in fact, exports a few hundred system calls that are available to applications. Because the OS provides thse calls to run programs, access memory and devices, and other related actions, we also sometimes say that the OS provides a standard library to applications.

6.Because virtualization allows many programs to run (thus sharing the CPU), and many programs to concurrently access their own instructions and data (thus sharing memory), and many programs to access devices (thus sharing disks and so forth), the OS is sometimes known as a resource manager. Each of the CPU, memory, and disk is a resource of the system; it is thus the operating system’s role to manage those resources, doing so efficiently or fairly or indeed with many other possible goals in mind.

7.It turns out that the operating system, with some help from the hardware, is in charge of this illusion, i.e., the illusion that the system has a very large number of virtual CPUs. Turning a single CPU (or a small set of them) into a seemingly infinite number of CPUs and thus allowing many programst o seemingly run at once is what we call virtualizing the CPU, the focus of the first major part of this book.

8.If two programs want to run at a particular time, which should run? This question is answered by a policy of the OS; policies are used in many different places within an OS to answer these types of questions, and thus we will study them as we learn about the basic mechanisms that operating systems implement (such as the ability to run multiple programs at once). Hence the role of the OS as a resource manager.

9.The model of physical memory presented by modern machines is very simple. Memory is just an array of bytes; to read memory, one must specify an address to be able to access the data stored there; to write (or update) memory, one must also specify the data to be written to the given address.

10.Each process accesses its own private virtual address space (sometimes just called its address space), which the OS somehow maps onto the physical memory of the machine. A memory reference within one running program does not affect the address space of other processes (or the OS itself); as far as the running program is concerned, it has physical memory all to itself. The reality, however, is that physical memory is a shared resource, managed by the operating system. Exactly how all of this is accomplished is also the subject of the first part of this book, on the topic of virtualization.

11.In system memory, data can beeasily lost, as devices such as DRAM store values in a volatile manner; when power goes away or the system crashes, any data in memory is lost. Thus, we need hardware and software to be able to store data persistently; such storage is thus critical to any system as users care a great deal about their data.

12.So now you have some idea of what an OS actually does: it takes physical resources, such as a CPU, memory, or disk, and virtualizes them. It handles tough and tricky issues related to concurrency. And it stores files persistently, thus making them safe over the long-term. Given that we want to build such a system, we want to have some goals in mind to help focus our design and implementation and make trade-offs as necessary; finding the right set of trade-offs is a key to building systems.

13.One of the most basic goals is to build up some abstractions in order to make the system convenient and easy to use.

14.One goal in designing and implementing an operating system is to provide high performance; another way to say this is our goal is to minimize the overheads of the OS.

15.Another goal will be to provide protection between applications, as well as between the OS and applications. Protection is at the heart of one of the main principles underlying an operating system, which is that of isolation; isolating processes from one another is the key to protection and thus underlies much of what an OS must do.

16.The operating system must also run non-stop; when it fails, all applications running on the system fail as well. Because of this dependence, operating systems often strive to provide a high degree of reliability.

17.Other goals make sense: energy-efficiency is important in our increasingly green world; security (an extension of protection, really) against malicious applications is critical, especially in these highly-networked times; mobility is increasingly important as OSes are run on smaller and smaller devices.


目录
相关文章
|
8月前
|
IDE Java Maven
Maven 本地仓库替代私仓配置指南
本文记录了因公司Nexus私仓下线导致Maven依赖失效的应急解决方案:包括修改settings.xml全局配置本地仓库、利用mirror机制重定向请求等实用技巧,兼顾团队协作与项目兼容性,是开发人员应对“历史遗留”依赖问题的实战指南。(239字)
583 1
Maven 本地仓库替代私仓配置指南
|
8月前
|
人工智能 算法 BI
最新GEO 优化公司上门核验提问清单
本指南聚焦2026年GEO行业真实标准,围绕“真实能力、可落地效果、合规可持续”三大原则,提供七大类24个核验问题及明确判断要点,覆盖技术底座、案例实测、效果监测、合规信源、定制售后等全链路,助企业现场甄别真GEO服务商,避开套壳、违规与无效交付。(239字)
|
8月前
|
人工智能 数据可视化 BI
企业智能体能否替代财务人员?专家深度解读
大模型与企业智能体正推动财务数字化转型,自动记账、报税等重复工作已可自动化。但AI无法替代财务人员的战略决策、风险把控与业务协同能力。本文厘清人机边界,倡导“赋能而非替代”,助力财务人转向高价值分析与决策岗位。
769 2
|
Java API 开发工具
蚂蚁百宝箱 ✖️ 调用对话型智能体
通过调用本接口,开发者可以向指定智能体发起对话,支持在对话时添加上下文消息,便于智能体做出合理的回复。
494 0
|
安全 数据挖掘 API
车辆车型大全 API 实战指南:推动交通行业智能化
车辆车型大全API由探数平台提供,旨在解决企业班车、物流运输及汽车销售等行业对标准化车型数据的需求。传统人工维护车型库效率低且易出错,而该API覆盖主流品牌与车系,包含品牌、车系、销售车型及配置参数等详细信息,适用于车队管理、电商平台及汽车资讯平台。API提供四个子接口:获取品牌、车系、销售车型与配置详情信息,支持高效查询。通过HTTP POST请求即可调用,返回结构化数据,助力企业实现智能化运营与科学决策,在绿色智能交通时代发挥重要作用。
946 4
|
11月前
|
数据采集 人工智能 调度
【深度解析】多智能体协作新范式:为何企业级架构急需“AI Agent指挥官”与“AI调度官”?
本文探讨大模型时代多智能体系统的核心角色:AI Agent指挥官与AI调度官。前者负责任务拆解与流程编排,后者专注模型路由与资源优化。二者协同实现高效、低耗的智能体集群架构,助力企业构建高可用、可进化的AI生产力引擎。
802 5
|
SQL 安全 UED
通义灵码在DBA日常SQL优化中的使用分享
通义灵码在DBA日常SQL优化中的使用分享
1218 1
通义灵码在DBA日常SQL优化中的使用分享
|
传感器 JSON 机器人
Sasha:使用大语言模型在智能家居中进行创造性目标导向推理——论文阅读
Sasha利用大语言模型实现智能家居中的创造性目标导向推理,通过迭代式澄清、过滤、规划与反馈机制,有效响应模糊用户指令。系统在真实家庭环境中表现出高相关性与用户满意度,支持复杂多步任务的自然交互,显著提升智能空间的适应性与可用性。
845 17
Sasha:使用大语言模型在智能家居中进行创造性目标导向推理——论文阅读
|
11月前
|
存储 缓存 安全
阿里云服务器通用型g7/g8y/g8i/g9i/g9a实例产品对比与选择参考
目前阿里云在售的云服务器中,主要包含了第7代、第8代和第9代实例规格的云服务器产品,在选择云服务器实例规格时,对于需要平衡计算、存储和网络性能的应用场景来说,通用型g7、通用型g8y、通用型g8i、通用型g9i、通用型g9a实例是许多用户的热门选择。为了帮助大家更好地了解这几款实例的区别,并为选择提供参考,本文将详细对比它们的实例规格、CPU、内存、计算、存储、网络等方面的性能,并附上活动价格对比。让大家了解一下他们之间的不同,以供参考选择。
1730 0
|
机器学习/深度学习 缓存 PyTorch
pytorch学习一(扩展篇):miniconda下载、安装、配置环境变量。miniconda创建多版本python环境。整理常用命令(亲测ok)
这篇文章是关于如何下载、安装和配置Miniconda,以及如何使用Miniconda创建和管理Python环境的详细指南。
11070 0
pytorch学习一(扩展篇):miniconda下载、安装、配置环境变量。miniconda创建多版本python环境。整理常用命令(亲测ok)