作業系統Ch6: Process Synchronization
Background
<font color = red>Concurrent</font> access to 共享 data 導致 data inconsistency
維護 data consistency 需要確保按順序地執行 cooperating processes 的機制。
Consumer & Producer Problem
決定是否 buffer 是空的或滿的過去: use <font color = red>in, out</font> position
現在: use <font color = red>counter</font>
WenHsuanYu changed a year agoView mode Like Bookmark
作業系統Ch4: Multithreaded Programming
Thread Introduction
Threads
a.k.a <font color=red> lightweight process </font>: basic unit of CPU utilization
All threads 屬於同一個 process 共享 code section, data section and OS resources (e.g., open files and signals)
But each thread 有屬於自己的 thread control blockthread ID, program counter, register set and a stack (local variables)
Motivation
Example: a web browser一個執行緒顯示內容,當其他執行緒正在從網路上收到 data
WenHsuanYu changed a year agoView mode Like Bookmark
作業系統Ch8: Memory Management
Background
CPU 可以直接存取的只有 Main memory and registers。
在 disk 上等待被帶入 memory 和被執行的 processes 集合。
多個 programs 帶入到 memory 以改善資源使用率和 response time to users。
A process 可能在執行過程中的 disk 和 memory 之間移動。
Multistep Processing of a User Program
在不同時間,可能會進行不同 address binding。
WenHsuanYu changed a year agoView mode Like Bookmark
作業系統Ch2: OS Structure
OS Services
<font color = 'red'>User interface</font>CLI (Command Line Interface)自使用者用抓取 command 且執行它
Shell: Command-line interpreter (CSHELL, BASH)根據使用者行為和偏好調整。
GUI (Graphic User Interface)
Program Execution
WenHsuanYu changed a year agoView mode Like Bookmark
作業系統Ch5: Process Scheduling
Basic Concepts
<font color = red> CPU-I/O burst cycle</font>: Process 執行是由 CPU execution and I/O wait 的 cycle 所組成 (i.e., CPU burst and I/O burst).一般來說,有很大數量的短 CPU bursts 和很小數量的長 CPU bursts。
A I/O-bound program 通常會有許多非常短的 CPU bursts。
A CPU-bound program 通常會有許多較長的 CPU bursts。
CPU-I/O burst cycle
Histogram of CPU-Burst Time
WenHsuanYu changed a year agoView mode Like Bookmark
作業系統Ch3: Processes Concept
Process Concept
Process
Program - passive entity: binary stored in disk.
Process - active entity: a program in execution in memory.
A process includes:
<font color='red'>Code segment </font>(text section) - literal strings
WenHsuanYu changed a year agoView mode Like Bookmark