You are on page 1of 14

What is a computer?

A computer is a programmable electronic device that accepts raw data as input and
processes it with a set of instructions (a program) to produce the result as output.
The basic parts without which a computer cannot work are as follows:
o Processor: It executes instructions from software and hardware.
o Memory: It is the primary memory for data transfer between the CPU and
storage.
o Motherboard: It is the part that connects all other parts or components of a
computer.
o Storage Device: It permanently stores the data, e.g., hard drive.
o Input Device: It allows you to communicate with the computer or to input data,
e.g., a keyboard.
o Output Device: It enables you to see the output, e.g., monitor.
CPU, ALU, CU, and Registers:

Von Neumann Architecture

• Von Neumann Architecture showed how a computer executes instructions and


stores instructions and data in its memory.
• A scientist called Von Neumann suggested that a computer system should be
split into two parts: a processor module and a memory module.

• The processor module is a place where instructions are executed. It is


represented as Central Processing Unit which includes Control Unit and
Arithmetic/Logic Unit in the diagram.

Central Processing Unit (CPU)


▪ Control Unit
▪ Arithmetic/Logic Unit
▪ Register
▪ CPU acts like the “brain” of a computer system. It contains the circuitry to
interpret and execute program instructions.

Control Unit (CU)


▪ CU acts like a manager in a computer.
▪ CU receives orders from RAM in the form of instruction and decode
(break) that instruction down into specific commands for other
components inside computer system.
▪ It directs the data flow and the operation of the ALU.

Arithmetic/Logic Unit (ALU)


▪ ALU does all mathematical operations (arithmetic) (+/-/compare) and logical
(AND/OR) calculations.
▪ Some computers have two ALUs to process two calculations simultaneously.
That is called dual core technology.
▪ ALUs contain several special storage units called registers.

Register
▪ Register is a small, very fast storage area inside CPU.
▪ It is used to store intermediate values from calculations or instructions that
is needed again immediately.
▪ For instance, when a ALU is commanded to calculate A*(B+C), ALU
needs to calculate B+C first, then ALU need to store the result for a
moment and use the result to multiply A.
▪ It is faster for ALU to access register than store the data in memory units.
There are four types of Register:
▪ MAR (memory address register): store memory that currently be
accessed inside RAM
▪ MDR/MBR (memory data/buffer register): store data from memory
▪ Accumulator (A register): a register store immediate result from
ALU
▪ Program Counter (PC): store the address of the next instruction.
Instruction Register (IR)
In computing, an instruction register (IR) is the part of a CPU’s control
unit that holds the instruction currently being executed or decoded.
▪ An instruction register is the part of a CPU’s control unit that holds the
instruction currently being executed or decoded.
General Purpose Register:
General-purpose registers are used to store temporary data within the
microprocessor. It is a multipurpose register. They can be used either by a
programmer or by a user.

Input Unit
Data and programs from the outside world enter into a computer system through
an input unit.
Output Unit
Output unit is a device that prints or displays data that stored in memory or
makes a permanent copy of information which previously stored in memory.

Buses
▪ System bus transfers information between different parts inside computer
system.
▪ Control bus has two wires, set and enable. When CPU wants to read from
RAM, the enable wire will be opened; when CPU wants
to save information on RAM, CPU will enable the set wire.
▪ Data bus is a two-way bus carry data commute between CPU and RAM.
▪ Address bus is a one-way bus carry addresses from CPU to RAM.

One Bus organization:

▪ In one bus organization, a single bus is used for multiple purposes.


▪ A set of general-purpose registers, program counters, instruction registers,
memory address registers (MAR), memory data registers (MDR) are
connected with the single bus.
▪ Memory read/write can be done with MAR and MDR.
▪ The program counterpoints to the memory location from where the next
instruction is to be fetched.
▪ Instruction register is that very register will hold the copy of the current
instruction.
▪ In the case of one bus organization, at a time only one operand can be read
from the bus. As a result, if the requirement is to read two operands for the
operation, then the read operation needs to be carried twice. So that’s why
it is making the process a little longer.
▪ One of the advantages of one bus organization is that it is one of the simplest
and also this is very cheap to implement.
▪ At the same time a disadvantage lies that it has only one bus and this “one
bus” is accessed by all general-purpose registers, program counter,
instruction register, MAR, MDR making each and every operation
sequential. No one recommends this architecture nowadays.
Two Bus organizations:

