0% found this document useful (0 votes)
19 views

Module 1 - Introduction To Computing Programming

computer rogramming

Uploaded by

SHUBHAM BANSAL
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Module 1 - Introduction To Computing Programming

computer rogramming

Uploaded by

SHUBHAM BANSAL
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Module 1 - Introduction

to Computer
BITS Pilani Programming
Pilani Campus
Department of Computer Science & Information Systems
Module Overview

• Objectives of the Course

• Computers and Computing

• Introduction to Programming

• The C language

• Program and Process Execution

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus

Course Objectives
Course Objectives
• Learn about Computers and Computing Methodologies

• Learn basic concepts of programming using the C language

• Construct Solutions to Scientific Problems through


programming

• Systematic techniques and approaches for constructing


programs

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus

Computers and Computing


We have seen Computers…

Desktop Laptop
Computer Computer

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Smart Devices (Small
Computers)

Smart Phone

Tablet Smart Watch

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Super Computer…

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
What is a Computer?
A device that takes data as input, does some processing and then
returns an output.
CPU
Control
Unit
Input Output

ALU

Memory

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
What is a CPU?
• CPU stands for Central Processing Unit.
• The CPU is often simply referred to as the
processor.
• The CPU is the brain of a computer, containing
all the electronic circuitry needed to process
input, store data, and output results.
• Essentially CPU executes computer
programs.
• It consists of an arithmetic and logic unit (ALU),
and a control unit
• ALU performs arithmetic and logical Intel i7
operations specified by a computer program
Processor
• Control Unit directs the operations of the
Processor

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
What is memory?
• Computer memory is the storage space in the computer,
where “data to be processed” and “instructions required for
processing” are stored.

RAM chips Hard Disk


Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Types of Memory

Registers (inbuilt on In this course, we will deal with


Primary memory (RAM) and
the processor) Secondary Memory (DISK) only!

Size Cache (inbuilt on the Speed


processor)
Registers, Cache and RAM are
volatile
• Retains data as long as the
Primary (RAM, ROM) voltage is applied

ROM and Secondary devices


Secondary (HDD, SSD, are non-volatile
PenD, Floppy, Tape, • Retains data permanently
CD) without any voltage
Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Hardware vs Software

• Hardware is the physical parts of the computer: motherboard,


CPU, RAM, keyboard, monitor, etc.
• Software is a collection of instructions that can be run on the
hardware of the computer. These instructions tell the computer
what to do.
• In other words, Software is a Computer Program.
• Software is not a physical thing, just a bunch of programs.
Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus

Introduction to Programming
What is a Computer
Program?

“A Computer Program (or simply a


Program) is a collection of instructions that
performs a specific task when executed by a
computer”

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Where are Programs Used?
• MS Word is a Program

• Google Chrome is a Program

• Skype is a Program

• Hawk’s-eye is a Program

• Windows OS is a Program

Anything we do on a computer requires us to write a


program…
Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Programming Language
• Programs in a computer are written using a Programming
Language

• A programming language is a vocabulary and set of grammatical


rules for instructing a computer to perform specific tasks.

• Examples: C, C++, Java, Python, etc.

• Each language has a unique set of keywords (words that it


understands) and a special syntax for organizing program
instructions.

• Programming languages are unambiguous.


Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Levels of Programming
Languages

High Level Language

Assembly Language Ease of


understanding

Machine language

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Machine Language

High Level Language


• Language of the machine Ease of
Assembly Language understanding

• Made up of a series of binary Machine language


patterns
Machine Code
• Can be run directly 1001110100001101000000
0110000110100001111011
• Difficult to learn 1000000101111101101110
1111011000101101100010
1000000010011110000110
1001001100011100000001

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Assembly Language

High Level Language


Ease of
• Uses simple mnemonic Assembly Language understanding

abbreviations
Machine language

• Unique to a specific CPU Assembly Code


architecture
__start:
mov edx, len
• Requires an assembler add ecx, edx
mov ebx, 1
sub eax, edx
int 0x80

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
High level Language

High Level Language


• English-like Ease of
Assembly Language understanding

• Easier to understand Machine language

• Requires Compiler High-level Code


#include<stdio.h>
int main() {
• Compiler: Generates int a, b, sum;
object/machine code scanf("%d %d", &a, &b);
sum = a + b;
printf("The sum is %d\n", sum);
return 0;
}
Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus

The C Programming Language


The C language
• General Purpose high-level programming language

• Closely associated with the UNIX operating system

• Most versatile as it supports direct access of memory


locations through pointers

• Compiler based language


We will Study
• C programs are known for speed More about C in
and efficiency! this course
Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus

Program and Process Execution


Perform tasks with Programs

You want to perform a specific task using a computer. You will


do the following steps:

• Write a C program specific to your task


• Save it on the computer
• Compile and Run your program

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
What happens to your
program?
You write a program…

1. Where is your program saved?

1. What happens to your program when you try to compile and


run it?

Before we answer the above questions let us see what is an


operating system…

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Operating System (OS)
• An OS is a layer of software
interposed between the User
application programs and
the hardware
Application
• OS manages everything on
your computer including
hardware Operating System

• OS is responsible for
executing your program Hardware

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
Basic layout of Computer Hardware

OS Manages these
resources

CPU Disk (Secondary


Memory)

Primary
Memory (RAM)
Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
What happens to your
program?
Now let us answer these questions…

1. Where is your program saved?

1. What happens to your program when you try to compile and


run it?

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
1. Where is your program
saved?
Your program when
saved gets stored on
the disk

Program

CPU Disk (Secondary


Memory)

Primary
Memory (RAM)
Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
What happens to your
program?
Now let us answer these questions…

1. Where is your program saved?

1. What happens to your program when you try to compile and


run it?

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
2. What happens to your program
when you try to compile and run it?

• OS loads the
program into RAM
• Executes it line by
line on CPU

Program
Program Program

Program is Program
executed gets
CPU on CPU loaded Disk (Secondary
into RAM Memory)

Note: Program under


Primary execution is known as a
Memory (RAM) Process

Dept. of Computer Science & Information Systems, BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus

Thank you
Q&A

You might also like