open-courses
  • 公开课笔记
  • CMU 15-445/645 Database Systems
    • Relational Data Model
    • Advanced SQL
    • Database Storage
    • Buffer Pools
    • Hash Tables
    • Tree Indexes
    • Index Concurrency Control
    • Query Processing
    • Sorting&Aggregations
    • Join Algorithms
    • Query Optimization
    • Parallel Execution
    • Embedded Database Logic
    • Concurrency Control Theory
    • Two Phase Locking
    • Timestamp Ordering Concurrency Control
    • Multi-Version Concurrency Control
    • Logging Schemes
    • Database Recovery
    • Introduction to Distributed Databases
    • Distributed OLTP Databases
    • Distributed OLAP Databases
  • UCB - CS162
    • OS intro
    • Introduction to the Process
    • Processes, Fork, I/O, Files
    • I/O Continued, Sockets, Networking
    • Concurrency: Processes & Threads
    • Cooperating Threads, Synchronization
    • Semaphores, Condition Variables, Readers/Writers
    • Scheduling
    • Resource Contention & Deadlock
    • Address Translation, Caching
    • File System (18,19,20)
    • Distributed Systems, Networking, TCP/IP, RPC (21,22)
    • Distributed Storage, Key-Value Stores, Security (23)
    • Security & Cloud Computing (24)
    • Topic: Ensuring Data Reaches Disk
  • MIT - 6.006
    • Sequence and Set Interface
    • Data Structure for Dynamic Sequence Interface
    • Computation Complexity
    • Algorithms and Computation
    • Structure Of Computation
    • Graph & Search
    • Tree & Search
    • Weighted Shortest Paths
    • String Matching, Karp-Rabin
    • Priority Queue Interface & Implementation
    • Dictionary Problem & Implementation
    • Sorting
    • Dynamic Programming
    • Backtracking
    • Self-Balancing Tree
  • MIT - 6.824
    • 2PC & 3PC
    • Introduction and MapReduce
    • RPC and Threads
    • Primary/Backup Replication
    • Lab: Primary/Backup Key/Value Service
    • Google File System (GFS)
    • Raft
    • Lab: Raft - Leader Election
    • Lab: Raft - Log Replication
  • Stanford-CS107
    • 原始数据类型及相互转化
    • 指鹿为马
    • 泛型函数
    • 泛型栈
    • 运行时内存结构
    • 从 C 到汇编
    • 函数的活动记录
    • C 与 C++ 代码生成
    • 编译的预处理过程
    • 编译的链接过程
    • 函数的活动记录续、并发
    • 从顺序到并发和并行
    • 信号量与多线程 1
    • 信号量与多线程 2
    • 复杂多线程问题
    • 函数式编程 - Scheme 1
    • 函数式编程 - Scheme 2
    • 函数式编程 - Scheme 3
    • 函数式编程 - Scheme 4
    • 函数式编程 - Scheme 5
    • Python 基础
  • MIT - 6.001 - SICP
    • 什么是程序
    • 程序抽象
    • 替代模型
    • 时间/空间复杂度
    • 数据抽象
    • 高阶函数
    • Symbol
    • 数据驱动编程与防御式编程
    • 数据抽象中的效率与可读性
    • 数据修改
    • 环境模型
    • 面向对象-消息传递
    • 面向对象 - Scheme 实现
    • 构建 Scheme 解释器
    • Eval-Apply Loop
    • Normal Order (Lazy) Evaluation
    • 通用机
    • 寄存器机器
    • 子程序、栈与递归
    • 在寄存器机器中执行
    • 内存管理
  • MIT - 6.046
    • Randomized Algorithms
    • Skip Lists
  • System Design
    • Twitter
    • Cache Consistency & Coherence
  • DDIA 笔记
    • Replication
    • Transactions
    • The Trouble with Distributed Systems
    • Consistency & Consensus
  • Papers We Love
    • Consistent Hashing and Random Trees (1997)
    • Dynamic Hash Tables (1988)
    • LFU Implementation With O(1) Complexity (2010)
    • Time, Clocks, and the Ordering of Events in a Distributed System (1978)
    • Dapper, a Large-Scale Distributed Systems Tracing Infrastructure (2010)
    • Gorilla: A Fast, Scalable, In-Memory Time Series Database (2015)
  • Release It 笔记
    • Anti-patterns & Patterns in Microservice Architecture
  • Database Design
    • Log Structured Merge (LSM) Tree & Usages in KV Stores
    • Prometheus
