【文章內(nèi)容簡介】
輸 入 、 處 理 數(shù) 據(jù) 、 提 供 輸 出Operating System CITS, NanKai University 29 Role of OS in puter system 使 用 者臺 式 PC筆 記 本 電 腦大 型 機(jī)手 持 式 計(jì) 算 機(jī)計(jì)算機(jī)硬件設(shè)備 ?如何使用? 應(yīng)用軟件操作系統(tǒng)系 統(tǒng) 服 務(wù)系 統(tǒng) 調(diào) 用底層硬件控制 用戶輸入 處理結(jié)果 Operating System CITS, NanKai University 30 What happens behind “Hello World” include int main(int argc, char *argv[]) { puts(hello world)。 return 0。 } Operating System CITS, NanKai University 31 Processing steps of OS ? HumanComputer Interaction ? Input the content of the program (keyboard) ? Command IDE to pile the program (mouse) ? Output the exe file to disk (file system) ? Question 1: How can puter know your input? ? Question 2: How can IDE pile and generate exe files? ? Exe file loading ? Create a thread to run the program (Thread) ? Load the Exe file from disk to memory (Memory) ? Schedule the thread to occupy CPU time (Thread) ? Question 3: How to allocate memory for a thread? ? Question 4: How to schedule the thread? ? Program running ? Load instruction from memory to CPU register (Thread) ? Execute the first instruction of the program ? Question 5: The mechanism of instruction execution Operating System CITS, NanKai University 32 Processing steps of OS (cont.) ? Interaction between Graphic card and CPU ? Load graphic card driver (I/O device) ? Set the content to be displayed (BUS amp。 DMA) ? Question 6: The working mode of driver and BUSamp。DMA ? Print the string on monitor ? Convert the string to be pixelmatrix (I/O device) ? Start printing…. ? Question 7:The working mode of monitor ? Exiting steps ? Block the graphic driver thread, it will wait for next calling ? Release all resource allocated for “hello world” program ? Load next thread, or sleep until next mand reached…. ? Overview of this example ? All modules of OS kernel are activated ? OS is the basement for almost all programs Operating System CITS, NanKai University 33 Basic concepts ? System ? A philosophy word derived from ancient Greece ? Organism consisted of interactive ponents ? Structure ? A word used in building industry, means “construction” ? The schema of relationship between ponents in a System ? Operating ? Functions: How many things it can do ? Performance: speed, efficiency, stability, security etc. ? The meaning of “Operating System” ? A system with many ponents. ? Different application purposes lead to different structures ? The function and performance of OS is very important Operating System CITS, NanKai University 34 Functions of OS ? Hardware abstraction ? Provide unified, friendly UI for users ? Hide the configuration difference of hardware ponents ? Application integration ? Provide simple and useful methods for programs designing ? Schedule and control the running of programs ? Environment management ? Monitor whole environment of puter ? Provide a secure, stable and fortable space for uses OS Hardware Operating System CITS, NanKai University 35 Architecture of OS OS Basic concept CPU management Device management Memory management File system Programming interface Operating System CITS, NanKai University 36 Architecture of Win 2k/XP Operating System CITS, NanKai University 37 Architecture of Minix 磁盤 任務(wù) 終端 任務(wù) 時(shí)鐘 任務(wù) 系統(tǒng) 任務(wù) 以太網(wǎng) 任務(wù) …… 內(nèi)存 管理器 文件 系統(tǒng) 網(wǎng)絡(luò) 服務(wù)器 …… Init 進(jìn)程 用戶 進(jìn)程 用戶 進(jìn)程 用戶 進(jìn)程 用戶 進(jìn)程 …… Level 1 Level 2 Level 3 Level 4 I/O Task Service User space Kernel 進(jìn)程管理 Operating System CITS, NanKai University 38 Topics of OS ? Introduction and prerequisites knowledge (4~6 lessons) ? Opinion of OS: resource manage VS extended machine ? Concept: batch system/cocurrency/realsystem ? Knowledge about interruption, CPU, clock, DMA, storage system, bus, motherboard…. ? CPU management (8~10 lessons) ? Concept: process/thread, CPU instruction ? Process/thread scheduling ? Interprocess munication ? Memory management (8~10 lessons) ? Concept: swapping, virtual memory, paging, segmentation ? Memory allocation, relocation, protection and sharing ? Multiprogramming, running image of thread ? Device management (6~8 lessons) ? Concept: DMA, I/O channel, I/O software ? Working mechanism of different kinds of I/O devices ? Dead lock and relat