Lec 1-2-3
Lec 1-2-3
Lec 1-2-3
Lecture-1 and 2
Rashed Mazumder
rakhu345@yahoo.com
Contents
• Relationship between hardware and software
components
• The Information Processing Cycle
• Essential Computer Hardware
• Software
• Input/Output Devices
• Computer Program
Computer Hardware Components
Components of a PC
Relationship between hardware
and software
The Information Processing Cycle
Processor
Memory
Storage
Output
Essential Hardware
Components(continued)
Input
The devices used to give the computer data or commands are called Input
devices. Includes keyboard, mouse, scanner, etc.
Processor
• A processor is the logic circuitry that responds to and processes the basic
instructions that drive a computer.
• The term processor has generally replaced the term central processing
unit (CPU).
• The processor in a personal computer or embedded in small devices is often
called a microprocessor.
• Short for microprocessor, the central processing unit in a computer.
• The processor is the logic of a computer and functions comparably to a
human central nervous system, directing signals from one component to
another and enabling everything to happen.
Essential Hardware
Components(continued)
Memory
• It is the electronic holding place for instructions and data that your
computer's microprocessor can reach quickly.
• When your computer is in normal operation, its memory usually
contains the main parts of the operating system and some or all of
the application programs and related data that are being used.
• Memory is often used as a shorter synonym for random access
memory (RAM).
• This kind of memory is located on one or more microchips that are
physically close to the microprocessor in your computer.
• Most desktop and notebook computers sold today include at least
16 megabytes of RAM, and are upgradeable to include more.
• The more RAM you have, the less frequently the computer has to
access instructions and data from the more slowly accessed hard
disk form of storage. Memory is also called primary or main
memory.
Essential Hardware
Components(continued)
Storage
• Computer storage is the holding of data in
an electromagnetic form for access by a computer processor.
It is also called secondary storage.
• In secondary storage data resides on hard disks, tapes, and
other external devices.
• Primary storage is much faster to access than secondary
storage because of the proximity of the storage to
the processor or because of the nature of the storage devices.
• On the other hand, secondary storage can hold much more
data than primary storage.
Output
i. System software
ii. Application software
Software(continued)
System software
When you switch on the computer the programs stored
in ROM are executed which activates different units of
your computer and makes it ready for you to work on
it. This set of programs can be called system software.
It can be categorized into two parts:
Operating system
Utilities
System software
(Operating system)
• An operating system is a system software that provides
an interface for a user to communicate with the
computer, manages hardware devices (disk drives,
keyboard, monitor, etc), manages and maintains disk
file systems and supports application programs.
• Some popular Operating systems are UNIX, Windows
and Linux.
System software(Utilities)
• Although operating system provides all the features,
users need to use and maintain their systems,
inevitably, they still do not meet everyone’s
expectations.
• This has led to another type of system software called
"Utilities".
• These are programs that bridge the gap between the
functionality of an OS and the needs of users.
• Utility programs are a broad category of software
such as compress (zip)/uncompress (unzip) files
software, anti virus software, split and join files
software, etc.
Application software
Application software is a set of programs, which are
written to perform specific tasks.
For example: An application package for managing
library known as library information system is used
to manage information of library such as: keeping
book details, account holder details, book issue
details, book return details etc.
Application software can be broadly classified into
two types:
i. Generalized packages
ii. Customized packages
Application software(Generalized
Packages)
• These are user friendly software written to cater to user’s very general
needs such as preparing documents, drawing pictures, database to
manage data/information, preparing presentations, play games etc.
• It is a group of programs that provide general purpose tools to solve
specific problems.
• Some of the generalized packages are listed below:
Word Processing Software(for preparing documents): Word Perfect,
MS-Word, OpenOffice.org Writer l
Spreadsheets (Data Analysis): Lotus Smart suites, MSExcel,
OpenOffice.org Calc, Apple Numbers l
Presentations : Presentation Graphics, MS-PowerPoint,
OpenOffice.org Impress l
Database Management System: MS-Access, OpenOffice.org Base,
MS-SQL Server, ORACLE l
Graphics Tools: Paint shop pro, Adobe Photoshop
Application software(Customized
Packages)
• Printers
• Plotter
• Speakers
Input Device(Keyboard)
• A keyboard is the most common input device.
• Several kinds of keyboards are available, but they
resemble each other with minor variations.
• The keyboard in most common use is the QWERTY board.
• Generally standard keyboard has 104 keys.
• In these keyboards, the cursor control keys are duplicated
to allow easier use of the numeric pad.
Input Device(Mouse)
• A mouse is an electro-mechanical, hand-held device.
• It is used as a pointer.
• It can perform functions like selecting menu commands, moving icons,
resizing windows, starting programs, and choosing options.
• The most common mouse uses an internal, magnetically coated ball, to
detect the movement of the mouse across a flat surface, usually a
desktop.
• Now a days Optical or laser mouse is used to detect the movement. All
windows based applications today are designed to work with a mouse.
• However, it cannot substitute all keyboard operations.
• It can be alternative for commands based operations.
Input Device(Light pen)
• An input device that utilizes a light-sensitive detector
to select objects on a display screen.
• A light pen is similar to a mouse, except that with a
light pen you can move the pointer and select objects
on the display screen by directly pointing to the
objects with the pen.
Input Device(Optical scanner)
• These devices are used for automatic data
collection.
• The devices of this category completely
eliminate manual input of data.
• For example, the bar-code reader is actually
just a special type of image scanner.
• An image scanner translates printed images
into an electronic format that can be stored in a
computer’s memory, and with the right kind of
software, one can alter a stored image.
• Another example of scanner is optical
character recognition (OCR) device, used by
banks to convert the scanned image of a typed
or printed page into text that can be edited on
the computer.
Input Device(Touch Screen)
• Touch panel displays and pads are
now being offered as alternatives
to keyboard.
• Here the input can be given
through the computer screen, that
accepts the input through monitor;
users touch electronic buttons
displayed on the screen or they
may use light pen.
Input Device(Microphone)
• Microphone is an input device,
which takes voice as input.
• The voice communication is more
error-prone than information Desktop
through keyboard. microphone
Cold
Cathode
Fluorescent The light goes through layers of glass, polarizers, The colors and light combine
thin film transistors (TFT), liquid crystals, and to produce the images you
(CCFL) see on your display.
backlighting color filters.
is required.
How LCD monitor works?(continued)
• The source of light produces a light. The light passes
through liquid crystal, its intensity is influenced by
other layers, especially by liquid crystal.
• The signal comes in from the video controller which is
decoded and understood by a display controller on the
monitor itself. The controller has two things to control -
the electrics of the pixels and the light source.
• Then it passes through the polarizing filters placed at
the two ends of TFT(Thin Film Transistor).
How LCD monitor works?(continued)
• The two filters are exact opposites of each other.
• As the light from the light source behind the first filter comes in, the
filter effectively whites it out - which means that if it was to pass
through the liquid crystals with no interaction, the filter on the other
side would polarize it back to black, leaving no color being emitted.
• In fact, alternate current - leaving the crystals 'dead in the water' - is
how black is created on a panel.
• However, if the electrodes apply current to the liquid crystals they
twist and change the way that the light is passed through, altering its
polarization and this then results in the correct color coming out of the
second polarizing filter and being displayed to the user.
• The actual image on a TFT is made up of a matrix of pixels and has a
sandwich-like structure. Unlike with CRTs, there's no complex
equation of dot pitch and image area to try and calculate - the native
resolution of the monitor is simply the number of pixels contained in
the matrix.
How LCD monitor works?(continued)
• If it's a 17" monitor, chances are there are 1280 pixels in
the matrix horizontally, and 1024 vertically.
• Each pixel is made up of three sub-pixels, which have
red, green and blue filters in front of them, just as each
pixel on a CRT has RGB phosphors. The sub pixels are
made up of a group of liquid crystal molecules. These
molecules are suspended between transparent electrodes
and are mashed between two polarizing filters.
Output device(Monitor)-LED monitor
• main() function
• Library functions
• Header files
Components of C (main ()function)
• Although a C program may contain several functions, the
only function that C must have is the main().
• The main() function is where execution of your program
begins.
• That is, when your program begins running, it starts
executing the statements inside main(), beginning with the
first statement after the opening curly brace.
• The program ends when main()’s closing curly brace is
reached.
• Although the curly brace doesn’t actually exist in the
compiled version of the program, but it is helpful to
understand.
Components of C (library functions)
• Library functions in C language are inbuilt functions which are grouped
together and placed in a common place called library.
• Each library function in C performs specific operation.
• We can make use of these library functions to get the pre-defined output
instead of writing our own code to get those outputs.
• These library functions are created by the persons who designed and
created C compilers.
• The advantage of adding user defined function in C library is, this
function will be available for all C programs once added to the C library.
• Example:
printf(): to show the output;
scanf(): to take the input;
getchar(): returns the next character typed on the keyboard;
putchar(): outputs a single character to the screen, etc.
Components of C (header files)
• Another component common to most C programs is the
header file.
• In C, information about the standard library functions is
found in various files supplied with the compiler.
• These files all end with a .h extension.
• The C compiler uses the information in these files to handle
the library functions properly.
• These files are added in the program using the #include
preprocessor directive.
• When we include header files in our C program using
“#include<filename.h>” command, all C code of the header
files are included in C program. Then, this C program is
compiled by compiler and executed.
Components of C (header files) continued
• All C compilers use their first phase of compilation a preprocessor,
which performs various manipulations on the source file before it is
compiled.
• Preprocessor directives are not actually part of the C language, but
rather instructions from you to the compiler.
• The #include directive tells the preprocessor to read in another file
and include it in your program. Later of this slide we will learn it.
• The most common header file is called stdio.h which means
standard input output.
• #include<stdio.h>
• It doesn’t end with semicolon. Because #include is not a C keyword
that can define a statement. Instead, it is an instruction to the C
compiler itself.
C Program (Example-1)
uses standard library
input and output functions
#include <stdio.h>
(printf)
the program int main (void)
{
begin of program printf (“Bangladesh\n");
statements return 0;
}
end of program
main: a special name that indicates where the program must begin execution. It is a special
function.
first statement: calls a routine named printf, with argument the string of characters “Programming is
fun \n”
last statement: finishes execution of main and returns to the system a status value of 0
(conventional value for OK)
C Program (Example-2)
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf(“Thank You!\n");
return 0;
}
C Program (Example-2)
#include <stdio.h>
#include <stdlib.h> standard Library, input-output, header-file
int main()
{
printf(“Thank You!\n");
return 0;
}
C Program (Example-2)
#include <stdio.h>
#include <stdlib.h>
Beginning of program
int main()
{
printf(“Thank You!\n");
return 0;
}
C Program (Example-2)
#include <stdio.h>
#include <stdlib.h>
int main()
{ Start of Segment
printf(“Thank You!\n");
return 0;
End of Segment
}
C Program (Example-2)
#include <stdio.h>
#include <stdlib.h>
int main()
{ Function for printing text
Thank you!
Compiling and running C programs
Traditional command-line compiler has the following
steps to create and compile a program:
Editor
Source code
file.c
Compiler
Object code
file.obj
Libraries Linker
Executable code
IDE (Integrated
file.exe
Development
Environment)
Compilers/Interpreters
Source Machine
Compiler Code Source
Code
Code
Interpreter
Input Output
Input Executable Output
data data
data Program data
return 0;
}
List of some header files with their respective library
functions’ uses(continued)
3.ctype.h: Character functions
1. isdigit() returns non-0 if arg is digit 0 to 9
2. isalpha() returns non-0 if arg is a letter of the alphabet
3. isalnum() returns non-0 if arg is a letter or digit
4. islower() returns non-0 if arg is lowercase letter
5. isupper() returns non-0 if arg is uppercase letter