# 作業系統筆記(台科資管 賴教授) * **After I/O starts, control returns to user** program without waiting for I/O completion * **System call** – request to the OS to allow user to wait for I/O completion * **Device-status table** contains entry for each I/O device indicating its type, address, and state * OS indexes into I/O device table to determine device status and to modify table entry to include interrupt * Only one interrupt is generated per block, rather than the one interrupt per byte * Caching – copying information into faster storage system; main memory can be viewed as a cache for secondary storage * **Multiprocessors systems** growing in use and importance Also known as **parallel systems**, **tightly-coupled systems(vs. loosely-coupled 透過網路的分散式運算系統)** Advantages include: * Increased throughput * Economy of scale(規模效益) * Increased reliability – graceful degradation(?降解) or fault tolerance * Two types: * Asymmetric Multiprocessing(不對稱,有一個manager cpu,通常是超級電腦) * Symmetric Multiprocessing(無manager cpu) * 多核心 * **UMA** and **NUMA** architecture variations * Clustered Systems * Like multiprocessor systems, but multiple systems working together * **Asymmetric(非對稱) clustering** has one machine in hot-standby mode, **one monitoring others** * Symmetric clustering has multiple nodes running applications, monitoring each other ![](https://i.imgur.com/FgtKorc.png) * Operating System Structure * Multiprogramming * many user * One job selected and run via job scheduling * When it has to wait (for I/O for example), OS switches to another job * Timesharing(multitasking) : CPU switches jobs so frequently * 在memory裡面的是process * If several jobs ready to run at the same time => CPU scheduling * Interrupt driven by hardware * Software error or request creates exception or trap * Division by zero, request for operating system service * Process Management * Single-threaded process has one program counter specifying location of next instruction to execute * Multi-threaded process has one program counter per thread * 多作業系統 * Emulation * When computer language not compiled to native code – **Interpretation** * Virtualization-vertual machine manager(**VMM**) * ![](https://i.imgur.com/ISz6CMR.png) # CH2 * Parameters stored in a block, or table, in memory, and address of block passed as a parameter in a register * This approach taken by Linux and Solaris # CH3 ## Communications in Client-Server Systems * Socket * Connection-oriented (TCP) * Connectionless (UDP) * MulticastSocket class– data can be sent to multiple recipients Consider this “Date” server: ![](https://i.imgur.com/8SWHZIi.png) * Remote Procedure Calls(RPC) * **Stubs**(存根、樹根、票根、菸蒂根) – client-side proxy for the actual procedure on the server * On Windows, stub code compile from specification written in **Microsoft Interface Definition Language (MIDL)** * Data representation handled via **External Data Representation (XDL)** format to account for different architectures * Big-endian大字序(從高位元組開始放) ![](https://i.imgur.com/aHp61c2.png) * little-endian小字序(從低位元組開始放) ![](https://i.imgur.com/cieyNTx.png) # CH4 * user thread * explicit(要在程式裡面自己new thread) * implicit(不用自己new thread,compilers and run-time libraries幫你做到)