▪ To overcome the disadvantage of one bus organization another architecture


was developed known as two bus organization.

▪ In two bus organizations, there are two buses. The general-purpose register
can read/write from both the buses.

▪ In this case, two operands can be fetched at the same time because of the
two buses. One bus fetch operand for ALU and another bus fetch for
register.

▪ The situation arises when both buses are busy fetching operands, the output
can be stored in a temporary register and when the buses are free, the
particular output can be dumped on the buses.

▪ There are two versions of two bus organizations, i.e., in-bus and out-bus.
From in-bus, the general-purpose register can read data and to the out bus,
the general-purpose registers can write data. Here buses get dedicated.
Three Bus organization:
▪ In three bus organizations we have three buses, OUT bus1, OUT bus2, and an IN
bus.
▪ From the out buses, we can get the operand which can come from the general-
purpose register and evaluated in ALU and the output is dropped on In Bus so it
can be sent to respective registers.
▪ This implementation is a bit complex but faster in nature because in parallel two
operands can flow into ALU and out of ALU.
▪ It was developed to overcome the “busy waiting” problem of two bus
organizations.
▪ In this structure after execution, the output can be dropped on the bus without
waiting because of the presence of an extra bus. The structure is given below in
the figure.
The main advantages of multiple bus organizations over the single bus are as
given below.

1. Increase in size of the registers.

2. Reduction in the number of cycles for execution.

3. Increases the speed of execution or we can say faster execution


How a CPU works?
Process
1. CU turn on enable wire of Instruction Address Register(Program Counter) to
allow the next Instruction address to flows to RAM.
2. Instruction address first goes to Memory Address Register which only tells RAM
what address the CPU wants next. CU turns on the set wire of MAR, then
memory address goes to RAM. CU turns on the enable RAM wire.
3. Then data goes to Memory Data Register(buffer) from RAM via data bus. Then
data (instruction) goes to Instruction Register.
4. CU turns on the set Instruction Register (store instruction) wire. Instruction goes
to CU. CU decodes instruction, tells ALU the type of operation ALU need to
perform and stores the input in Temporary registers by turning on the set wire.
5. ALU operates the instruction. CU turns on the set wire of Accumulator and
instructs ALU to store the immediate result in Accumulator (A Register). CU
turns on the enable wire of Accumulator to instruct Accumulator to output the
result to the system bus.
6. CU send address to MAR again and points out an address in RAM.
7. The result stored temporarily in A Register will go to the RAM via data bus.
8. Data will be stored in the specified address in RAM.
9. CPU is ready for the next instruction. Repeat steps 1-6.

What is Memory?

Computer memory is just like the human brain. It is used to store data/information
and instructions.
In general, memory is of three types:
• Primary memory
• Secondary memory
• Cache memory
1. Primary Memory:
▪ It is also known as the main memory of the computer system.
▪ It is used to store data and programs or instructions during computer
operations.
Characteristics of Main Memory:
▪ It is faster computer memory as compare to secondary memory.
▪ It is semiconductor memories.
▪ It is usually a volatile memory.
▪ It is the main memory of the computer.
▪ A computer system cannot run without primary memory.
▪ It uses semiconductor technology and hence is commonly called
semiconductor memory.
▪ Primary memory is of two types:

(i) RAM (Random Access Memory):


▪ It is a volatile memory.
▪ Volatile memory stores information based on the power supply.
If the power supply fails/ interrupted/stopped, all the data &
information on this memory will be lost.
▪ RAM is used for booting up or start the computer.
▪ It temporarily stores programs/ data which has to be executed by
the processor. RAM is of two types:
• S RAM (Static RAM):
• It uses transistors and the circuits of this memory are capable of retaining
their state as long as the power is applied.
• This memory consists of the number of flip flops with each flip flop storing
1 bit. It has less access time and hence, it is faster.

• D RAM (Dynamic RAM): It uses capacitors and transistors and stores the
data as a charge on the capacitors.

• They contain thousands of memory cells. It needs refreshing of charge


on capacitor after a few milliseconds.

• This memory is slower than S RAM.

(ii) ROM (Read Only Memory): It is a non-volatile memory. Non-volatile


memory stores information even when there is a power supply failed/
interrupted/stopped.
▪ As its name refers to read-only memory, we can only read the programs
and data that is stored on it.
The information stored in the ROM in binary format. It is also known as

