Introduction to Operating Systems

  • operating system作为software interface连接computer user and hardware

operating system的功能

  • memory management
  • processor management
  • device management
  • file management
  • network management
  • security
  • control over system performance
  • job accouting
  • error detecting aids
  • corrdination between other software and users

Instructions and Addressing Modes

  • 程序由CPU可以理解的sequence of instructions组成
  • 这些instructions从memory中取出并逐步运行

Basic Computer Operation Cycle

Type of instructions

  • Data Movement Instructions(数据传送指令):在register,memory and I/O device之间移动数据, 如MOV.PUSH,POP,IN,OUT等
  • Program Control Instructions(程序控制指令): 改变程序的执行顺序, 如JMP,JZ,JNZ,…,CALL,RET,INT,IRET等
  • Arithmetic and Logic Instructions(算术与逻辑指令): 执行计算或者位运算, 如ADD,INC,SUB,DEC,MUL,DIV,AND,NET
  • etc.

Instruction Cycle

  • 简单的Instruction Cycle过程如下:

  • 具体的一次完整的Instruction Cycle的过程如下:

  1. Fetch Instruction: PC → Multiplexer → Address Bus → Program segment → Data Bus → IR, 通过PC/IP地址从内存中取指并存入Instruction Register(IR)中
  2. Decode the instruction: IR → Control Unit, 拆分指令的结构并分析指令含义
  3. Locate the operands: 在Clock控制下Control Unit发出控制信号并根据addressing mode确认操作数位置
  4. Fetch the operands: Operand address → MAR/MUX → Address Bus → Data segment → Data Bus → Register File, 调取数据暂存到CPU的Register File中为运算作准备
  5. Execute the operation: Register File → ALU inputs → ALU, 两个operands被送到ALU进行运算操作的执行
  6. Store the result: ALU output Y → Register File, 将结果存入目的地(本例为register file中的AX), 如果 destination 是内存,则结果需要经过 Data Bus 写回 Data segment
  7. Fetch the next instruction: 重新开始流程