0% found this document useful (0 votes)
4 views13 pages

Programing Notes Print

The document provides an overview of computers, defining them as electronic devices that process data through programs. It categorizes different types of computers, including personal computers, mobile devices, servers, supercomputers, single board computers, and microcontrollers, each serving specific purposes. Additionally, it explains the von Neumann architecture, the fetch-decode-execute cycle, and the role of operating systems in managing computer resources.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views13 pages

Programing Notes Print

The document provides an overview of computers, defining them as electronic devices that process data through programs. It categorizes different types of computers, including personal computers, mobile devices, servers, supercomputers, single board computers, and microcontrollers, each serving specific purposes. Additionally, it explains the von Neumann architecture, the fetch-decode-execute cycle, and the role of operating systems in managing computer resources.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

PROGRAMING NOTES

What is a Computer?
A computer is an electronic device that processes data and
performs tasks according to a set of instructions called a program.

A computer performs a ‘task’ by executing a sequence of instructions, called a


‘program’.

Types of Computers?
Computers come in various forms, each tailored for specific purposes and
environments.
Understanding these types is crucial for selecting the right tool for specific tasks. The
most common types of computers are:

▸ Personal Computers (PC)

A personal computer (PC) is a general-purpose computing device designed for


individual use. Personal computers are intended to be operated directly by an end-user,
rather than by a computer expert or technician. They are versatile, capable of running
various types of applications, and come in different forms such as desktops, laptops,
and tablets. (Desktop, Laptop)

▸ Mobile Devices

Mobile devices are portable electronic devices designed for mobile computing and
communication. Tablets and smartphones are the most common types of mobile
devices, characterised by their compact size, touchscreens, and ability to connect to
the internet wirelessly. (Smartphone Laptop)

▸ Servers

Servers are powerful computers designed to provide services, resources, and data to
other computers (clients) over a network. They play a crucial role in supporting the
infrastructure of organisations, websites, and various online services. Examples of
servers are Web Servers, File Servers, Database Servers, Mail Servers, etc.
▸ Supercomputers

A supercomputer is an exceptionally powerful computer designed to perform complex


calculations at extremely high speeds. It is used for tasks that require immense
computational power, such as scientific simulations, weather forecasting, and
cryptography.

▸ Single Board Computers (SBC)


A single-board computer (SBC) is a complete computer built on a single circuit board. It
integrates all the essential components necessary for a functional computer system,
including the processor (CPU), memory (RAM), storage (typically via SD card or eMMC),
and various input/output (I/O) interfaces. Unlike traditional computers that often
consist of separate components (like motherboard, CPU, RAM modules, etc.), an SBC
condenses these components into a compact form factor, making it highly portable and
versatile for a wide range of applications. (Raspberry PI)

▸ Microcontrollers

A microcontroller is a compact integrated circuit designed to govern a specific


operation in an embedded system. A typical microcontroller includes a processor,
memory, and input/output (I/O) peripherals on a single chip. These devices are used in
automatically controlled products and devices, such as automobile engine control
systems, implantable medical devices, remote controls, office machines, appliances,
power tools, toys, and other embedded systems. (PIC Microcontroller, Arduino
Microcontroller)

What is Computing?
Computing is the process of inferring data from data. What is going to be inferred is
defined as the task. The original data is called the input (data) and the inferred one is the
output (data).

These examples suggest that computing can involve different types of data, either
as input or output: Numbers, images, sets, or sentences. Although this variety
might appear intimidating at first, we will see that, by using some ‘solution building
blocks’, we can do computations and solve various problems with such a wide
spectrum of data.

▸ Input: Data or instructions are entered into the computer using devices like
keyboards, mice, or sensors.
▸ Process: The computer's CPU processes this data according to instructions from
software.
▸ Output: The processed data is displayed on a monitor, printed, or sent to another
device.

Example 1: Multiplying two number and Subtracting 1

Example 2: Recognising the faces in a digital picture

Example 3: Recognising the faces in a digital picture


UNDERSTANDING VON NEUMANN ARCHITECTURE
The von Neumann architecture defines the basic structure, or outline, used in most
computers today. Proposed in 1945 by von Neumann, it consists of two distinct units:
An addressable memory and a Central Processing Unit (CPU). All the encoded actions
and data are stored together in the memory unit. The CPU, querying these actions, the
so-called instructions, executes them one by one, sequentially (though, certain
instructions may alter the course of execution order).

How a computer represents data


A computer is based on binary (0/1) representations such that all inputs are converted
to 0s and 1s and all outputs are converted from 0/1 representations to a desired form,
mostly a human-readable one. The processing takes places on 0s and 1s, where 0 has
the meaning of “no electric potential” (no voltage, no signal) and 1 has the meaning of
’some fixed electric potential (usually 5 Volts, a signal).

Components of the von Neumann Architecture

1. MEMORY

