Thursday, March 29, 2012

Operating Systems Day 02

The CPU (Central Processing Unit) executes instructions. The instructions operate on data that are stored in registers.

Instructions and data are both fetched from storage.

The CPU executes instructions that are also represented in binary form; and these instructions are fetched from storage just like data.

MAR: Memory Address Register: stores the address of the fetch

MDR: Memory Data Register (a.k.a. Memory Buffer Register MBR): stores the data of the fetch

CPU registers are storage locations in the system that the processor CPU uses to do its calculations and manage the system.

PC: Program Counter, stores the address of the next instruction

Instruction Decoder: interprets the instruction

A computer program is a series of instructions, (usually) stored in memory. When running a program, the processor starts at the beginning of the program, executing instructions using a process known as the instruction cycle:

Fetch: the next instruction to run is fetched from memory (i.e. the CPU fetches instructions from memory according to the value of the PC). In this Fetch cycle, the address of the next instruction will be loaded to PC. Then the content of the PC will be loaded to MAR. Instruction and data in the memory required will be loaded to MDR. The MAR content will be loaded to CIR (Current Instruction Register).  The contents of the CIR will be sent to Instruction Decoder (i.e. Control Unit will look in the Instruction Set to see what needs to be done to execute a "LOAD" statement, for example) to be decoded. Next, PC will be updated with the address of the next instruction in memory.

Decode: the instruction information is decoded and may cause operands (data) to be fetched from memory. In this Decode cycle, if operands (data) need to be fetched from memory, the MAR will be updated so that the correct address of the operands (data) in memory can be retrieved.

Execute: the instruction is run and results may be stored back in memory.

References
McHoes, A., & Flynn, I.M. (2008). Understanding operating systems (5th ed.). CENGAGE Learning.
Fernandez, G., BN103/BN103D Platform Technologies Lecture Notes, Melbourne Institute of Technology, 2012.

No comments:

Post a Comment

Mounting USB drives in Windows Subsystem for Linux

Windows Subsystem for Linux can use (mount): SD card USB drives CD drives (CDFS) Network drives UNC paths Local storage / drives Drives form...