cs101_lecture_05.ppt

17
Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi Lecture 05: Computer Software & Prog.CS 101: Introduction to Computing Computer Software and Programming Zawar Hussain

Upload: muhammad-abuzar-khan

Post on 15-Apr-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing

Computer Software and Programming

Zawar Hussain

Page 2: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing

A little about the Kernel

• Kernel provides the most essential OS services

• It stays in memory all the time your computer is power on.

• Other parts are loaded into memory as needed

Page 3: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing

Firmware

• A term sometimes used to denote the fixed, usually rather small, programs that internally control various electronic devices

– E.g., remote controls, keyboards, digital cameras etc contain firmware to enable the device’s basic operations as well as implementing higher level functions

• Typically reside in ROM• More complex reside in flash memory to allow for updates

Page 4: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing

Example of firmware

• Timing control systems in washing machine

• BIOS found in PC

• Controlling sound / video attributes, channel lists in TVs

Page 5: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing5

History of the Internet

• The Internet enables– Quick and easy communication via e-mail– International networking of computers

• Packet switching – Transfers digital data via small packets– Allows multiple users to send and receive data simultaneously

• No centralized control– If one part of the Internet fails, other parts can still operate

• Bandwidth – Carrying capacity of communications lines

Page 6: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing6

History of the World Wide Web

• World Wide Web – Allows users to locate and view multimedia-based documents on almost

any subject– Makes information instantly and conveniently accessible worldwide– Makes it possible for individuals and small businesses to get worldwide

exposure– Is changing the way business is done

Page 7: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing

Networks

• LAN• WAN• Internet

Page 8: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing

Page 9: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing

Computer Programming

Page 10: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing

Computer Programming

• Computer programming is the process of writing instructions that direct a computer to carry out specific tasks

• A computer program is a set of step-by-step instructions that tell a computer how to solve a problem or carry out a task

• The instructions that make up a computer program are often referred to as code

• A program is written in a computer programming language

Page 11: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing

Machine Language / Machine Code

• The first languages for programming computers – sometimes referred to as first-generation languages

– Consists of a set of commands, represented as a series of 1s and 0s, corresponding to the instruction set understood by a microprocessor

– A machine language is specific to a particular CPU or microprocessor family

• High-level languages are (mostly) translated [compiled] to machine language in order to be understood and executed by the microprocessor

Page 12: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing

Assembly Language

• Allows programmers to use abbreviated command words rather than 1s and 0s used in machine languages– A significant improvement over machine languages

• Mnemonics such as ADD, SUB, MUL, DIV, JMP etc are more understandable than 0001, 0100 etc

– Also referred to as second-generation languages– Assembly languages are also machine specific

• Each assembly language command corresponds on a one-to-one basis to a machine language instruction

Page 13: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing

LOW-LEVELLANGUAGES

Programming Language Categorization

HARDWARE

MACHINE LANGUAGE

ASSEMBLY LANGUAGE

HIGH-LEVEL LANGUAGES

1st GenerationLanguage [1GL]

2GL

3GL, 4GL

Page 14: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing

Algorithm

A concept that pervades all areas of computer science.

Algorithm is a process that a computer could carry out to complete a well defined task within finite time and

resources.

The objective of computer science is to solve problems by developing, analyzing, and implementing

algorithmic solutions.

Page 15: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing

Al-Khwarizmi Principle

• All complex problems can be broken into simpler sub-problems.

• Solve a complex problem by breaking it down into smaller sub-problems and then solve them (in a specified order), one at a time.

• When all the steps are solved, the original problem itself has also been solved.

• This process is called Algorithm.

Page 16: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing

Computer Programming

• Computer is a powerful tool• It is not intelligent!• In order to use computer to solve our problems, we

must tell it what we want done and the order in which we want it done.

• These instructions are called computer program. • This process is called computer programming.• The person giving these instructions is called a

computer programmer.

Page 17: CS101_Lecture_05.ppt

Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi

Lecture 05: Computer Software & Prog. CS 101: Introduction to Computing

Your First C++ Program

Welcome to C++!

1// Fig. 1.4: fig01_04.cpp2// Printing a line with multiple statements3#include <iostream>45int main()6{7 std::cout << "Welcome ";8 std::cout << "to C++!\n";910 return 0; // indicate that program ended successfully

11}

Unless new line '\n' is specified, the text continues on the same line.