Memory stores both data and instructions. This allows the computer to read and write
data and instructions from a single memory space. Typically organized in a linear
address space. Each byte of the memory has a unique address. When the address input
(also called address bus) of the memory is provided a binary number, the memory byte
that has this number as the address becomes accessible through the data output
(output data bus).
Based on W/R wire being set to Write (1) or Read (0), the action that is carried out on the
memory byte differs:
▸ R/W wire is set to WRITE (1) :The binary content on the input data bus is copied into
the 8-bit location whose address is provided on the address bus, the former content is
overwritten.
▸ R/W wire is set to READ (0) : The data bus is set to a copy of the content of 8-bit
location whose address is provided on the address bus. The content of the accessed
byte is left intact.

2. CPU
The CPU often referred to as the "brain" of the computer, is the primary component responsible
for interpreting and executing instructions. It performs the fundamental operations necessary for
the computer to function and process data.
Main Components of a CPU
▸ Control Unit (CU), is responsible for fetching instructions from the memory, interpreting
(decoding) them and executing them. After executing an instruction finishes, the control unit
continues with the next instruction in the memory. This is known as fetch-decode-execute
cycle.
▸ Arithmetic Logic Unit (ALU), is responsible for performing arithmetic (addition,
subtraction, multiplication, division) and logic (less-than, greater-than equal-to etc.)
operations. CU provides the necessary data to ALU and the type of operation that needs to
be performed, and ALU executes the operation.
▸ Registers, which are mainly storage units on the CPU for storing the instruction being
executed, the affected data, the outputs and temporary values.
Registers
▸ The size and the quantity of the registers differ from CPU model to model.
▸ They generally have size in the range of 2-64 bytes and most registers on today’s
most popular CPUs have size 64 bits (i.e. 8 bytes).
▸ Their quantity is not high and in the range of 10-20.
▸ The registers can be broadly categorized into two: Special Purpose Registers and
General Purpose Registers.
▸ Two special purpose registers are worth mentioning to understand how a CPU’s
Fetch-Decode-Execute cycle runs. The first is the Program Counter (PC) and the second
is the Instruction Register (IR).

Peripherals
These are external devices that connect to and interact with a computer system to
provide additional functionality. They are not part of the core computer architecture
(CPU & memory) but extend the system’s capabilities by enabling input, output,
storage, and communication with other devices

The Fetch-Decode-Execute Cycle


The Fetch-Decode-Execute cycle is the fundamental operational process of a CPU that
allows it to execute instructions in a systematic manner. It operates like a state
machine, where the CPU transitions through a series of distinct states, each
representing a different phase of the cycle. This cycle is repeated continuously from the
moment the computer is powered on until it is shut down.

The Fetch Phase

Objective: Retrieve an instruction from the memory.

Process:
▸ The Program Counter (PC) holds the address of the next instruction to be executed.
▸ The address from the PC is sent to the Memory Address Register (MAR).
▸ The instruction at that memory address is fetched from the memory and placed into
the Memory Data Register (MDR).
▸ The fetched instruction is then transferred to the Instruction Register (IR).
▸ The PC is incremented to point to the next instruction in sequence.

The Decode Phase

Objective: Interpret the fetched instruction to understand what actions are


required.

Process:
▸ The control unit (CU) reads the instruction stored in the IR.
▸ The instruction is decoded to determine the operation to be performed and the
operands involved.
▸ This step may involve decoding the opcode (operation code) to identify the specific
operation (e.g., addition, subtraction, load, store).
▸ The CU sets up the necessary control signals to facilitate the execution of the
instruction.

The Execute Phase

Objective: Perform the operation defined by the instruction.

Process:
▸ The CU sends the appropriate control signals to the relevant parts of the CPU to carry
out the operation.
▸ If the instruction involves arithmetic or logic operations, the Arithmetic Logic Unit
(ALU) performs the calculation.
▸ If the instruction involves data movement, data is transferred between CPU registers
or between memory and registers.
▸ The result of the operation is stored in the appropriate register or memory location.
▸ Any changes to the status flags (e.g., zero, carry, overflow) are updated based on the
result of the operation.
The Stored Program Concept
The Stored Program Concept states that the instructions to be executed by the
computer are stored in its memory, just like data. This means that both the program (set
of instructions) and the data that the program operates on are stored in the same
memory space.
Before the Stored Program Concept, early computers used fixed programs, often hard-
wired or requiring manual reconfiguration to change the program. The introduction of
stored programs made computers much more powerful and flexible, enabling the
development of modern computing.
Example

Consider a simple program to add two numbers:


1.The instructions to perform the addition (e.g., load values, add them, store the result)
are stored in memory.
2. The data (the two numbers to be added) are also stored in memory.
3. The CPU fetches each instruction in sequence, decodes it to determine the
operation, and executes it, modifying or using the data as needed.
The Running of a Computer
How a Computer Starts up
The startup process of a computer, often referred to as the boot process, involves
several steps from powering on the hardware to loading the operating system and
initialising it for use.
The Operating System
The operating system is a program that, after being loaded into the memory, manages
resources and services like the use of memory, the CPU and the devices. It essentially
hides the internal details of the hardware and makes the ugly binary machine
understandable and manageable to us.

An OS has the following responsibilities:


Memory
Management
Process (Time)
Management
Device
Management
File
Management User InterfaceSecurity

You might also like