Powered by GitBook
On this page
  1. UCB - CS162

OS intro

PreviousDistributed OLAP DatabasesNextIntroduction to the Process

Last updated 6 years ago

操作系统的基石

  • Scheduling

  • Concurrency

  • Address spaces

  • Protection, Isolation, Security

  • Networking, distributed systems

  • Persistent storage, transactions, consistency, resilience

  • Interfaces to all devices

操作系统无处不在,举例如下:

一个搜索请求从手机发出,需要首先通过 DNS 解析域名,获得服务器 ip 地址后经过网络找到搜索引擎的服务中心。在服务中心内部,请求首先来到负载均衡器,然后传递给 web 服务器,web 服务器从索引服务器、页面服务器以及广告服务器中分别获取必要的信息后组装成一个完整的页面,再经由网络传递回手机。在这整个过程中涉及到的组件,如手机、DNS 服务器、路由器、负载均衡器、索引、广告、页面服务器,每一个都有特定的操作系统在后面指挥,保证整个过程井井有条。

什么是操作系统

操作系统可以理解成一层特殊的软件,它负责为其它应用程序提供硬件资源:

  • 将不同的硬件抽象出方便易用的接口

  • 保护公共资源的使用合理

  • 安全、用户认证

  • 不同个体间的通信

"Virtual Machine" Boundary

OS 通过虚拟化为应用程序提供硬件资源,比如图中的 Threads、Processes、Files、Sockets 等等,应用软件并不知道它实际上使用了哪些硬件,执行了哪些硬件操作,OS 负责将虚拟资源与实际硬件资源连接起来。

程序 (Program) 与进程 (Process)

一段完成某个任务的代码被称为程序,代码本身描述了完成这个任务的步骤,此时它并没有被执行。当程序被载入内存中,并在处理器中开始执行时,这个运行的程序就被称为进程。

上下文切换 (Context Switch)

当进程 A 运行到一半,需要运行进程 B 时,处理器中进程 A 运行时的上下文将被存下,之后在将进程 B 的上下文载入处理器中,开始运行进程 B,这个过程叫做上下文切换。进程 A、B 可能是用户进程,也可能是系统进程。

调度和保护 (Scheduling, Protection)

当进程 A、B、C 同时存在内存中时,OS 需要决定它们谁能获取处理器资源,这个过程称为调度。由于多个进程都在内存中,它们之间不应当互相读写数据,这是 OS 需要为进程提供的保护之一。Protection Boundary 将硬件、OS 与用户进程分隔开,Boundary 以下的部分需要特殊保护,这里暂时不深入讨论。

输入与输出 (I/O)

操作系统提供输入设备与输入设备的抽象,让输入与输出的使用接口更加友好而统一。比如对于应用程序来说,闪存中的文件与硬盘中的文件并无区别。

载入 (Loading)

通常程序存储在外存设备 (storage) 中,在运行前它需要被读取到内存中,这个过程叫作载入。

操作系统的挑战

  • 处理器多核化

  • 存储能力激增

  • 网络传输能力增长

  • 互联网规模膨胀

  • 物联网

课程提纲

  • OS Concepts: How to Navigate as a Systems Programmer!

    • Process, I/O, Networks and VM

  • Concurrency:

    • Threads, scheduling, locks, deadlock, scalability, fairness

  • ·Address Space:

    • Virtual memory, address translation, protection, sharing

  • File Systems

    • i/o devices, file objects, storage, naming, caching, performance, paging, transactions, databases

  • Distributed Systems (8)

    • Protocols, N-Tiers, RPC, NFS, DHTs, Consistency, Scalability, multicast

  • Reliability & Security

    • Fault tolerance, protection, security

  • Cloud Infrastructure

参考

Youtube: CS162-1
CS162-Spring-2015