蒋岩炎老师 2024spring 操作系统第一课。

# 课后教材阅读

# Preface 前言

Virtualization, concurrency and persistence

虚拟化,并发和持久性

Learning new things is fun, right? At least, it (usually) should be.【yepppp!】

Crux of the problem, timelines

image-20240402003403641

Education is not the filling of a pail but the lighting of a fire.

很喜欢这段话,the real point of education is to get you interested in something, to learn something more about the subject matter on your own and not just what you have to digest to get a good grede in some class. 说实话,国内教授走上讲台之前都应该思考一下 “什么是教育”,毫不客气地说,有一半以上的大学老师并非合格的老师。

# 第 1 章 - Dialogue on the Book

image-20240402003413903

# 第 2 章 - Introduction to Operating Systems

虚拟化:操作系统将物理资源转化成更易使用的虚拟资源

从应用程序的角度看,操作系统提供了各种 api;从物理资源的角度看,操作系统完成了资源(内存、磁盘、处理器等)的调度

# 虚拟化 - cpu

image-20240402003421487

-Wall 参数表示编译后显示所有警告

ps aux | grep './cpu'
kill PID    
kill $(pgrep -f './cpu')

image-20240402003428819

电脑不是只有一个 cpu(也许不止),怎么能同时运行 4 个程序的?

如果两个程序都要在一个特定的时间运行怎么办?

# 虚拟化 - 内存

image-20240402003438110

为什么,看上去是同时修改了统一 addr 的值?

# 并发

gcc -o threads threads.c -Wall -pthread

这里的 -pthread 是使用 GCC 编译器编译包含 POSIX 线程(pthread)的 C 或 C++ 程序时使用。这个选项告诉编译器链接程序时要包含 POSIX 线程库。

POSIX 线程(Portable Operating System Interface for uniX,POSIX Threads),简称为 Pthreads,是一个线程标准,定义了一套跨平台的线程相关的 API

# 持久化

和 CPU 与内存不一样,OS 并没有创建私有、虚拟的磁盘为每一个应用。相反,他们需要共享文件。

更新于 阅读次数

请我喝[茶]~( ̄▽ ̄)~*

quas-modo 微信支付

微信支付

quas-modo 支付宝

支付宝

quas-modo 贝宝

贝宝