Lec 01 Introduction
Lec 01 Introduction
Lec 01 Introduction
Autumn 2020
Introduction
The Evolution of Electronic Computing
Communication
becoming
Free !!
Storage
became
Free !!
Computation
became
Free !!
Predicted in 1954
Reality
Storage has become free!!
Typical system
architecture
for a desktop PC
CPU (Central Processing Unit)
• Computations take place to perform a designated task.
• Large number of registers to temporarily store data and programs
(instructions).
• Functional units (circuitry) to carry out arithmetic and logic
operations
PC
R1
IR
R2
ALU MAR
R3 MDR
R4 FLAGS
Main Memory
• Uses semiconductor technology
• Allows direct access
• What is a program?
• Set of instructions for carrying out a specific task.
• Examples:
234 = 2 x 102 + 3 x 101 + 4 x 100
250.67 = 2 x 102 + 5 x 101 + 0 x 100 + 6 x 10-1 + 7 x 10-2
Computer works with Binary Numbers
• Examples:
101 (Binary) = 1 x 22 + 0 x 21 + 1 x 20 = 5 (Decimal)
11001 (Binary)
= 1 x 24 + 1 x 23 + 0 x 22 + 0 x 21 + 1 x 20
= 25 (Decimal)
Bits and Bytes
• Bit
• A single binary digit (0 or 1).
• Nibble
• A collection of four bits (say, 0110).
• Byte
• A collection of eight bits (say, 01000111).
• Word
• Depends on the computer.
• Typically 4 or 8 bytes (that is, 32 or 64 bits).
Number System (Contd.)
• A k-bit decimal number
• Can express unsigned integers in the range
• 0 to 10k – 1
• For k=3, from 0 to 999.
1. Application Software
• Used to solve a particular problem.
• Editor, financial accounting, weather forecasting, etc.
2. System Software
• Helps in running other programs.
• Compiler, operating system, etc.
Computer Languages
• Machine Language
• Expressed in binary and directly understood by the computer.
• Not portable; varies from one machine type to another.
• Program written for one type of machine will not run on another
type of machine.
• Difficult to use in writing programs.
• Assembly Language
• Mnemonic form of machine language.
• Easier to use as compared to machine language.
• For example, use “ADD” instead of “10110100”.
• Not portable (like machine language) and requires a translator
program called assembler.
Computer Languages (Contd.)
Assembly Machine
language Assembler language
program program
HLL
Program
Libraries
Operating Systems
• Makes the computer easy to use.
• Basically the computer is very difficult to use.
• Understands only machine language.
• Categories of operating systems:
• Single user
• Multi user: Time sharing, Multitasking, Real time
• Popular operating systems:
Windows 10: single-user multitasking
Unix: multi-user
Linux: a free version of Unix
• Question:
How multiple users can work on the same computer?
Some Terminologies
• Algorithm / Flowchart
• A step-by-step procedure for solving a particular problem.
• Independent of the programming language.
• Program
• A translation of the algorithm/flowchart into a form that can
be processed by a computer.
• Typically written in a high-level language like C, C++, Java,
Python, etc.
Programming and Software
#include <stdio.h>
int main( )
{
printf(“Welcome to IITKGP\n”);
printf(“\tYou are doing PDS Theory.”);
return 0;
}
Structure of a C program
#include <stdio.h>
int main(
{
printf(“Welcome to IITKGP\n”);
printf(“\tYou are doing PDS Theory.”);
return 0;
}
Output:
Enter How Many Students: 180
No. of students is 180.
The C Character and Keyword Set
• The C language alphabet ! # % ^ & * ( )
• Uppercase letters ‘A’ to ‘Z’
- _ + = ~ [ ] \
• Lowercase letters ‘a’ to ‘z’
• Digits ‘0’ to ‘9’ | ; : ‘ “ { } ,
• Certain special characters: . < > / ? blank