檔案處理資訊 File manager需知道有關 file 的 location 和 structure才能將
logical requesst 轉換成 physical I/O request。
Catalog: 對應檔案名稱與其所儲存的實體位址。File Information Table:儲存更多的
檔案資訊。
例如财 File organization财 Record length财 File format财 Indexing technique…
…等等。
開啟檔案的過程:1. 尋找 catalog 2.載入 file information table 3.建立可讀寫之檔
案緩衝區(Buffer)
關閉檔案:當檔案操作完畢時,將緩衝區與其他指標刪除釋放。
FCFS Scheduling最簡單,最容易設計 Process以先進先出方式依序排隊在一個ready
queue中 等候被”挑選”。 一旦被選上則一直佔用CPU直到完成FCFS是 non-preemptive
方式 FCFS初看是fair,細看是 unfair,long jobs make short jobs wait,
unimportant jobs make important jobs wait不能保證好的 response time,不適用於
interactive system 中
RR SchedulingRR (Round Robin)又稱「知更鳥式排序」 基本上為FCFS,但每一個
process 每次只給一個定額時 間稱為 time quantum 或 time-slice。若在這
time-slice 內尚未完成則 CPU 被 preempt給下一 個 process RR 常用於
time-sharing 系統中,對 interactive users能保證一個合理的 response time RR 是
preemptive 方式 若 main memory 更大可同時容納數個 processes,則可 減少
swapping 次數。
SJF SchedulingSJF (Shortest Job First) 是在所有的 waiting process 中 挑選需要
最少時間來完成的工作去做比起 FCFS 可減少平均等候時間SJF 青睞於 short jobs,
unfair to larger jobs SJF 最大問題: 如何預知一個 jobs 或 process 究竟要執行 多
久SJF 與 FCFS 一樣是 non-preemptive, 不適用於 time sharing system
Mutual Exclusion 問題
Race condition 就是一種互斥現象,對於兩個 process的執行順序是非常重要的,不同
執行順序產生不同之結果 Race condition 發生於 sharing data 或 sharing
resources E.g., 兩個 processes sharing printer
解決方法: 視為 dedicated device,採用 request 與 release (semaphore) 視為
virtual device ,採用 SPOOLing
“SHVAR” 是一個 shared variable,兩個 processes 各有 一套 copy 最初
SHVAR=100,process 1 先執行 LDA與ADD,時間 已到,在 accumulator 中留下 101 ,
Process 2 執行 LDA, ADD, STA 時,SHVAR=101, Process 1 再執行 STA 則
SHVAR=101,事實上應是 102 此種現象稱為 mutual exclusion
--
│ ███ ▂▄▃ ││││
│ ˋ ◤Mooncat~◥││││ 「為什麼...34m│ ‵ ◤ ◥▏*_▂▁ ▋ │││ 為什麼正妹旁邊都不是我...
│ ′ 、▌█ ▊▉▏ │ 沒天理啊...」
◢ ◤◢ ◣▋◢ █ ▋▊ ▕▅▇ ◥◥*Mooncat~
真相? http://www.wretch.cc/blog/lightpink1
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.137.20.1
※ 編輯: u9555kimo 來自: 140.137.20.1 (06/04 17:02)