读书笔记系列 - 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.


目录
相关文章
|
11月前
|
Java API Spring
读书笔记系列 - Operating Systems: Three Easy Pieces - Virtualization - Chapter 4: Processes
读书笔记系列 - Operating Systems: Three Easy Pieces - Virtualization - Chapter 4: Processes
63 0
读书笔记系列 - Operating Systems: Three Easy Pieces - Virtualization - Chapter 4: Processes
|
11月前
|
安全 Unix Shell
读书笔记系列 - Operating Systems: Three Easy Pieces - Virtualization - Chapter 5: Process API
读书笔记系列 - Operating Systems: Three Easy Pieces - Virtualization - Chapter 5: Process API
69 0
|
存储 缓存 安全
《optimizing software in c++》读书笔记(二)
《optimizing software in c++》读书笔记(二)
171 0
|
XML 数据格式
How to trouble shooting Adobe PDF generation issue
In case you encounter Adobe PDF generation issue, you could follow the tip described below to find the root cause. This tip can also be used to get the performance data of your PDF rendering.
119 0
How to trouble shooting Adobe PDF generation issue
|
人工智能 自然语言处理 搜索推荐