operating system os

OS Processors

« Previous Tutorial Next Tutorial »

As you know that the Central Processing Unit (CPU) is the brain of computer.

The work of CPU is that it fetches the instruction from memory and executes them.

The basic cycle of every Central Processing Unit is to fetch the first instruction from the memory, decode it to specify its type and operands, then execute it, and then fetch, decode and execute the subsequent instructions. Every programs are carried out in this way through Central Processing Unit.

Each and every Central Processing Unit has a specific set of instructions that can executed by it.

Therefore, a Pentium can't execute a SPARC program and vice-versa. It is just because accessing memory to get an instruction takes much longer than executing an instruction, all the Central Processing Units contain some registers inside to hold key variables and temporary results.

In addition to the general registers, here are some special registers, most computers have. These registers are visible to the programmers.

Register Description
Program Counter Contains the memory address of the next instruction to be fetched. When that instruction has been fetched, the program counter is updated to point to its successor.
Stack Pointer Points to the top of the current stack in the memory. The stack contains one frame for each procedure that has been entered but not yet exited.
Stack frame of a procedure holds those input parameters, local variables, and temporary variables that are not kept in the registers.
Program Status Word (PSW) Contains the condition code bits, set by comparison instructions, the Central Processing Unit priority, the mode (user or kernel) and various other control bits.

Note - The Program Status Word (PSW) plays an important role in system calls and Input/Output.

Every Operating system (OS) must be aware of all the registers. When time multiplexing the Central Processing Unit, then the Operating system (OS) will sometime stop the running program to start/restart another one. Therefore, an operating system must save all the registers whenever every times it stops a running program. So they can be restored when that program runs later.

To obtain any services from the OS (operating system), then a user program must make a system call, that traps into the kernel and invokes the OS.

« Previous Tutorial Next Tutorial »


Quick Links
Signup - Login - Give Online Test