CSL1010: Introduction to
Computer Science
Slides are prepared from multiple resources on the web.
L02
12/11/2022
What is a Computer ?
A computer is a general purpose device that can be programmed to process
information, and yield meaningful results.
History of Computing
Abacus, 16th century Blaise Pascal, 17th century Jacquard’s loom, 18th century
History of Computing
• 1850: Analytical Engine, Charles Babbage and Ada Byron
• 1939 - 1942: Atanasoff Berry Computer - binary system of of arithmetic,
parallel processing, regenerative memory, separation of memory and
computing functions etc.
• 1940s - Colossus - a vacuum tube computing machine which broke Hitler's
codes during WW II.
• 1946 - ENIAC - World's rst electronic, large scale, general-purpose
computer, built by Mauchly and Eckert,
fi
Advancements in Computing
Advancements in Computing
Performance measures…
•Performance: Higher IPC,
Higher GHz, Higher throughput
(TFLOPS, TOPS,…), etc.
•Power/Energy ef ciency:
MIPS/W (millions of
instructions per second per
watt), TFLOPs/watt.
•Area overhead: small mm2
fi
All the components of a computer
•Memory – Stores programs and
data. Gets destroyed when the
computer is powered o
•Hard disk – stores programs/
data permanently
f
Structure of a computer system
Hardware Aspects
CPU/Processor
Fundamentals: How to interact with computers
How to interact with a computer?
compile execute
• Write a program in a high level language – C, C++, Java, Python
• Compile it into a format that the computer understands
• Execute the program
How to instruct a computer
• Human can understand
• Complicated sentences in different languages: English,
Hindi, Urdu etc.
• Computers can understand
• Very simple instructions
What can a computer understand
• They understand:
• Add a, b to get c
• Mul ply a, b to get c
• Computer can clearly NOT understand instruc ons of the form
• Mul ply two matrices
• Compute the determinant of a matrix
• Find the shortest path between Mumbai and Delhi
ti
ti
Compiler
• The compiler changes your source code based on instructions, or
preprocessor directives, embedded in the source code.
• The preprocessor creates a “new” version of your program and it is this
new program that actually gets compiled.
• Normally, you do not see these “new” versions on the hard disk, as they
are deleted after compilation.
Front end checks
whether it is correctly
written or not
Back end is
responsible for
translating the code to
assembly code
Instruction set architecture
The semantics of all the instructions supported by a
processor is known as its instruction set architecture (ISA).
This includes the semantics of the instructions themselves,
along with their operands, and interfaces with peripheral
devices.
Features of an ISA
Example of instructions in an ISA
• Arithmetic instructions : add, sub, mul, div
• Logical instructions : and, or, not
• Data transfer/movement instructions
Also called as low level instructions
• Most programmers avoid writing programs in low level
instructions. Very complicated, and dif cult.
Instruction Set Architecture
ISA in different types of languages
Assembly language is in
between HLL and machine
code in terms of ease of
use.
Machine code is set of
instructions that CPU understands
directly and can act upon.
Machine code contains only 0’s and
1’s (binary) which is very dif cult
to read, write, debug and manage.
fi
Implementation of ISA in Hardware
Low-level vs High-level Programming
Low-Level Programming High-Level Programming
Any language where memory management or
Code is written directly for the computer.
garbage collection is done for you.
The only true low-level programming languages are C, Python and JavaScript are examples of
Assembly and Machine Code. high-level languages
Low-level programming is still used in IoT and
High-level programming is the go-to in most
wearables/hardware – where the amount of energy
web development projects.
a device uses is crucial.
No automatic memory management – because this is Because memory management is done for
up to the engineer, the rewards are substantial in you, expect less ef cient and more
terms of ef ciency and power consumption. computationally intensive code.
fi
fi