Upload
bilalpervez
View
217
Download
0
Embed Size (px)
Citation preview
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 1/23
COMPUTING
FUNDAMENTALS
Dr. Aman-ur-Rehman
Department of Nuclear Engineering,Pakistan Institute of Engineering and Applied Sciences,
P.O. Nilore, Islamabad.
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 2/23
Course Contents
Basic components of a computer
Programming languages
Programming in FORTRAN and Applications
Introduction to MS Windows
Use of Microsoft word
Introduction to Excel
Introduction to Power Point
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 3/23
Instructors
1. Dr. Aman-ur-Rehman
(Computer Programming)
2. Dr. Abdul Jalil
(Introduction to MS Windows , Use of Microsoft word, Introduction to Power Point)
3. Dr. Jamil Ahmad
(Introduction to Excel)
4. Mr. Mazhar Hasnain (Lab. Coordinator)
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 4/23
Computer
Computer is an advanced electronic device thattakes raw data as input from the user and
processes these data under the control of set of
instructions (called program) and gives theresult (output) and saves output for the future
use.
It can process both numerical and non-
numerical (arithmetic and logical) calculations.
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 5/23
Functions of a Computer
and Computer System
A Computer has four functions
accepts data (Input)
processes data (Processing)
produces output (Output) stores results (Storage)
Computer System: All of the components of a computer system can be summarized with the simple equation
COMPUTER SYSTEM = HARDWARE + SOFTWARE+ USER
Hardware : All physical parts of the computer
Software : Programs (Software gives "intelligence" to the computer)
USER : Person, who operates computer
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 6/23
Components of a Computer
Dr. Aman-ur-Rehman
DNE, PIEAS
INPUT
Keyboard
Mouse
Scanner
Camera
Arithmetic Logic
Unit (ALU)
Control Unit
Internal Memory
Unit
OUTPUT
Screen
Printer
Plotter
Photo
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 7/23
Components of a Computer
The major components of the computer are the centralprocessing unit (CPU), main memory, secondary memory,and input and output devices.
The CPU is the heart of any computer. It is divided into acontrol unit , an arithmetic logic unit (ALU), and internal memory .
The control unit of the CPU interprets the instructions of thecomputer program and it controls all the other parts of thecomputer. It also fetches data values from input devices or mainmemory and stores them in the memory registers and sends datavalues from memory registers to output device or main memory.
The ALU performs the actual mathematical calculations.
The internal memory within a CPU consists of a series of memoryregisters used for the temporary storage of intermediate resultduring calculations.
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 8/23
Main and Secondary Memory
The memory of a computer is divided into two
major types of memory: main or primary memory,
and secondary memory.
Main memory is very fast and relatively expensive. Data
stored in it can be fetched for use in less thannanosecond on a modern computer. It is not used for the
permanent storage of programs. It is also volatile.
Secondary memory consists of devices that are slower
and cheaper than the main memory. They can storemuch more information for much less money than the
main memory can. Mostly it is nonvolatile.
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 9/23
Input and Output devices
Data is entered into a computer through an inputdevice and is output through an output device.
The most common input device is on a moderncomputer is a keyboard. Other types of input
devices found on some computers are scanners andmicrophones.
Output devices permits us to use the data stored ina computer. The most common output devices on
todays computers are monitors and printers. Othertypes of output devices include plotters andspeakers.
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 10/23
Computer Program
A computer program is a sequence of instructions that are executed by a CPU.
Superscalar processors are capable of executingseveral instructions at once.
Program flow may be influenced by special
'jump' instructions that transfer execution to aninstruction other than the following one.
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 11/23
Computer Languages
(Low Level Languages) Low Level Languages: low-level languages are described as
being close to the hardware.
Low-level languages can be converted to machine codewithout using a compiler or interpreter, and the resulting coderuns directly on the processor.
A program written in a low-level language can be made to runvery fast, and with a very small memory; an equivalentprogram in a high-level language will be more heavyweight.
Low-level languages are simple, but are considered difficult touse, due to the numerous technical details which must beremembered.
Examples are Machine Level Language and Assembly language
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 12/23
Machine Level Language
Every processor or processor family has its ownmachine code instruction set.
Instructions are patterns of bits that by physical
design correspond to different commands to themachine.
The instruction set is thus specific to a class of
processors using (much) the same architecture.
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 13/23
Assembly Language
A much more readable rendition of machinelanguage, called assembly language, usesmnemonic codes to refer to machine codeinstructions
Mnemonic: For example, to remember thecolours of the rainbow, use the mnemonic"Richard Of York Gave Battle In Vain"
An Assembler is needed for conversion tomachine code
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 14/23
Merits and Demerits of
Low Level Language
Merits:
Extremely Fast executable
Best resource utilization
Customized coding
Demerits:
Suitable for small programs
Non-portable Not easy to extend / debug
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 15/23
Computer Languages
(High Level Languages)
High Level Languages: Programming languages
that are closer to human (English) language are
called High Level Languages (HLLs).
Machine Independent
Portable
Easy to Program / Debug / Extend / Modify
Compact code (smaller no. of lines)
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 16/23
Computer Languages
High Level Languages: The user friendly language
...more natural language than assembly language. Complier is needed to convert high level to machine
language
Dr. Aman-ur-Rehman
DNE, PIEAS
COBOL (COmmon Business Oriented Language), FORTRAN (FORmulaTRANslation), BASIC
(Beginner's All-purpose Symbolic Instruction Code), C, C++ etc. are the examples of High
Level Language.
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 17/23
Examples of High Level Languages
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 18/23
Language Concepts Fortran, C, C++ Compiled languages i.e., source code is created with an editor as a
plain text file. Programs then needs to be compiled (converted from source code
to machine instructions with relative addresses and undefinedexternal routines still needed).
External routines are those needed to do such operations as read
data files, write to the screen, read the keyboard strokes etc.) The compiled routines (called object modules) need then to be
linked or loaded.
Linking creates an executable with relative addresses resolved and
external routine loaded from the system and user libraries.
The executable can then, in most cases, be run on any machine
with the same architecture.
Compiling and linking can be done in one user step.
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 19/23
FORTRAN (Formula Translation)
History Developed between 1954-1957 at IBM
FORTRAN II released in 1958
FORTRAN IV released in 1962 (standard for next 15 years)
FORTRAN
66ANSI standard (basically FORTRAN IV).
FORTRAN 77 standard in 1977
Fortran 90 Added new features, in 1997 Fortran 95
released (started phasing out some FORTRAN 77
features).
Fortran 2000 and 2008 have been released but we will notcover here.
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 20/23
Philosophy of FORTRAN
FORTRAN was developed at a time whencomputers needed to do numerical calculations.
Its design is based on the idea of having modules(subroutines and functions) that do calculations with
variables (that contain numeric values) and to returnthe results of those calculations.
FORTRAN programs are a series of modules that docalculations with typically the results of one module
passed to the next.Usually programs need some type of IO to get
values to computations with and to return the results.
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 21/23
FORTRAN-77
Commands are divided into executable and non-executable ones. All non-executable commandsmust appear before the executable ones.
Syntax is quite rigid (discuss later)
Basic Structure:oModule types:
Program (only one per program, optional)
Subroutine Multi-argument return
Function single return (although not forced) Block data discuss later
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 22/23
Advantages of FORTRAN-77
F77 is a very simple language
F77 is easy to learn
F77 was made for computing mathematicalformulas and operating efficiently on plain arrays
F77 is still (and will forever be?) the dominatinglanguage for numerical computing
Lots of well tested and efficient F77 libraries exist
Compilers have 50 years of experience withoptimizing F77 loops over arrays
Result: F77 is hard to beat when it comes to arrayoperations
Dr. Aman-ur-Rehman
DNE, PIEAS
8/3/2019 Lecture_01_30_11_11
http://slidepdf.com/reader/full/lecture01301111 23/23
Disadvantages of FORTRAN-77
The basic variables types are primitive
No struct or class construct in F77
No dynamic memory allocation
Very primitive language for text processing, lists
and more complicated data structures F77 codes are difficult to extend, maintain and re-
use
F90/F95: extension of F77 with classes
(The efficiency of F90/F95 is still problematic, andF77 programmers move very slowly to F90/F95)
Dr. Aman-ur-Rehman
DNE, PIEAS