permanent memory.
2. Secondary Memory:
▪ It is also known as auxiliary memory and backup memory.
▪ It is a non-volatile memory and used to store a large amount of data or
information.
▪ The data or information stored in secondary memory is permanent,
and it is slower than primary memory.
▪ A CPU cannot access secondary memory directly.
▪ The data/information from the auxiliary memory is first transferred to
the main memory, and then the CPU can access it.
Characteristics of Secondary Memory:
• It is a slow memory but reusable.
• It is a reliable and non-volatile memory.
• It is cheaper than primary memory.
• The storage capacity of secondary memory is large.
• A computer system can run without secondary memory.
• In secondary memory, data is stored permanently even when the power is off.
Types of secondary memory:
Magnetic Tapes: Magnetic Disks: Optical Disks: CD – ROM, DVDs etc.
Cache Memory:
It is a type of high-speed semiconductor memory that can help the CPU run faster
between the CPU and the main memory, it serves as a buffer.
It is used to store the data and programs that the CPU uses the most frequently.
Advantages of cache memory:
• It is faster than the main memory.
• When compared to the main memory, it takes less time to access it.
• It keeps the programs that can be run in a short amount of time.
• It stores data in temporary use.
Disadvantages of cache memory:
• Because of the semiconductors used, it is very expensive.
• The size of the cache (amount of data it can store) is usually small.
How Computer Memory Is Measured
Bit: All computers work on a binary numbering system, i.e. they
process data in one's or zero's. These 1 or 0 levels of storage is
called a bit.
Byte: A byte consists of eight bits.
Kilobyte: A kilobyte (KB) consists of 1024 bytes.
Megabyte: A megabyte (MB) consists of 1024 kilobytes.
Gigabyte: A gigabyte (GB) consists of 1024 megabytes.
Tera, peta, exa, yotta.
What is an Operating System?
▪ An Operating System (OS) is a software that acts as an interface between
computer hardware components and the user. Every computer system must have
at least one operating system to run other programs.
▪ An operating system is concerned with the allocation of resources and
services, such as memory, processors, devices, and information.
Features of Operating system – Operating system has the following features:

1. Convenience: An OS makes a computer more convenient to use.


2. Efficiency: An OS allows the computer system resources to be used
efficiently.
3. Ability to Evolve: An OS should be constructed in such a way as to
permit the effective development, testing, and introduction of new system
functions at the same time without interfering with service.
4. Throughput: An OS should be constructed so that It can give
maximum throughput (Number of tasks per unit time).

Major Functionalities of Operating System:


• Resource Management:
• Process Management:
• Memory Management:
• Security/Privacy Management:

▪ A computer understands instructions in machine code, i.e. in the form of 0s and


1s.
▪ It is a tedious task to write a computer program directly in machine code.
▪ The programs are written mostly in high-level languages like Java, C++, Python
etc. and are called source code.
▪ These source code cannot be executed directly by the computer and must be
converted into machine language to be executed.
▪ Hence, a special translator system software is used to translate the program
written in a high-level language into machine code is called Language Processor
and the program after translated into machine code (object program/object code).

1. Compiler:

The language processor that reads the complete source program written in high-level
language as a whole in one go and translates it into an equivalent program in machine
language is called a Compiler. Example: C, C++, C#, Java.
▪ In a compiler, the source code is translated to object code successfully if it is free
of errors.
▪ The compiler specifies the errors at the end of the compilation with line numbers
when there are any errors in the source code.
▪ The errors must be removed before the compiler can successfully recompile the
source code again.
2. Assembler:
▪ The Assembler is used to translate the program written in Assembly language into
machine code.
▪ The source program is an input of an assembler that contains assembly language
instructions.
▪ The output generated by the assembler is the object code or machine code
understandable by the computer.
▪ Code written in assembly language is some sort of mnemonics(instructions) like ADD,
MUL, MUX, SUB, DIV, MOV and so on. and the assembler is basically able to
convert these mnemonics in Binary code. Here, these mnemonics also depend upon
the architecture of the machine.

3. Interpreter:
• The translation of a single statement of the source program into machine code is
done by a language processor and executes immediately before moving on to the
next line is called an interpreter.
• If there is an error in the statement, the interpreter terminates its translating
process at that statement and displays an error message.
• The interpreter moves on to the next line for execution only after the removal of
the error.
• An Interpreter directly executes instructions written in a programming or scripting
language without previously converting them to an object code or machine code.
• Example: Perl, Python and Matlab.

You might also like