讀書筆記:Modern Operation System by Tanechum 01

Chapter 1

這裏寫圖片描述

Personal computers exist not because millions of people have a centuries-old pent-up desire to own a computer, but because it is now possible to manufacture them cheaply. We often forget how much technology affects our view of systems and it is worth reflecting on this point from time to time.

That’s very cool insight.

這裏寫圖片描述

瞭解當下被視爲“過時(obsolete)”的想法並不是無用的,儘管在生物學中,過時的東西就會滅絕,但技術可以讓過時的概念又重獲新生。

這裏寫圖片描述
The principal metric prefixes.

Summary

OS的角色

  • resource manager : 管理系統的各個部分,關鍵點:Multiplexing
    • Time Multiplexing : 決定誰來使用,使用多久
    • Space Multiplexing : 分配資源,比如分配內存使得多個程序並存
  • extended machine : 爲用戶提供抽象層次, 使得底層硬件(actual machine)使用起來更方便。
    • Abstraction:隱藏底層的複雜細節。(Managing complexity)

OS的基本概念

  • 進程
    • a program in execution
    • associateed with address space & a set of resources
    • a container that holds all the info needed to run a program
    • process table : 進程信息儲存的表
    • alarm signal : OS發給進程的信號,讓進程暫時停止工作,處理這個信號。
      • signal : the software analog of hardware interrupt
      • Address Space : the set of addresses a process can use
  • 內存管理
  • I/O管理
  • 文件系統
  • 安全

OS的本質

一個OS的功能的是由它所能使用的System Call決定的。
調用sys call的方式通常是與所使用的機器緊密相關的,而且通常要用彙編語言;
Procedure library的作用:讓高級語言(C)能夠調用sys call。
system call類似於調用函數,只不過system call有進入內核的特權。
調用System Call的過程:
1. 將參數壓入到棧中
2. 實際地調用library procedure (彙編語言寫就)
3. li.pro 將S.C.的號碼放在與OS約定好的位置。
4. 執行一個TRAP指令切換到內核模式,內核代碼根據SC的編號調用handler執行S.C.
5. 控制返回到li.pro.,再返回給User program
6. 清空棧

OS的分類

  • monolithic (DOS)
  • layered system
  • microkernel
  • client-server
  • virtual machine
  • exokernel

OS緊密聯繫的:計算機組成


  • 處理器
    • 各類register: stack pointer, PC, PSW…
    • CPU結構:pipeline, superscalar CPU
    • 模式
    • 超高速切換線程的hyperthreading CPU
  • I/O
    • 組成:controller(chip, physically ctrl) & device
      • controller : 提供更簡單的接口讓OS使用,自帶寄存器(I/O port space)
    • device driver : 用來和controller交互的軟件。在內核模式運行。
    • 操作:
    • busy waiting : CPU需要不斷檢查device是否完成了任務
    • interrupt : driver命令device完成任務時由controller發出一個信號。 CPU接受中斷請求就會轉入內核模式,根據device的編號在interrupt vector中尋找對應的handler處理,完畢就返回到user program。
    • DMA : CPU給DMA chip發任務,DMA chip做完了就產生interrupt
  • Booting the computer
    • BIOS 一個包含底層I/O軟件的程序。
    • 工作原理:

1.check RAM and basic devices
2.determine the boot device (floppy, CD-ROM or disk)
3.read the first sector into memory and exec.
4.read the second sector, which contains a loader
5.the loader reads in OS and start it.
6.OS check device drivers for each device
7.OS initialize table, start program or GUI

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章