What OS do
操作系统是管理计算机硬件的程序
computer system: hardware, operating system, application programs, users
hardware: CPU, memory, I/O devices
user view
services provided by OS:
-
program development (editors and debuggers)
-
program execution
-
access to IO devices
-
controlled access to files
-
system access
-
error detection and response
-
internal and external hardware errors
memory error, device failure
-
software errors
arithmetic overflow, accesss forbidden memory locations
外中断: interruption 与当前运行程序无关的事件
内中断: exception / trap 非法操作码,地址越界,算术溢出,缺页,专门陷入指令…
-
-
accounting
- collect statistics
- monitor performance
system view
resource allocator, control program
defining OS
kernel, one program running at all times
系统软件。程序模块的集合。组织和管理计算机的软硬件资源。
computer-system organization
computer startup: bootsrap program: stored in ROM/EEPROM, AKA firmware
硬件&固件:
A hardware has a physical entity
A hardware needs a program to run. A firmware is a program itself.
A hardware cannot operate without a firmware. A firmware operates on a hardware.
OS starts executing the first process, and waits for some event to occur:
-
an interrupt from the hardware
sending a signal to CPU by way of the system bus
-
an interrupt from the software
executing a system call
computer-system operation
device controller informs CPU that it has finishd its operation by causing an interrupt
interrupt:
interrupt vector(中断向量): the staring address of all the interrupt service routines(中断服务程序).
a trap is a software-generated interrupt caused either by an error or a user request
OS is interrupt-driven
storage structure
storage hierarchy
speed, cost, volatility
IO structure
-
programmed IO
IO module performs the action
-
interrupt-driven IO
processor is interrupted when IO module ready to exchange data
processor is free to do other work
consume a lot of processor time
we need system call & device-status table
-
synchronous IO
After I/O starts, control returns to user program only upon I/O completion.
-
asychronous IO
-
-
DMA
Transfers a block of data directly to / from memory.
device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention.
Only one interrupt is generated per block. The processor is only involved at the beginning and the end of the transfer.
-
IO channel
一个CPU和多个device controller通过总线连接。每个dvice controller可负责多个特定类型设备。
OS为每个device controller提供一个device driver, driver presents a uniform interface to the device
computer-system architecture
single-processor system
multiprocessor system / parallel system / tightly coupled
增加吞吐量、规模经济、增加可靠性
graceful degradation: 提供与正常工作的硬件成正比服务的能力
fault tolerant: 超出适度退化的能力 容错
-
asymmetric multiprocessing
主从
each processor is assigned a specific task. a master processor controls the system, allocates work to the slave processors.
-
symmetric multiprocessing SMP
-
multicore-CPUs
Multiple compute cores on a single chip 多个内核 单个芯片
-
blade servers 刀片服务器
每个刀片处理器独立启动并运行各自的OS
clustered system
与多处理器系统不同:多个独立系统耦合
共享存储并通过LAN/更快内部连接
asymmetric clustering: one machine is in hot-stand-by mode(热备份)
symmetric clustering: monitor each other
OS structure
-
time-sharing system(multitasking)
interactive
response time short
允许多用户同时共享计算机
CPU scheduling & multiprogramming : 以提供用户分时计算机的一部分
为保证合理响应时间,通过swapping得到,使用virtual memory
OS operations
dual mode: user mode & monitor mode
mode bit provided by hardware
Some instructions are designated as privileged, only executable in kernel mode.
System call changes mode to kernel mode, return from call resets it to user mode.
特权指令包括转换到用户模式,IO控制,定时器管理,中断管理等
process management
Single-threaded process has one program counter specifying location of next instruction to execute.
Multi-threaded process has one program counter per thread.
memory management
determines what is in memory
Central to the operation of a modern computer system. All data should be in memory before and after processing. All instructions should be in memory in order to execute.
virtual memory:
storage management
-
file-system management
Access control on most systems to determine who can access what.
-
mass-storage management
secondary storage, tertiary storage
-
caching
copying information into faster storage system
-
disk cache
A portion of main memory used as a buffer to temporarily to hold data for the disk.
-
cache memory 高速缓存
invisible to OS
coherency & consistency
-
-
IO subsystem
protection and security
-
protection
控制进程或用户对计算机系统资源的访问的机制
-
security
防止系统不受外部或内部攻击
-
access control
-
information flow control
-
certification
保护和安全需要系统能区分用户,user ID(UID); 需要区分用户集,group ID
privilege escalation: 有时用户需要升级特权来获取对一个活动的额外特权
distributed systems
loosely coupled
network: communication path TCP/IP协议常用
network operating system: 更自治 提供信息交换的通信 file sharing, communication, runs independently
分布式系统更少自治,不同的草作系统紧密连接,好像是一个操作系统控制网络 process migration
special-purpose systems
-
real-time system
Often used as a control device in a dedicated application
hard/soft
-
real-time embedded system 实时嵌入式系统
OS很limited
-
multimedia system 多媒体系统
将多媒体数据加入到计算机系统(audio and video files)
-
handheld system 手持系统
PDA: personal digital assistants 专门的嵌入式系统
computing environments
traditional computing
client-server computing: computer-server, file-server
peer-to-peer computing: centralized lookupservice, discovery protocol, voice over IP
cloud computing
Operating System Concepts 7th edition
Operating System Concepts 7th edition
Operating System Concepts 7th
最后修改于 2020-02-28