---
title: Chap0:Historical Prospective
---
# 作業系統Ch0: Historical Prospective
###### tags: `Operating System` `Review` `Ch0`
## Mainframe Systems
Mainframe systems:最早的電腦其中之一,而且很貴,I/O裝置很慢。
(Mainframe指的是體積很大)
Mainframe systems至今仍然存在,專門在處理某一件事情的機器,而且是大量工作的機器仍然稱之為Mainframe
> better reliablility & security e.g., hospitals, banks
Evolution: Batch **--->** Multi-programming **--->** Time shared
### Batch(批次)
利用(寫好一堆)打洞卡來處理,一次只能處理一個program(獨佔完後才能下個 batch),
處理步驟如下。
1. Users submit jobs (program, data, control card).
2. Operator(使用者) sort jobs with similar requirements.
3. OS simply transfer control from one job to the next.

缺點:
1. 一次只能一個 job
2. 使用者和 jobs 之間沒有互動。
3. CPU 時常 idle。$\rightarrow$ 因為 I/O speed << CPU speed (at least 1:1000)
現代電腦的 I/O 速度也是小於 CPU 速度
### Multi-programming System
就是在系統中放多個 program,當一個 program 在做 I/O 時候,別的 program 就可以使用 CPU。
**目標:希望 Overlaps the I/O and computation of job,增加 CPU 使用率。**
藉由 **Spooling (Simultaneous Peripheral Operation On-Line)** 概念
* I/O is done with no CPU intervention
* CPU just needs to be <font color=red>notified</font> when I/O is done

Disk 和 CPU 中間有 Memory ,寫完程式後可能會有很多 program ,在早期 Memory 很有限時,哪些 programs 需要先放入到 Memory(Job Scheduling),也需要管理 Memory,是平分還是動態分配,接著從 Memory 到 CPU ,由於 CPU 更加有限,哪些 Jobs 需要先給 CPU(CPU scheduling) 又是一個 decision。

OS tasks: Memory management、CPU scheduling、I/O system。
### Time-sharing System (Multi-tasking System)
上一個系統仍然沒有 interative,而且仍然是一次一個 job 做完。
Time-sharing:一次執行多個 jobs,讓所有人一起執行,用時間觀念去切割大家使用的資源。
CPU 在 Jobs (執行時間: ms) 中切換如此頻繁以致於使用者透過 I/O devices 可以跟程式互動,也可能立即看見結果 (response time: < 1s)。
Switch job when
* finish
* waiting I/O
* a short period of time
OS tasks: Virtual memory、File system and disk management、Process synchronization and deadlock。
### Summary
| | Batch | Multi-programming | Time-sharing(Multi-tasking) |
| ------------ | --------------- | ----------------- | -------------------------------- |
| System model| single user/job | Multiple prog. | Multiple prog./users |
| Purpose | Simple | Resource utilization | Interactive、Reponse time、sharing|
| OS features | N.A. | CPU scheduling、Memory Mgt、I/O system| Multiple prog./users |
## Computer-system architecture
### Desktop Systems: Personal Computers
**Personal computers (PC)**:
個人獨有的電腦系統。
使用方便和很快回應 - GUI
I/O 裝置:滑鼠、鍵盤、螢幕、印表機。
不同作業系統: MacOS、Unix、Linux、Windows。
缺乏檔案和作業系統的保護
### **Parallel Systems**
a.k.a multiprocssor 或 **tightly** coupled system
* 超過一 CPU/core 在封閉的 communication(machine)
* 通常透過共用記憶體溝通。
Purposes: Throughput、Economical、Reliability。

#### **分類**
* Symmetric multiprocessor system (SMP)
* 每一 procssor 跑在同樣 OS 上
* 大部分熱門 multiple-processor 架構
* 需要額外 synchronization 來保護資料完整性(要 lock)
* Asymmetric multiprocessor system
* 每一 procssor 指派一個 specific task
* one master (管理) CPU & multiple (使用) slave CPUs
* 更常見於極大系統中
**Multi-Core Processor**:
* A CPU with multiple cores on the same die (chip)
* 在晶片上溝通快於晶片跟晶片間的溝通
* 比起多個單一核心的晶片使用明顯較少 power。

現在透過 hardware(CPU),讓它和管理 cache 上的機制以及 Memory 溝通,確保 overwrite 一個 cache 的 memory content 時,把資料至少反應到 memory 或者讓所有 cache 到同一 memory content 具有資料一致性。
**Many-Core Processor**(>100 cores):
Single instruction Multiple Data: 同時間 core 只能做一個 instruction ,應用到不同的 data。
e.g., 將作業系統全班成績開根號乘以10 (笑)
### **Memory Access Architecture**
* Uniform Memory Access (UMA):
* 今日最常見的代表 Symmetric Multiprocessor (SMP) machines
* Identical processors
* Equal access time (速度) to memory
* Example: most commodity computers

* Non-Uniform Memory Access (NUMA)
* 由實體連結至少兩個 SMPs 製造
* One SMP can directly access memory of another SMP
* Memory access across link is slower (local mem 比較快,remote mem 慢)
* Example: IBM Blade server

### **Distributed Systems**
a.k.a **loosely coupled system**
* 每個 processor 有自己的 local memory
* processors 和另外一個溝通透過多種 communication lines (I/O bus or network)
* 易於增加規模 (scale)
Purposes:
* Resource sharing
* Load sharing
* Reliability
#### **分類**
* Client-Server Distributed System
* 容易管理和控制資源
* 但是 server 可能成為瓶頸和單一失敗點 (如果只有一台server而且掛掉,東西就沒了QQ)
* Peer-to-Peer Distributed System
* 每個機器扮演相同的角色在分散式系統 - 去中心化
* Example: ppStream22, bitTorrent, Internet
**Clustered Systems**:
算是一種分散式系統
Def: Cluster computers **share storage** and are closely **linked via a local area network** (LAN) or a **faster interconnect**, such as InfiniBand (up to 300Gb/s).
### Summary

## Special-purpose Systems
### Real-Time Operating Systems
在 deadline 以前做完。
* Well-defined fixed-time constraints
* “Real-time” doesn’t mean speed, but keeping deadlines
* Guaranteed response and reaction time
* Real-time requirement:
* soft real-time requirements:
* 盡量達成的 deadline
* 重要的 real-time task 獲得高優先權直到完成
* Examples: multimedia streaming
* Hard real-time requirements:
* 一定要達到的 deadline,否則系統會 crash (a fundamental failure)
* Secondary storage limited or absent (讀取時間不好掌握)
* Examples: nuclear power plant controller
### Multimedia Systems
* A wide range of applications including audio and video files (e.g. ppstream, online TV )
* Issues:
* Timing constraints: 24~30 frames per second
* On-demand/live streaming: media file is only played but not stored
* Compression: due to the size and rate of multimedia systems
### Handheld/Embedded Systems
* Personal Digital Assistants (PDAs)
* Cellular telephones
* <font color=red>HW specialized OS</font>
* Issues:
* Limited memory
* Slow processors
* Battery consumption
* Small display screens
## Ref
[1] [上課影片 link](https://www.youtube.com/playlist?list=PLS0SUwlYe8czigQPzgJTH2rJtwm0LXvDX)
[2] [投影片 link](https://ocw.nthu.edu.tw/ocw/index.php?page=course_news_content&cid=141&id=999)