Вы находитесь на странице: 1из 85

Introduction to Computer Systems

The Objective of this course is to have an insight on what a computer is, how it works in
collaboration with another computer or various devices that connect to it with or
without wires. The collaboration of various physically and geographically distant
computers serves as the medium for communication, information sharing and
processing. This collaboration of computers forms a computing environment. In
addition, this course explains the basics of system software and the different programs
associated with system software like assemblers, compilers, loaders, linkers and
interpreters.

1.Introduction to Computer Technology


1.1. What is a Computer
1.2. Components in a Computer System
1.3. Computer Language

Page No.
2
6
16

2.Computer Organization and Architecture


2.1. Organization of a Small Computer
2.2. Bus
2.3. Addressing Modes
3.Systems Software
3.1. Assembler
3.2. Assembly Language
3.3. Loaders and Linkers
3.4. Compilers
3.5. Interpreters

19
30
31
33
35
38
40
41

4.Introduction to Operating System


4.1. Basic Resources Managed by Operating Systems
4.2. Resource Sharing Management

44
58

5.Computing Environments
5.1. Mainframe Computing Environment
5.2. Networks
5.3. Internet
5.4. Websites

60
64
74
78

Page 1
ASPIRE 2014 ( Introduction to Computer systems )

1.Introduction to Computer Technology


1.1. What is a Computer
Computers have become an indispensable part of our daily life. Be it connecting with our
friends, shopping, gaming, booking tickets, getting the score updates, listening to music,
watching movies as well as live TV programs and so on (refer Figure 1.1, 1.2, 1.3 and 1.4).
Computers have made our life not only easy but more interesting as well. It is an advantage for
us, that we are living in the period of such technological revolutions. So, let us explore what
Computer Technology actually is and how it works.

Page 2
ASPIRE 2014 ( Introduction to Computer systems )

What is a Computer
A computer is a machine that executes a set of arithmetic or logical instructions. The sequence of
these instructions can be changed to perform a variety of operations and get various outputs.
For example, it can perform arithmetic instructions (instructions used for calculations) like Add,
Multiply, Subtract or Divide. It can calculate and store 2 + 3 = 5 as result in the memory.
Logical instructions have some conditions that evaluate to either true or false (called Boolean
values). Based on these conditions they derive a result. For example, we want to calculate the
grade of a student based on the total marks as follows: If total marks is greater than 180 then,
Grade of Student should be A. Else if total marks is in between 150 and 180 then Grade of
Student should be B. Otherwise (that is both the previous conditions evaluated to false) the
Grade of Student will be C. So, if Tom has his total marks as 175 then, his grade will be B as the
second logical condition evaluates to true, in this case.
If simply put, we can describe computer as an electronic device which takes some input like your
name and birth date and displays your age. Also it can remember your name and greet you the
next time you start it. Hence it uses information to calculate results. Also it stores and remembers
information.
For example, if you have entered your name as Tom and birth date as 1st January 1995 and if the
current year is 2014, the computer will display the result as Welcome Tom. Your age is 19 years.
The evolution of Computer Technology has been an interesting journey and starts with its
pioneer Charles Babbage.
Charles Babbage, the father of computer, designed the first automatic computing engine. It was
to operate on steam and was called the Difference Engine (refer Figure 1.5).

Page 3
ASPIRE 2014 ( Introduction to Computer systems )

Harvard Mark-I (refer Figure 1.6) computer was built as a partnership between Harvard and IBM
in 1944. It was the first programmable digital computer made in the U.S.

But it was not a purely electronic computer. The Mark-I computer was constructed out of
switches, clutches, relays and rotating shafts.
The machine weighed 5 tons, contained 500 miles of wire, was 51 feet long and 8 feet tall, and
had a 50 ft rotating shaft, turned by a 5 horsepower electric motor.
The first completely electronic computer is well known as ENIAC (Electronic Numerical
Integrator And Calculator - refer Figure 1.9) and was developed by the University of
Pennsylvania in 1946. This was followed by many evolutions and then came Apple I computer
(refer Figure 1.7) in 1976, which could be setup as a Do It Yourself Kit.

Page 4
ASPIRE 2014 ( Introduction to Computer systems )

The computers that we use today is a transformation which was a result of the invention of the
microprocessor. A microprocessor (uP) is a computer that is fabricated on an Integrated Circuit
(IC - refer Glossary and Figure 1.8).

It is a single integrated circuit that is sufficiently complex enough to perform the processing part
of the information processing cycle (that is the arithmetic and logical calculations discussed
above in this section - by considering information like marks, we have derived the grade of a
student). In other words, it must have enough circuitry to process data, perform calculations, and
facilitate interface with memory, input, output and storage devices (refer section 2.1.b for more
details on Input, Output and Storage devices).
A microprocessor can perform calculation at a super speed with accuracy. For example, the
following calculation is performed really fast producing accurate results.
147369852 * 58937.42 * 698532.47 * 65893.6598= 399788222207794191356873.69597904

Page 5
ASPIRE 2014 ( Introduction to Computer systems )

Computers had been around for 20 years before the first microprocessor was developed by Intel
(one of the leading companies that manufactures hardware) in 1971. The micro in the name
microprocessor refers to the small physical size. Intel did not invent the electronic computer. But
they were the first to succeed in designing an entire computer on a single chip (IC).
Thus Intel 4004, the first microprocessor (uP) came into existence. The 4004 consisted of 2300
transistors and was clocked at 108 kHz (108,000 times per second). Compare this to the 42
million transistors and the 2 GHz clock rate (2,000,000,000 times per second) used in a Pentium
4. Pioneer 10 spacecraft, the man-made object farthest from the earth has Intel's 4004 chips.
Intel followed the 4004 with the 8008 and 8080.The Intel Pentium 4 used in today's PCs is still
compatible with the Intel 8088 used in IBM's first PC.
In 1993 Apple released its first tablet computer named Newton Message Pad 100 and then iPad
in 2010 followed by a series of tablets (refer Figure 1.9) and we still have more innovations on
the way.
The evolution of computer has changed it from that of the size of a room to the one that fits in
your palm with multiple times more computational ability and speed.

Few of the latest use of computer technology can be listed as below (refer Glossary for details).

Digital Signature Verification

Natural Language Speech to Text

Augmented Reality

Cloud Computing

Phablets

Page 6
ASPIRE 2014 ( Introduction to Computer systems )

Omnidirectional Imaging

Social Networking

1.2. Components in a Computer System


A computer consists of following components:

Hardware

Software

Firmware

1.2.1. Hardware
Hardware constitutes the tangible parts of computer like its keyboard, mouse, Visual Display
Unit (VDU or monitor), circuits etc. It is best described as all the physical parts of a computer,
the parts you can actually see and touch.
Hardware constitutes the following parts of computer:
I. Case or body of computer
II. Power supply
III. Input peripherals
i.
ii.

Mouse
Keyboard

IV. Output peripherals


i.
ii.

Monitor
Printer

V. Memory Device
VI. Motherboard
i.

ii.
iii.

Central Processing Unit


RAM
Ports
Page 7

ASPIRE 2014 ( Introduction to Computer systems )

VII. Expansion cards

Out of the components listed above, in this session, we will focus our discussion on the
following parts of hardware only:
I.

Mouse

II.

Keyboard

III.

Monitor

IV. Memory Device


V. Central Processing Unit

1.2.1.1. Mouse
A Mouse is an input device and probably has at least two buttons on it. The left button is called
the primary mouse button, the right button is called the secondary mouse button or just the right
mouse button. There can be a small wheel called Scroller between the two mouse buttons. The
mouse can be used as follows:

Click: Point to an item, then tap (press and release) the left mouse button. Like you click
links on a website.

Double-click: Point to an item and press the left mouse button twice in rapid succession.

Right-click: Point to an item, then tap the right mouse button.


Page 8

ASPIRE 2014 ( Introduction to Computer systems )

Drag: Point to an item, then hold down the left mouse button as you move the mouse.
Then release the left mouse button to drop the item.

Right-drag: Point to an item, then hold down the right mouse button as you move the
mouse. Then release the right mouse button to drop the item.

1.2.1.2. Keyboard
A Keyboard is an input device and is usually used when we need to type some text input or fill a
form. Various keys are explained below.

The function keys have some definite function depending on the application or program
that you are using on your computer. There are twelve function keys from F1 to F12. F1
can always be used to display help for your current application, F2 can be used to change
name of any file, F3 can be used to search any text or file on the computer. Similarly each
function key can be used to perform a specific action.

The direction keys or Arrow keys can be used to move the typing cursor (the blinking
short vertical line on monitor that indicates the position of text insertion) at desired
location.

The numeric keys can be used to enter numbers if we have pressed the Num-Lock key
which can be indicated by the light on Lock Key indicators. Otherwise, the Numeric keys
behave as direction keys and allows you to change your cursor location.

Ctrl and Alt keys are generally used in combination with other keys to perform some
specific task that is, you can press all these combination keys together to produce a single
input.

Shift Key is also a special key which can be used to change the lower case letter to upper
case and vice-versa while typing. It is also used to display the parenthesis (), the question
mark (?) , the exclamation point (!) and the colon(:). Also, it helps in displaying other
special characters like @, $, # that are present on the horizontal numeric keypad.

Page 9
ASPIRE 2014 ( Introduction to Computer systems )

Tab key allows you to move the cursor by a fixed number of spaces. It is helpful if you
want to write something in a tabulated form. It can also be used to move to the next input
field while filling a form.

Caps Lock Key sets an input mode in which typed letters are uppercase (in capital letters)
by default . The keyboard remains in caps lock mode until the key is pressed again. It can
be useful when you are typing a heading or filling a form which requires only capital
letters.

Enter Key causes a form or any other computer operation to perform its default function.
This is typically an alternative to pressing an OK button. It can also be used to move to
the next line's starting position while typing.

Esc (Escape) key can be used to cancel a task or to go back to a previous task.

1.2.1.3. Monitor
Monitor, also called as VDU (Visual Display Unit) is the primary output device. It looks like a
Television and has similar purpose of displaying videos or output of programs. Monitors are built
using technologies like Cathode Ray Tube (CRT monitors - refer Glossary) and Thin Film
Transistor Liquid Crystal Display (TFT - LCD monitors - refer Glossary). We now generally
have these monitors or screens made of TFT-LCD.

Page 10
ASPIRE 2014 ( Introduction to Computer systems )

1.2.1.4. Memory Devices


These are the devices which store the information.
The term primary memory is used for the information in physical systems which functions at
high-speed. For example, it is capable of performing complex calculations and displaying the
results at the same time.
Secondary memory devices are physical devices for program and data storage which are slow to
access but offer higher memory capacity.
Primary memory stored on secondary memory is called virtual memory.
RAM (refer Figure 1.14, Glossary), and Computer cache (refer Glossary) are examples of
Primary memory storage. Magnetic tapes, Compact Disks (CDs), Digital Versatile Disks (DVDs
- refer Figure 1.15) are all examples of Secondary Memory Storage.

The memory is organized into memory cells each storing one binary bit (0 or 1). The memory
cells are grouped into words of fixed length, for example 1, 2, 4, 8, 16, 32, 64 or 128 bit. Each
Page 11
ASPIRE 2014 ( Introduction to Computer systems )

word in the memory can be accessed by a binary address (refer Glossary) of N bit, making it
possible to store 2 raised by N words.
1.2.1.5. Central Processing Unit
The Central Processing Unit (CPU) or the computer processor performs calculations, processes
information, stores data in memory and controls the flow of data. The conventional processors
are small in size and have all the circuits integrated on a single chip. Because of its small size,
the processor is also known as microprocessor. It is also called the Brain of computer.

A minimal hypothetical microprocessor might only include an arithmetic logic unit


(ALU) and a control logic section.

The ALU performs mathematical operations such as addition of two numbers, and logical
operations such as AND or OR (refer Glossary). Each operation of the ALU sets one or
more flags in a status register (a small memory within the CPU), which indicates the
result of the last operation.

The control logic section retrieves instruction codes from memory, and initiates the
sequence of operations that the ALU requires to carry out the instruction. It may happen
that a single operation code affects many registers (refer Glossary) at the same time. It is
like executing a flow chart (refer Glossary) and depending on the condition encountered
in the flow chart an appropriate decision will be taken and the flow will jump to some
other operation to be triggered in the ALU.

Garrett AiResearch's Central Air Data Computer (CADC) (1968), Texas Instruments (TI)
TMS 1000 (1971 September) and Intel's 4004 (1971 November) are the three projects
that delivered a microprocessor at about the same time.

We also have multi-core processors that have a single chip containing more than one
microprocessor. This effectively multiplies the processor's potential performance by the
number of cores (the independent actual central processing units).
Page 12

ASPIRE 2014 ( Introduction to Computer systems )

The first dual-core processors (microprocessors having two separate microprocessors on


single Integrated Chip - refer Figure 1.16) for personal computer were announced in
2005.

As of 2013, dual-core and quad-core processors (microprocessors having four separate


microprocessors on single Integrated Chip) are widely used in home PCs and laptops
while six, eight, ten, twelve and sixteen-core processors are common in the professional
and enterprise markets with workstations and servers (refer Glossary).

1.2.2. Software
Software is the non-material part of computer like data, programs, protocols etc. It is a
non-physical component that runs on your computer and can be changed by a set of programmed
instructions.
For example you watch a movie on a DVD using the DVD drive in your computer. Here the
DVD and DVD drive are both hardware, but the program in your computer that you use to watch
this movie is called software. Thus as movie is stored on a DVD, similarly there is a program
like Media Player stored on your computer to watch that movie. The application that you are
currently using to read this text is also a software.
Software can be categorized into three types as follows:

System Software

Utility Software

Application Software

1.2.2.1. System Software


It is the software used to manage and control the hardware components and which allow
interaction between the hardware and the other types of software (refer Figure 1.17). The most
obvious type of system software is the computer's operating system. We will see Operating
System in detail.

Page 13
ASPIRE 2014 ( Introduction to Computer systems )

All the programs and software run on computer using the main software The Operating
System. Some popular modern operating systems are Android, iOS, Unix, Linux, Mac OS X,
Microsoft Windows and IBM z/OS (refer Figure 1.18).

Operating system has various categories as listed below:

Real-time: Real-time operating systems often use specialized scheduling algorithms


(refer Glossary). The main objective of real-time operating systems is their quick and
predictable response to events. Their design is called event-driven or time-sharing design.
An event-driven design system switches between tasks based on their priorities or
external events while time-sharing operating systems switch tasks based on clock
interrupts.

Multi-user: A multi-user operating system allows multiple users to access a computer


system at the same time. Time-sharing systems or Internet servers are examples of
multi-user systems as they enable multiple-user access to a computer through the sharing
of time.

Multi-tasking: A multi-tasking operating system allows more than one program to run at
a given time. Multi-tasking can be of two types: pre-emptive and co-operative.

Page 14
ASPIRE 2014 ( Introduction to Computer systems )

Pre-emptive multitasking is the act of temporarily interrupting a task being


carried out by a computer system, with the intention of resuming the task at a later
time. Unix-like operating systems such as Solaris and Linux support pre-emptive
multitasking. For example, you are talking on a land line phone to someone and
the door bell rings. In this case you would keep the phone caller on hold and visit
the person on door and then come back and continue with the telephone call. It
shows here that the ringing of the door bell was a task having higher priority for
which you could suspend the current normal priority phone call.

Co-operative multitasking is achieved by relying on each process to give time to


the other processes in a defined manner. 16-bit versions of Microsoft Windows
(Microsoft Windows 1.0 to 3.0 and 9x versions which still support the older
windows versions. These systems usually hang or stop responding in case one
running program does not cooperate to yield the processor to some other program)
used cooperative multi-tasking. Mac OS versions before to OS X used to support
cooperative multitasking.

Single-tasking: A Single Tasking system has only one running program (refer
Glossary).The Palm OS for Palm handheld computers is an example of a single-user and
single-task operating system.

Distributed: A distributed operating system manages a group of independent computers


and makes them appear to be a single computer. The networked computers working as a
group in cooperation, make a distributed system.

Embedded: Embedded operating systems are designed to be used in embedded computer


systems. These are designed to operate on machines like PDAs with less autonomy. They
operate with a limited number of resources, are very compact and extremely efficient by
design. Minix 3 and Windows CE are examples of embedded operating systems

1.2.2.2. Utility Software


It is software such as anti-virus software like Norton and McAfee, or Microsoft Security
Essentials which help to maintain and protect the computer system but may not directly interface
with the hardware. Utilities like Winzip help to combine and compress data files so that they
occupy less memory and can be easily sent in mails.
1.2.2.3. Applications Software
Also known as apps, these are designed to allow the user of the system complete a specific task
or set of tasks. Apps include programs like web browsers, games and office software. They are
usually the reason you bought the computer system in the first place (refer Figure 1.19).
Page 15
ASPIRE 2014 ( Introduction to Computer systems )

1.2.3. Firmware
It is the combination of persistent memory (long term or permanent storage which is preserved
even when the power supply is unavailable), program code and the data stored in it.

It is software stored in hardware.

Examples include embedded systems like traffic lights and remote control.

Let us understand firmware using remote control. When you open a remote control you
see a set of circuits which along with the body of the remote control constitutes the
hardware part. Now you can move or switch channels using the remote control or you can
put a child lock for the same. Also you can use the swap button on the remote control to
go back to the previous viewed channel. So the remote control is able to remember which
is the most recent channel you viewed or your color preferences. This part constitutes the
software and data stored in your remote control.

Changing the firmware of a device may rarely or never be done during its lifetime. Some
firmware memory devices are permanently installed and cannot be changed at all.
Devices like printers, scanners, cameras and USB drives have firmware stored internally.

Page 16
ASPIRE 2014 ( Introduction to Computer systems )

Related Material/Video Links:

Hardware: http://nptel.ac.in/courses/106106092/3

Software: http://nptel.ac.in/courses/106106092/2

Firmware: http://nptel.ac.in/courses/108102045/

1.3. Computer Language


The term computer language includes a wide variety of languages used to communicate with
computers (refer Figure 1.21). Programming languages are a subset of computer languages. For
example, HTML is a markup language (refer Glossary) and a computer language, but it is not
considered as a programming language.
Machine code is a computer language. It is a sequence of binary digits (binary digits contain only
0 and 1) which instructs the computer to do the required task. It can technically be used for
programming (as for Altair BASIC), but a sequence of binary numbers can not be considered as
a programming language.
Programing language is a convention based set of instructions that you execute on the machine to
store or manipulate any information or to perform any logical operation.
Programing languages can be further categorized as follows:

Low Level Programing Languages: These languages are very close to the hardware.
They can be directly converted to machine code without any intermediate steps and hence
have faster execution. For example, Assembly language. C language can be used for low
level programing as it can directly interface with memory, hardware and the CPU. It can
also be used to create Operating Systems and because of its user-friendly programing
features, it can be considered as Middle Level Language also.

Page 17
ASPIRE 2014 ( Introduction to Computer systems )

High Level Programing Languages: They provide a very high level of abstraction from
the detail of memory management and may go through two stages of processing before
they can be understood and executed by the computer. These stages are called
Compilation and Interpretation (refer Glossary). They are easier and have more
user-friendly programing features. For example, Java, C++, C#.

Scripting Languages: These languages are directly interpreted or executed by other


programs or on-the fly and have a relatively simple syntax, easy to pick up and program
in. They are called scripting languages because they are used to write scripts or programs
that automate the execution of tasks which could alternatively be executed one-by-one by
a human operator. Scripting languages are very useful for web-based programing. For
example, Javascript, Perl.

Summary
A computer is a machine that executes a set of arithmetic or logical instructions and usually
provides a visual output. It has evolved from Charles Babbage's Difference Engine design to the
modern day Laptops and Tablets.
The different components of a computer are:
Hardware The tangible or physical parts of the computer.

Mouse The device used for pointing the target or double clicking a folder to open it.
Page 18

ASPIRE 2014 ( Introduction to Computer systems )

Keyboard The primary input device with all alphabets and numbers on it.

Screen The primary output device which is like the TV screen.

Memory devices store all the information and data.

Microprocessor or Central Processing Unit - the electronic brain of computer responsible


for all computation logic

Software It is the non-tangible part of a computer like programs and applications.

System Software It is the main software on the computer which enables execution of
other programs and software. For example - Operating System.

Utility Software Used as an add on or protection of computer from virus attacks. For
example - Anti-virus software.

Application Software Apps help in performing any task on the computer. For example Web browser for internet use

Firmware The embedded systems that store software and data inside the hardware as the
hardware's inseparable part.

Page 19
ASPIRE 2014 ( Introduction to Computer systems )

2.Computer Organization and Architecture


2.1. Organization of a Small Computer
Computer Technology after its evolution, has made incredible improvements. In early stage of
evolution, the computers were not able to store data, the size of the computer was very huge with
very less computational power.
Now a days, a personal computer has more computational power, more main memory, more disk
storage, is smaller in size and is available in affordable prices. The advances in technology
brought a rapid rate of improvement in building computers and innovation in computer design.
The model of a computer consists of four basic units (refer Figure 2.1). The basic units are :
I. Central Processing Unit (CPU)
II. Input Devices and Output Devices
III. Memory Unit

2.1.1. Central Processing Unit (CPU)


Central processing unit is also known as the brain of a computer. It is a hardware in a computer
that carries out the instructions of a computer program by performing the logical, arithmetical
and input/output operations of the system.
CPU consist of three basic blocks (refer Figure 2.2):
a. Arithmetic Logical Unit
b. Control Unit

Page 20
ASPIRE 2014 ( Introduction to Computer systems )

c.

Registers

2.1.1.a. Arithmetic Logic Unit (ALU)


ALU performs mathematical, logical and decision operations in a computer. After the processing
is done by ALU, the result is sent to the computer memory.
In some computer processors, ALU is divided into two distinct parts:
i.

Arithmetic Unit

ii.

Logical Unit

2.1.1.a.i. Arithmetic Unit (AU)


Arithmetic Unit performs arithmetic operations.

I.

The ALU has got two input parameters named as A and B and one output storage
parameter, named as C.

It performs the operation as: C = A op B (where op stands for operand which can be
either of the given operations)
Addition (C=A + B)

II. Subtraction (C=A - B)


Page 21
ASPIRE 2014 ( Introduction to Computer systems )

III. Multiplication (C = A * B)
IV. Division (C = A / B)
The input data are stored in parameters A and B, and according to the operation specified, the
ALU performs the operation and puts the result in parameter C.
2.1.1.a.ii. Logical Unit (LU)
Logical Unit performs the logical operations. ALU has three logical operands:
I. AND
II.

OR

III.

NOT

I. AND
The AND operator is represented by '&' and performs logical conjunction on two Boolean
expressions.

If both expressions are True, then 'AND' returns True.

If either or both expressions are False, then 'AND' returns False.

As shown in the given table (Figure 2.3) : C = A & B

where 0 means false and 1 means true.


C will be 0 when either of the value is 0 which is false.
C will be 1 when both the values are 1 which is true.
II. OR

Page 22
ASPIRE 2014 ( Introduction to Computer systems )

The OR operator represented by '|' performs logical disjunction on two Boolean expressions.

If either expression is True, 'OR' returns True.

If neither expression is True, 'OR' returns False.

As shown in the given table (Figure 2.4) : C = A | B

where 0 means false and 1 means true.


C will be 0 when both the values are 0 which means false.
C will be 1 when either of the value is 1 which means true.
III. NOT
The NOT operator is represented by '!' and performs the NOT operation on a single operand.

It checks the status of a current operand and reverses the value in the resultant operand.

If the value of an operand is true then it is reversed to false.

If the value of an operand is false then it is reversed to true.

As shown in the given table (Figure 2.5) : B = !A

where 0 represents false and 1 represents true.


B will be 1 if A is 0 i.e. true.
B will be 0 if A is 1 i.e. false.
Page 23
ASPIRE 2014 ( Introduction to Computer systems )

2.1.1.b. Control Unit (CU)


The Control Unit extracts instructions from memory, decodes and executes them and then sends
the necessary signals to the ALU to perform the operations required.
It is a circuitry that directs operations within the computer's processor by directing the input and
output of a computer system. The processor then controls how the rest of the computer operates
(giving directions to the other parts and systems). It works by gathering input through a series of
commands it receives from instructions in a running programs and then outputs those commands
into control signals that the computer and other hardware attached to the computer carry out. The
control unit basically controls the operations inside the CPU and helps in "directing traffic" in a
sense.

The control unit fetches instruction from main memory then decodes those instructions into
commands. ALU then executes those commands and it stores the result in main memory (refer
Figure 2.6).
2.1.1.c. Registers
Registers are contained within the central processing unit and holds the data involved in the
computation being performed. The size of the register determines the processing capabilities of
the CPU. The amount of information that can be held in a register at a time for processing is
known as Register Size. The larger the register size, the faster is the speed of processing.
Registers are the fastest and most costliest storage units in a computer. Computer instructions are
stored in consecutive memory locations and are executed sequentially one at a time.

Page 24
ASPIRE 2014 ( Introduction to Computer systems )

The control unit reads an instruction from a specific address in memory and executes it. It then
continues by reading the next instruction in sequence and executes it. In this type of instruction
sequencing, a counter is needed to calculate the address of the next instruction after execution of
the current instruction.
It is necessary to provide a register in the control unit for storing the instruction code after it is
read from memory. The computer needs processor registers (refer to Glossary) for manipulating
data and a register for holding memory address.
Registers Performs following operations:

Fetch - The Fetch operation is used for taking the instructions given by the user.

Decode - The Decode operation is used for interpreting the meaning of the instructions
fetched by registers. Decoding instructions mean - the CPU will find out which operation
is to be performed on the instructions.

Execute - The Execute operation is performed by the CPU and the results produced by
the CPU are then stored into the memory and after that they are displayed on the user
screen.

In the below given table (Figure 2.7), registers are listed with a brief description of their function
and the number of bits they contain.

The capacity of memory unit is 4096 words and each word contains 16 bits.

12 bits instruction word are needed to specify the address of an operand.

This leaves 3 bits for operation part of the instruction and a bit to specify a direct or
indirect address.

The data register (DR) holds the operand read from memory.
Page 25

ASPIRE 2014 ( Introduction to Computer systems )

The accumulator register (AC) is a general purpose processing register.

The instructions read from memory are placed in the instruction register (IR).

The temporary register (TR) is used for holding temporary data during the processing.

The input register (INPR) receives an 8-bit character from an input device.

The output register (OUTR) holds an 8-bit character for an output device.

A program counter (PC) is a register in a computer processor that contains the address of
the instruction being executed at current point of time. As each instruction is fetched, the
program counter increases its stored value by 1 and points to the next instruction in
sequence. When the computer is reset or restarts, the program counter normally reverts to
0.

An address register (AR) is a high-speed circuit that holds the addresses of data to be
processed or of the next instruction to be executed.

2.1.2. Input and Output Devices


Input and Output devices can be of three types
2.1.2.a. Input Unit/Devices
An input device is a hardware device that sends data to the computer.

Without input device, a computer would only be a display device and would not allow
users to interact with it.

With the help of input device, data from outside can be supplied to the computer.

Program or data is read into main storage using input device or secondary storage under
the control of CPU.

The below figure (refer Figure 2.8), is an example of input being sent from a keyboard to
the computer.

Page 26
ASPIRE 2014 ( Introduction to Computer systems )

Following are some of input devices:

Keyboard

Mouse, touchpad or any other pointing device

Barcode reader

Keyboard

Biometrics (e.g. fingerprint scanner)

Digital camera and Digital camcorder

Touch screen

Webcam

The drives such as CD-ROM, DVD are capable of sending information to computer, but they are
not input devices. These devices are considered as storage devices.
2.1.2.b. Output Unit/Devices
Any information that has been processed and comes from a computer is considered as an output.

When someone views the output, they're viewing it on an output device such as a
computer monitor or a hard copy print out.

The below figure (refer Figure 2.9), is an example of output being sent from the computer
to a printer.

Page 27
ASPIRE 2014 ( Introduction to Computer systems )

The computer results are provided to the user with the help of output unit, the results can
also be stored in storage device permanently for future use.

Output data from main storage is sent to output device under the control of CPU output
instructions.

Examples of output devices:


o

Printer

Monitor etc

2.1.2.c. Input/Output Devices


Also referred as IO device, it is a hardware device that accepts input information and has the
capability to output information as well. Examples of input/output devices are

Floppy diskette drive (refer Figure 2.10)

CD-ROM drives (refer Figure 2.11)

Modem (refer Figure 2.12)

USB thumb drives etc. (refer Figure 2.13)

Page 28
ASPIRE 2014 ( Introduction to Computer systems )

2.1.3. Memory
Memory unit is an essential component in any computer, needed to store the data and program.
CPU works with information stored in memory unit. It is also termed as primary memory or
main memory. A very small computer with a limited application may be able to fulfill its
intended task without the need of additional storage capacity. Most general purpose computer is
run more efficiently if it is equipped with additional storage beyond the capacity of main
memory.
There is just not enough in one memory unit to accommodate all the programs used in typical
computer, users accumulate and continue to accumulate large amounts of data processing
software. There, it is more economical to use low cost storage devices to serve as a backup for
storing the information that CPU is not using currently.
The unit that communicates directly with CPU is called the main memory. The most common
memory device used are magnetic disks and tapes, used for storing large data files, system
programs and other backup information. Only data currently needed by the processor reside in
main memory. Rest of the information is stored in auxiliary memory and transferred to main
memory when required.
Following are types of memories:
a. Main memory
i. RAM (Random Access Memory)
ii. ROM (Read Only Memory)
b. Auxiliary Memory
i. Magnetic Disks
ii. Magnetic tapes etc.
2.1.3.a. Main Memory
Page 29
ASPIRE 2014 ( Introduction to Computer systems )

The main memory is the central storage unit in a computer system. It is used to store programs
and data being used during computer operation. Following comes under Main Memory:

RAM (Random Access Memory): RAM, also known as volatile memory that loses its
contents when the computer or hardware device loses power.

ROM (Read Only Memory): ROM is used for storing programs that are permanently in
a computer and for tables of constants that do not change its value once the production of
computer is completed.

2.1.3.b. Auxiliary Memory


An Auxiliary Memory, also known as high-speed memory bank is used in mainframes and
supercomputers (refer to Glossary). The major difference between main memory and auxiliary
memory is that CPU directly access the main memory but the auxiliary memory is not accessed
by the CPU directly. For this the data is first transferred from auxiliary memory to main memory
and then from main memory the data is transferred to the CPU for further processing.
The most commonly used auxiliary memory devices in the computer systems are magnetic disks
and magnetic tapes. Following are auxiliary memories:
Magnetic Disk

A magnetic disk is a circular plate made up of metal or plastic, coated with magnetized
material.

Both the sides of the disk are used and several disks may be stacked on one spindle with
read/write heads available on each surface.

Bits are stored on magnetized surface in spots along concentric circles called tracks.

Tracks are divided into sections called sectors.

Disk that are attached and cannot be removed by occasional user are called Hard disk.

A disk drive with the removable disks are called floppy disks.

Magnetic Tapes

A magnetic tape is also known as Removable Media and consists of electric, mechanical
and electronic components to provide the parts and control mechanism for a magnetic

Page 30
ASPIRE 2014 ( Introduction to Computer systems )

tape unit. The major difference between magnetic disk and magnetic tape is that,
magnetic tapes support sequential access.

The tape is a plastic coated strip with a magnetic recording medium.

The Bits are recorded as magnetic spots on tape along several tracks.

Tracks are divided into sections called sectors.

Disk that are attached and cannot be removed by occasional user are called Hard disk.

A disk drive with the removable disks are called floppy disks.

2.2. Bus
A bus enables a computer processor to communicate with the memory or a video card.

The processor, main memory and Input/Output devices can be interconnected through
common data communication lines termed as common bus (refer Figure 2.14).

The primary function of common bus is to provide a communication path between


devices for transfer of data.

The bus includes control lines needed to support interrupts and arbitration.

Basically, all computers utilize two types of bus:


I.
Internal Bus: also known as local bus, enables communication between internal
components such as a computer video card and memory.
II. External Bus: also known as expansion bus, communicates with external components such
as a USB or SCSI device (refer to Glossary).
The bus lines which are used to transfer data are grouped into three categories:
I.

Data Bus

II.

Address Bus
Page 31

ASPIRE 2014 ( Introduction to Computer systems )

III.

Control Bus

Data Bus

Data bus is a computer subsystem that allows transferring of data from one component to
another on a motherboard or between two computers.

This includes transferring data to and from the memory or from the central processing
unit (CPU) to other components.

Address Bus

An address bus is used to specify a physical address.

When a processor or Direct memory access (DMA) enabled device needs to read or write
to a memory location, it specifies that memory location on the address bus.

Control Bus

A control bus is a part of a computer bus, used by CPUs for communicating with other
devices within the computer.

It carries commands from the CPU and returns status signals received from the devices.

2.3. Addressing Modes


Addressing modes are the ways how the address of an object/operand is being accessed.

In other words, 'The strategy to identify WHERE the operand is located.'


Page 32

ASPIRE 2014 ( Introduction to Computer systems )

In computer architecture every task user attempts to perform is converted into an


instruction (i.e Machine code) and that instruction consists of some operands to work on
it.

Ex: Consider this machine code ADD A , B here ADD is opcode and A, B are operands. This
means add A and B and store the result in A. Here A and B refers to some locations where the
numbers are actually stored. This is a kind of indirect addressing mode.
There are several types of addressing modes present. Each addressing mode has a unique
formula to locate the operand. Some of them are mentioned below :
I. Immediate Addressing Mode (refer Glossary).
II. Direct Addressing Mode (refer Glossary).
III. Indirect Addressing Mode (refer Glossary).
Summary
In this document, we have presented a brief overview of Computer organization and architecture.

Computer Architecture - refers to the relationship between different hardware


components of a computer system.

Computer Organization - refers to how operational attributes are linked together to


realize the architecture specifications.

We have covered basic units of a computer:

Central Processing Unit (CPU) - Controls the operation of the computer and performs
its data processing functions.
o Arithmetic Logic Unit (ALU) - It performs computers data processing
functions.
o

Control Unit(CU) - It performs computers data processing functions.

Registers - Registers provide internal storage to the CPU.

Input Unit/Devices - They provide input to the CPU.

Output Unit/Devices - They provide output from CPU to the user.

Memory Unit - Memory Unit is needed to store the data and program.
Page 33

ASPIRE 2014 ( Introduction to Computer systems )

Bus - It consists of set of wires that allow data to be passed back and forth.

Addressing Mode - Addressing modes are the ways how the address of an
object/operand is being accessed.

Page 34
ASPIRE 2014 ( Introduction to Computer systems )

3.Systems Software
3.1. Assembler
Introduction
System software refers to the files and programs that make up the computer's operating system.
System files consist of libraries of functions, system services, drivers for printers, other
hardware, system preferences and various configuration files.
System Software consists of the following programs:

Assemblers

Compilers

File Management Tools

System Utilities

Debuggers

The system software is installed on the computer when the operating system is installed. The
software can be updated by running programs such as "Windows Update" for Windows or
"Software Update" for Mac OS X. Application programs are used by end user, whereas system
software is not meant to be run by the end user. For example, while Web browser like Internet
Explorer are used by users every day, they don't have to use an assembler program (unless the
user is a computer programmer).
System software runs at the most basic level of the computer and hence it is called "low-level"
software. User interface is generated by the system software and allows the operating system to
interact with the hardware.
System software is the interface between the computer hardware and the application software.

Page 35
ASPIRE 2014 ( Introduction to Computer systems )

Assembler
An assembler is a program that converts basic computer instructions into a pattern of bits. These
bits are used by computer's processor to perform its basic operations. Some people call these
instructions as assembler language and others use the term assembly language. This is how it
works:
Most computers come with a specified set of very basic instructions that corresponds to the basic
machine operations that the computer can perform. For example, a "Load" instruction moves a
string of bits from a location in the processor's memory to a special holding place called a
register. In computer architecture, a processor register is a small amount of storage available on
the CPU and the contents of register can be accessed more quickly. Most of the modern
computer architectures operate on the principle of shifting data from main memory into registers,
operate on the data and then move the result back into main memory. Assuming the processor
has at least eight numbered registers, the following instruction would move the value (string of
bits of a certain length) at memory location 2000 into the holding place called register 8:
L 8,2000

The programmer can write a program using a sequence of assembler instructions.

These assembler instructions, which are also known as the source code or source
program, is then specified to the assembler program when it is started.
Page 36

ASPIRE 2014 ( Introduction to Computer systems )

Each program statement in the source program is taken by the assembler program and a
corresponding bit stream or pattern (a series of 0's and 1's of a given length) is generated.

The output of the assembler program is called the object code or object program relative
to the input source program. The object program consisting of a sequence of 0's and 1's is
also known as machine code.

This object program can be run (or executed) whenever required.

3.2. Assembly Language


The native language of the computer is assembly language. The processor of the computer
understands machine code (consisting of 1s and 0s). In order to write the machine code program,
it has to be first written in assembly language and then an assembler is used to convert the
assembly language program into machine code.
Assembly language program consists of mnemonic codes which are easy to remember as they
are similar to words in English language. It consists of mnemonic codes for each of the different
machine code instructions that the machine understands. A mnemonic is an abbreviation of the
actual instruction. It is a programming code that is easy to remember because the codes resemble
the original words, for example, ADD for addition and SUB for subtraction. Examples of
assembly language program:
MOV EAX,2 ; set eax register to 2 (eax = 2)
SHL EAX,4 : shift left value in the register
MOV ECX,16 ; set ecx register to 16
SUB EAX,EBX ; substracts ecx from eax
An assembler converts this set of instructions into a series of 1s and 0s, also known as a
executable program, that the machine can understand.
Page 37
ASPIRE 2014 ( Introduction to Computer systems )

Advantages of Assembly language

Assembly language can be optimized extremely well as it is an extremely low level


language. Therefore assembly language is used in application which require utmost
performance.

Assembly language can be used for communication with the machine at the hardware
level and hence it is often used for writing device drivers.

Another advantage of assembly language is the size of the resulting programs. Since
conversion from a higher level by a compiler is not required, the resulting programs can
be exceedingly small.

3.2.1. Assembly Language Programming


The assembler is a program which converts the assembly language source program into a format
that can be run on the processor. The machine code instruction containing binary or hex value is
replaced by a mnemonic.
Example

Advantages of using mnemonics are:

Mnemonics are easy to understand than hex or binary values.

Its less likely to make an error.

Mnemonics are easy to remember.

Assembly language statements are written one on each line. A machine code program consists of
a sequence of assembly language statements in which each statement contains a mnemonic. A
line of an assembly language program can contain the following four fields:
i. Label
Page 38
ASPIRE 2014 ( Introduction to Computer systems )

ii. Opcode
iii. Operand
iv. Comments
The label field is optional. A label is an identifier or a text. Labels are used in programs to reduce
reliance upon programmers remembering where data or code is located.A label is used to refer to
the following:

Memory location

A data value

The address of a program or a sub-routine or a portion of code.

The maximum length of a label differs for different types of assemblers. Some assemblers accept
up to 32 characters long, others only four characters. When a label is declared, it is suffixed by a
colon, and begins with a valid character (A..Z). Consider the following example.
LOOP: LDAA #24H
Here, the label LOOP is equal to the address of the instruction LDAA #24H. The label can be
used as a reference in a program, as shown below
JMP LOOP
When the above instruction is executed, the processor will execute the instruction associated
with the label LOOP, i.e.LDAA #24H. When a label is referenced later in a program, it is
referenced without the colon suffix.
An advantage of using labels is that inserting or re-arranging code statements do not require
re-working actual machine instructions. It only requires a simple re-assembly. In hand-coding,
changes can take hours to perform.
The opcode field consists of a mnemonic. Opcode is the operation code, ie, a machine code
instruction. Opcode may also have additional information in the form of operands Operands are
separated from the opcode by using a space.
Operands consists of additional information or data that the opcode requires. Operands are used
to specify

Page 39
ASPIRE 2014 ( Introduction to Computer systems )

Constants or labels

Immediate data

Data present in another accumulator or register

An address

Examples of operands
LDAA 0100H ; two byte operand
LDAA LOOP ; label operand
LDAA #1 ; immediate operand (i.e constant value as operand)
The comment field is optional, and is used by the programmer to explain how the coded program
works. The comments are prefixed by a semi-colon. Comments are ignored by the assembler
when the instructions are generated from the source file.
Related Material/Video Links:
http://www.onlinevideolecture.com/electronics-engineering/nptel-iit-kharagpur/microprocessorsand-microcontrollers/index.php?course_id=385&lecture_no=8
http://www.onlinevideolecture.com/electronics-engineering/nptel-iit-kharagpur/microprocessorsand-microcontrollers/index.php?course_id=385&lecture_no=9

3.3. Loaders and Linkers


In a computer operating system , a loader is a component that locates a program (which can be
an application or a part of the operating system itself) in an offline storage (for eg. hard disk ),
loads it into main storage (also called random access memory), and gives that program control of
the computer (i.e. allows it to execute its instructions).
A program that is loaded may itself contain components that are not initially loaded into main
storage, but are loaded if and when their logic is required. In a multitasking operating system, a
program that is known as a dispatcher juggles the computer processor's time among different
tasks and calls the loader when a program associated with a task is not already in the main
storage. (Program here, means a binary file that is the result of a programming language
compilation or linkage editing or some other program preparation process).

Page 40
ASPIRE 2014 ( Introduction to Computer systems )

A linker, also known as link editor is a computer program that takes one or more object files
generated by a compiler and combines them into a single executable program.
Computer programs comprise several parts or modules but all these parts/modules need not be
contained within a single object file. In such case they refer to each other by means of symbols.
An object file can have three kinds of symbols:

Defined symbols, which is called by other modules

Undefined symbols, which call the other modules where the symbols are defined.

Local symbols which are used internally within the object file to facilitate relocation.

For most compilers, each object file is the result of compiling one input source code file. If a
program comprises multiple object files, then the linker combines these files into a unified
executable program by resolving the symbols as it goes along.
Linkers can take objects from a collection called a runtime library. A runtime library is a
collection of object files which will contain machine code for any external function used by the
program file which in turn is used by the linker. This machine code is copied by the linker into
the final executable output. Some linkers do not include the entire library in the output, they only
include the symbols that are referenced from other object files or libraries. The libraries exist for
diverse purposes. The system libraries are usually linked in by default.
The linker also arranges the objects in a program's address space. This involves relocating code
that assumes a specific base address to another base address. Since a compiler seldom knows
where an object will reside, it assumes a fixed base location (for example, zero). The relocation
of machine code may involve re-targeting of loads, stores and absolute jumps.
The executable output by the linker may need another relocation pass when it is finally loaded
into memory (just before the execution). This relocation pass is usually omitted on hardware
offering virtual memory in which every program is put into its own address space and so there is
no conflict even if all programs load at the same base address. This relocation pass may also be
omitted if the executable is a position independent executable.

Page 41
ASPIRE 2014 ( Introduction to Computer systems )

3.4. Compilers
A compiler is a special program that processes statements written in a particular programming
language and turns them into machine language or code that a computer's processor uses. A
programmer writes language statements in a language such as Pascal or C one line at a time
using an editor. The file created contains the source statements or source code. The programmer
then runs the appropriate compiler for the language, specifying the name of the file that contains
the source statements.
When executing (running), the compiler first parses (or analyzes) the language statements
syntactically one after the other and then builds the output code in one or more successive stages
or "passes" and makes sure that statements that refer to other statements are referred in the final
code correctly. The output of the compilation is called object code or sometimes an object
module. The object code is machine code that the processor can execute, one instruction at a
time.
The Basic Structure of a Compiler
In the five stages of a compiler, the high level language is translated to a low level language
which is generally closer to that of the target computer. Each stage of the compiler fulfills a
single task and has one or more classic techniques for implementation. The following are the five
stages of a compiler:

Lexical Analyzer: Analyzes the source code, removes "white space" and comments,
formats it for easy access by creating tokens, then tags language elements with type
information and begins to fill the information in the SYMBOL TABLE. The Symbol
Page 42

ASPIRE 2014 ( Introduction to Computer systems )

Table is a data structure that contains information about symbols and groups of symbols
in the program being translated.

Syntactic Analyzer: Analyzes the tokenized code for structure, groups symbols into
syntactic groups, tags groups with type information.

Semantic Analyzer: Analyzes the parsed code for meaning, fills in assumed or any
missing information and tags the groups with the meaning.

Code Generator: Linearizes the qualified code and produces the object code.

Optimizer: Checks the object code to determine whether there are more efficient means
of execution.

3.5. Interpreters
Interpreter is a program that executes instructions written in a high-level language. There are two
methods to run programs written in a high-level language. The most common method is to
compile the program and the other method is to pass the program through an interpreter.
An interpreter translates high-level instructions into an intermediate form and then executes it. In
contrast to the above method, a compiler translates high-level instructions directly into machine
language. The compiled programs generally run faster than interpreted programs. One of the
Page 43
ASPIRE 2014 ( Introduction to Computer systems )

advantage of using an interpreter is that it does not need to go through the compilation stage
during which machine instructions are generated. This process of compilation can be
time-consuming if the program is very long. The interpreter, on the other hand, immediately
execute high-level programs. Hence interpreters are sometimes used during the development of a
program in which the programmer wants to add small sections at a time and test them quickly. In
addition to this, interpreters are often used in education because they allow students to program
interactively.

Advantages of using interpreter

Execution is done in a single stage.

Compilation stage is not required.

Alteration of code is possible during runtime.

Really useful for debugging the codes.

Helps in interactive code development.

Interpreter vs Compiler

The primary difference between a compiler and interpreter is the way in which a program
is executed. The compiler converts the source code to machine code and then saves it as
an object code before creating an executable file for the same. The compiled program is
executed directly using the machine code or the object code. But an interpreter does not
convert the source code to an object code before execution.

An interpreter executes the source code, line by line and conversion to native code is
performed line by line while execution is going on (at runtime). Hence the run time
required for an interpreted program will be high compared to a compiled program.

Even though the run time required for interpreted program is more, the execution using
an interpreter has its own advantages. For example interpreted programs can modify
themselves at runtime by adding or changing functions. Compiled program has to be
recompiled fully even for the small modifications done in the program. But in the case of
an interpreter there is no such problem (only the modified section needs to be recompiled
- refer Figure 3.6).

Page 44
ASPIRE 2014 ( Introduction to Computer systems )

Page 45
ASPIRE 2014 ( Introduction to Computer systems )

4.Introduction to Operating System


4.1. Basic Resources Managed by Operating Systems
Introduction
Operating system is a collection of programs. It is a software that supports computer's basic
functions. It acts as an interface between applications and computer hardware as shown below in
the figure 4.1. Examples of operating systems are Windows, Linux, MacOS, etc.

Operating system also does the task of managing computer hardware. Operating system manages
hardware by creating a uniform set of functions or operations that can be performed on various
classes of devices (for instance read x bytes at address y from hard drive of any type, where x is
the number of bytes read). These general functions rely on a layer of drivers that provide specific
means to carry out operations on specific hardware. Drivers usually are provided by the
manufacturers, but the OS must also provide a way to load and use drivers. OS must detect the
device and select an appropriate driver if several of them are available.
In the figure 4.2 below, OS interface is a set of commands or actions that an operating system
can perform and a way for a program or person to activate them.
Operating system is the core software component of a computer. It performs many functions and
acts as an interface between computer and the outside world. A computer consists of several
components including monitor, keyboard, mouse and other parts. Operating system provides an
interface to these parts through 'drivers'. This is why, when sometimes we install a new printer or
other piece of hardware, our system will ask us to install more software called driver. A brief on
device drivers is given in section 4.2.4, Device Management.

Page 46
ASPIRE 2014 ( Introduction to Computer systems )

Operating system basically manages all internal components of a computer. It was developed to
better use the computer system.

4.1. Basic Resources Managed By Operating System


Following are the basic resources that are managed by operating system:

Memory space (Memory management)

CPU time (Process management)

Disk space (File system management)

Input-output device (Device management)

4.1.a. Basics Of Memory Management


Any program needs to be loaded in memory (RAM) before it can actually execute. Random
Access Memory (RAM) is a type of computer memory that can be accessed randomly, i.e. any
byte of memory can be accessed without touching or traversing through the preceding bytes.
Page 47
ASPIRE 2014 ( Introduction to Computer systems )

These days, RAM is available with various storage capabilities (256MB, 512MB, 1GB, 2GB,
4GB, 6GB and 8GB sizes).
Memory management deals with managing computer's primary memory. It decides the amount
of memory to be allocated to a particular program. It also keeps track of free or unallocated as
well as allocated memory. Memory management applies only to RAM.
The sole motto of memory management done by operating system is to utilize the available
memory effectively. In this process we should try to minimize fragmentation.
i. Fragmentation
Fragmentation occurs when there are many free small blocks in memory that are too small to
satisfy any request. In computer storage, fragmentation is a phenomenon in which storage space
is used inefficiently, resulting in reduced capacity as well as performance. Fragmentation also
leads to wastage of storage space. The term also refers to the wasted space itself.
There are three different types of fragmentation:

External fragmentation

Internal fragmentation

Data fragmentation

It can be present in isolation or conjunction. When a computer program is finished with a


partition, it can put the partition back to the computer. The size and amount of time for which a
partition is held by a program varies. During its life span, a computer program can request and
free many partitions of memory.
When a program starts, there are long and contiguous free memory areas. Over the time and with
use, these long contiguous regions become fragmented into smaller contiguous areas. Eventually,
it may become impossible for the program to request large partitions of memory.
Internal Fragmentation
Internal fragmentation is the space wasted inside the allocated memory block because of the
restriction on allowed sizes of allocated blocks. Allocated memory can be slightly larger than
requested memory. The size difference is the memory internal to partition but would not be used.
Internal fragmentation is difficult to reclaim. Design change is the best way to remove internal
fragmentation. For example, in dynamic memory allocation, memory pools cut internal
fragmentation by spreading the space overhead over a larger number of objects.
Page 48
ASPIRE 2014 ( Introduction to Computer systems )

External Fragmentation
External fragmentation happens when a dynamic memory allocation algorithm allocates some
memory and a small piece is left over which cannot be used effectively. The amount of usable
memory reduces drastically, if too much external fragmentation occurs. The total memory space
available is enough to satisfy a request but is not contiguous and so, is wasted. Here the jargon
'external' is used to depict that the storage that is further unusable is outside the allocated regions.
For example, consider a situation wherein a program allocates three continuous blocks of
memory and then frees the middle one. The memory allocator can use this free block of memory
for future allocations. However, this free block cannot be used for allocation if the memory to be
allocated is larger in size than the free block. External fragmentation also occurs in file systems
as many files of different sizes are created, size changed and deleted. The effect is even worse if
a file which is divided into many small pieces is deleted, because this leaves almost equal small
regions of free space.
Data Fragmentation
Data fragmentation occurs when a collection of data in memory is broken up into many pieces
that are not close enough. It is typically the result of attempting to insert a large object into
storage that has already suffered external fragmentation.
ii. Memory Management Techniques

Single Contiguous Allocation

Partitioned Memory Management Scheme (refer Glossary for scheme definition)

Paged Memory Management

Segmented Memory Management

Single Contiguous Allocation


Single Contiguous Allocation is the simplest form of memory management. In this type of
memory management, all memory (with an exception of small portion reserved for running the
operating system) is available for a single program to run. So only one program is loaded in all
available memory and so generally the rest of memory is wasted. Simplest example of this type
of memory management is MS-DOS. Advantage of single contiguous memory allocation is, it
supports fast sequential and direct access. Provides good performance and the number of disk
seek required is minimal. Disadvantage of single contiguous memory allocation is fragmentation.

Page 49
ASPIRE 2014 ( Introduction to Computer systems )

Partitioned Memory Management Scheme


This type of memory management divides primary memory into multiple memory partitions,
usually contiguous areas of memory. Memory management here consists of allocating a partition
to a job or program when it starts and unallocating it, when job or program ends. A typical
scenario of partitioned memory management is depicted in the figure 4.4 below. This type of
memory management also needs some hardware support.
The figure 4.4 below shows multiple memory partitions. Each partition runs a process (Refer
Glossary). Process 1, Process 2, etc. are the processes allocated to a particular partition in
memory. Once the process is completed, partition gets empty. A is the base register address. Base
register contains the lowest memory address a process may refer to. We can get length of a
partition from Bounds register. Bounds register stores upper and lower bounds on addresses in a
time sharing environment. Time sharing environment refers to concurrent use of computer by
more than one user users share the computers time. Time sharing is the term used
synonymously with multi-user.

Page 50
ASPIRE 2014 ( Introduction to Computer systems )

Partitioned memory management is further divided in to 2 types of partitioning schemes:

Fixed memory partitioning (Static partitioning)

Main memory is divided into a number of static partitions when a computer system starts. A
process may be loaded into a partition of equal or greater size. Advantage of such type of
partitioning is that it is simple to implement and has a little operating system overhead.
Disadvantages are inefficient use of memory due to internal fragmentation. Also maximum
number of active processes is fixed.

Variable memory partitioning (Dynamic partitioning)

Such partitions are created dynamically so that each process is loaded into a partition of exactly
the same size as that process. Advantage of such type of partitioning is that there is no internal
fragmentation. Also main memory is used more efficiently. Disadvantage is inefficient use of
processor due to the need for compaction to counter external fragmentation.
Paged Memory Management
This type of memory management divides computer's primary memory into fixed-size units
known as page frames. The program's address space is divided into pages of the same size.
Usually with this type of memory management, each job runs in its own address space.
Advantage of paged memory management is that there is no external fragmentation. But on the
contrary there is a small amount of internal fragmentation.
Below is the Illustration representing paged memory management. It depicts how logical pages
address in memory can be mapped to physical address. The operating system uses base address
as a measure to find addresses. Base address means starting address of a particular memory
block. According to the program written, CPU generates address. In this case, address generated
by CPU is called logical address. This address is added to base address so that it forms physical
address. To translate a logical address into corresponding physical address, we need to divide the
logical address into page number and offset. Offset refers to a value being added to base address
to produce a second address.
For example, if B represents address 200, then the expressions, B+10 would signify the address
210. 10 in expression is the offset. To specify addresses using an offset is called relative
addressing because the resulting address is relative to some other point. Offset is also known as
displacement. In figure below, p represents page number and d is the offset. We use page number
as index to page table and the entry gives corresponding frame number. 'f' in page table
represents frame number. Frame number is concatenated with the offset to get a corresponding
physical address.
Page 51
ASPIRE 2014 ( Introduction to Computer systems )

Segmented Memory Management


Segmented memory means, the division of computer's primary memory into segments or
sections as shown in figure 4.6. In this type of memory management, there is reference to a
memory location that includes a value . This value identifies a segment and an offset within that
segment. We may create different segments for different program modules, or for different types
of memory usage such as code and data segments. Certain memory segments may even be shared
between programs. Segmented memory does not provide user's program with a linear and
contiguous (or continuous) address space. Linear address space is a memory addressing scheme
used in processors where the whole memory can be accessed using a single address that fits in a
single address or instruction.
Segments are areas of memory that usually correspond to a logical grouping of information such
as code procedure or a data array (Refer Glossary). Segmentation allows better access protection
than other memory management schemes because memory references are relative to a specific
segment and hardware will not permit the application to reference memory not defined for that
segment. It is possible to implement segmentation with or without paging.
Segmentation With Paging has the following advantages
1. Paging eliminates external fragmentation. As a result it provides efficient use of main
memory.
2. Segmentation which is visible to the programmer, includes strength of paging. It has the
ability to handle growing data structures, support for sharing, and modularity, and protection.
Page 52
ASPIRE 2014 ( Introduction to Computer systems )

To combine fragmentation and paging, a user's address space is broken into a number of
segments. Each of these segments in turn is broken into fixed-size pages. If size of a segment is
less than a page in length, then the segment occupies just one page.

4.1.b. Process Management


CPU has multiple processes running at a time. CPU always has certain programs scheduled in a
queue waiting for their turn to execute. These all programs must be scheduled by operating
system.
Operating system must allocate resources to processes, enable processes to exchange and share
information, enable synchronization among processes, and protect resources of each process
from other processes. Synchronization means the coordination of events or processes so that a
system operates in unison.
Process creation involves four principle events:

System initialization or start up. When an OS is booted, typically several processes are
created.

A process is run to execute a process creation system call. Most of the times, a running
process will issue system calls to create one or more new processes to help it do its job.
Creation of new processes is useful when the work to be done can be easily formulated as
several related, but otherwise independent interacting processes.

Request to create a new process is issued by user. In interactive systems, users can start a
program by clicking or double clicking the icons or thumbnails or even by typing a
command on command prompt.

Page 53
ASPIRE 2014 ( Introduction to Computer systems )

Batch job initiation. Users can submit batch jobs to the system (most of the times,
remotely). When OS knows that it has the resources to run another job, a new process is
created and the next job is run from the input queue.

Several processes are created when an operating system boots. Some of them are foreground
processes while others are the background processes. Foreground processes interact with a user
and perform work for users. In multiprocessing environment, the process that accepts input from
the keyboard or other input device at a particular point in time is at times called the foreground
process. This means that any process that actively interacts with user is a foreground process.
Background processes are the processes which are not associated with a particular user, but
instead have some specific function to be performed. For example email notification is an
example of background processes. System clock displayed at the bottom right corner of status
bar in windows is another example of background process.
Some of the common reasons for process termination are:

User logs off

A service request to terminate is executed by process

Error and fault conditions

Normal completion

Time limit exceeded

Memory unavailable

I/O failure

Fatal error, etc.

Figure 4.7 below contains great deal of information.

Let us consider a running process 'P' that issues an input-output request


o The process blocks.
o

Thereafter, at certain point of time later, a disk interrupt occurs and the driver
detects that P's request is satisfied.

P is unblocked, i.e. the state of process P is changed from blocked to ready.

Page 54
ASPIRE 2014 ( Introduction to Computer systems )

Later, at some point of time, the operating system looks for a ready job to run and
picks the process/job P from the queue.

A preemptive scheduler in figure 4.7 below has the dotted line 'Preempt'; where as a nonpreemptive scheduler doesn't.

The number of processes change for two arcs namely, create and terminate.

Suspend and resume are a part of medium term scheduling


o

It is done on a bit longer time scale.

It involves memory management as well.

It is also known as two level scheduling.

There are 2 types of scheduling:


1. Preemptive scheduling:
In a computer, tasks are assigned priorities. At times it is necessary to run a certain task that has
high priority before another task (even if the task is in running state). Therefore, the running task
is interrupted for some time, put to either blocked or suspended state and resumed later, when the
priority task has finished its execution. This process is called preemptive scheduling.
2. Non preemptive scheduling:
In non-preemptive scheduling, a running task executes till it completes fully. It cannot be
interrupted. That means when a process enters the running state, it cannot be deleted from the
scheduler until it finishes its service time.

Page 55
ASPIRE 2014 ( Introduction to Computer systems )

The figure 4.7 above shows various states of a process. Initially the process is created. Once
created, it goes to the ready state. Ready state means the process is ready to execute. It has been
loaded into the main memory and is waiting for execution on a CPU. There can be many ready
processes waiting for execution at a given point of time. A queue of processes which are ready to
execute gets created in memory. One of the processes from that queue is picked up for execution
and its state gets changed to running. A running process can be blocked. Blocked state means a
process is blocked on some event.
A process may be blocked due to various reasons such as when a particular process has
exhausted, the CPU time allocated to it, it is waiting for an event to occur. Blocked process can
either move to ready state or can move to suspended state. In systems that support virtual
memory, a process may be swapped out, that is, it would be removed from main memory and
would be placed in virtual memory by the mid-term scheduler. This is called suspended state of a
process. From here the process may be swapped back in to the ready state. Such state is called
ready suspended state. Process that are blocked may also be swapped out. Such a state of process
where a process is both swapped out and blocked is called blocked suspended state. Suspended
processes can be sent back to ready state only once they are released. This cycle continues till a
process finishes its execution i.e. terminated. A process may be terminated from the running state
by completing its execution or can be killed explicitly. In either of these cases, we say that the
process is terminated.
4.1.c. File System Management

Page 56
ASPIRE 2014 ( Introduction to Computer systems )

Computer contains numerous files. They need to be organized in a proper way so that we can
keep track of those files. File retrieval should be easier as well as faster. File system management
helps us achieve this.
File system manager is used by the operating system to do file system management. File system
manager organizes and keeps track of all the files and directories on secondary storage media.

Figure 4.8 above shows a typical hierarchical file system structure. Operating system keeps track
of following tasks for providing efficient file management:

It is able to identify numerous files by giving unique names to them.

It maintains a list to keep track of exact file location.

Provide fast and simple algorithms to write and read files in co-operation with device
manager.

Grant and deny access rights on files to programs and users.

Allocate and de-allocate files so that files can be processed in co-operation with process
manager.

Provide programs and users with simple commands for handling files.

On storage medium, file gets saved in blocks or sectors. To access these files, file manager and
device manager works together. The device manager knows where to find each sector on disk,
but only file manager has a list telling in what sectors either file is stored. This list is called File
Page 57
ASPIRE 2014 ( Introduction to Computer systems )

Allocation Table (FAT). FAT has been in use under DOS for a long time. Some of its alterations
are still used by Win95 and Win98.
Below are the different ways of allocating files:

Contiguous file allocation:

In this type of file allocation, at the time of file creation, a single set of blocks is allocated to a
file. Each file is stored contiguously in sectors, one sector after another. The advantage is that the
File Allocation Table has a single entry for each file, indicating the start sector, the length, and
the name. Moreover, it is also easy to get a single block because its address can be easily
calculated. The disadvantage may be that it can be difficult to get a sufficiently large block of
contiguous blocks. Contiguous file allocation is now a days only used for tapes and recordable
CDs.

Non-contiguous file allocation:

With this type of allocation, all blocks of a file can be distributed all over the storage medium.
The File Allocation Table (FAT) lists not only all files, but also has an entry for each sector the
file occupies. As all information is stored in the FAT, and there is no assumption on the
distribution of the file, this method of allocation, at times, is also known as FAT.
The advantage is that it is very easy to get a single block, because each block has its entry in the
FAT. Also, it is a very simple allocation method where no overhead is produced and no search
method for free blocks is needed. The disadvantage is that FAT can grow to an enormous size,
which can slow down the system. Compaction would be needed time to time. This type of file
allocation is used for disk allocation in MS-DOS.

Chained allocation:

With chained file allocation only the first block of file gets an entry in the FAT. A block has
sectors in it. Of these, the first sector has got data as well as a pointer at its end that points to the
next sector to be accessed after it (or indicates that it was the last). That means each sector (if it is
not a last sector) has got a pointer at its end pointing to the next sector that should be accessed.
The advantage again is that the FAT has a single entry for each file, indicating position of the
first sector and file name. There is no need to store the files contiguously.
The disadvantage of chained allocation is that it takes much time to retrieve a single block
because that information is neither stored anywhere nor can it be calculated. If we want to access
a particular sector, all preceding sectors have to be read in order one after another. This way, the
information about location of the next block is identified. Unix i-node is an example of this type
Page 58
ASPIRE 2014 ( Introduction to Computer systems )

of allocation. i-nodes are data structures (Refer Glossary) of a file system used to store all the
important properties of each file: owner's group id and user id, access permission on that file,
size of the file and more. Unix i-node is an operating system which has i-nodes as its data
structure.

Indexed allocation:

With indexed file allocation also only the first block of file gets an entry in the FAT. In the first
sector, no data is stored. It has only pointers to where the file is on storage medium. That is why
the first block is known as the index block. It just contains the pointers or index to file location
on a storage medium. Here also the FAT will only contain a single entry for each file, indicating
file name and position of the first sector. It is easy to retrieve a single block because the
information about its location is stored in the first block.
The disadvantage of indexed allocation is that for each file an additional sector is needed to keep
track of the location of a file. A very small file also always occupies at least two blocks, where as
the data could have easily fit in one block. This results in secondary storage space wastage.
Indexed allocation is implemented in all UNIX systems. It is reliable as well as fast. Also,
now-a-days, the wastage of storage space does not matter much.
The main concern of file system management is to provide a strategy that lets the FAT not to
grow too large and that makes it possible to retrieve a special sector of file such that the storage
space is not wasted much.
4.1.d. Device Management
Operating system also deals with device management, specially input and output devices. In a
multi-user system, there are shared devices like printer, scanner, etc. Management of these
devices by sending them appropriate commands is the major task of operating system.A software
routine which knows how to deal with each device is called a driver and operating system
requires drivers for the peripherals attached to computer. When a new peripheral is added, device
driver is installed in to the operating system.Operating system also deals with the access time of
these devices. It helps make the device access fast and in the most efficient way possible.Major
concern of operating system in device management is to prevent dead lock situation.
Dead Lock

Page 59
ASPIRE 2014 ( Introduction to Computer systems )

Above diagram depicts a typical dead lock situation, that serially used devices can have. Dead
lock is a situation where each set of processes is waiting for an event that only other process in
the set can cause.
For example, in the above diagram, Process Task 1 requests a mutex or lock on object which is
already held by Process Task 2. In turn, Process Task 2 needs a resource to complete its process
which is already held by Process Task 1. So neither of the processes are releasing their resources
or mutex and waiting for another process to release a mutex so that they can get it to complete its
pending task. This situation would cause an indefinite wait for processes leading to a situation
known as dead lock.
Mutex is the short form for Mutual Exclusion Object. A mutex is a logical unit. It is a program
object that allows multiple program threads to share the same resource, but not simultaneously.
File access is an example of mutex. A mutex with unique name is created when the program
starts. Mutex must be locked by a thread that needs the resource. When data is no longer needed,
the mutex is set to unlock.
OS helps in dealing with dead lock situation up to a certain extent. Below are some of the
strategies for dealing with deadlock:

Ostrich algorithm, i.e. ignoring the problem altogether. Ostrich algorithm is a strategy of
ignoring potential problems on the basis that they may be exceedingly rare. Ostrich
algorithm assumes that ignoring the problem would be more cost-effective as compared
to allowing the problem to occur and then attempt for its prevention. It may occur very
infrequently. This can be followed if cost of detection/prevention is not worth the time
and cost spent.

Detection and Recovery.

Avoiding deadlock by careful resource allocation.

Page 60
ASPIRE 2014 ( Introduction to Computer systems )

Prevention of deadlock by structurally negating one of the four necessary conditions.

4.2. Resource Sharing Management


The primary task of operating system as discussed above is to keep track of resources like
memory, CPU utilization, storage device, and input output devices, to grant resource requests, to
mediate conflicting requests from different programs, etc.

4.2.1. Multiplexing
Multiplexing is a method by which multiple analog data signals/digital data streams are
combined into one signal over a shared medium. Multiplexing is used to share an expensive
resource and thus help reduce the cost.
Communication channel is used for transmission of a multiplexed signal. This channel may be a
physical transmission medium. Multiplexing basically works on the principle of division of
signals. It divides the capacity of the high level communication channel into several low level
logical channels. Each of these low level logical channel maps to each message signal or data
stream to be transferred. A reverse of this process is known as demultiplexing. Demultiplexing
can extract the original channels or signals on the receiver side.
A device that performs the task of multiplexing is called a multiplexer (MUX), and a device that
performs the task of demultiplexing is known as a demultiplexer (DEMUX).
Resource management basically includes multiplexing the resources in two ways:
Time Multiplexing
When a particular resource is time multiplexed, different programs or users get their turn to use
that resource one after another. Turns for resource usage are decided as per the predefined
operating system algorithm. Printer is one of the best examples of in-time multiplexing. In a
network printer, different users get their turn to use the printer one after another based on time.
Space Multiplexing
When a particular resource is space multiplexed, the resource is shared equally in the available
space. Time period for which a particular resource is used does not matter anymore. That is each

Page 61
ASPIRE 2014 ( Introduction to Computer systems )

one gets a part of the resource. Hard disk, main memory, etc are some of the examples of space
multiplexing. These resources are most of the times divided equally between all the users.
To summarize, operating system is one of major programs, without which it would be almost
impossible for us to access the computer as we are accessing it these days. Without operating
system, computer would be nothing but a monitor executing binary and machine language data.

Page 62
ASPIRE 2014 ( Introduction to Computer systems )

5.Computing Environments
5.1. Mainframe Computing Environment
Computing Environment is a collection of computers, software, and networks that support the
processing and exchange of electronic information. It can collaborate across various software
installed on different machines at different physical and geographical locations as well, such an
environment is called Distributed Computing Environment. Figure 5. 1 shows how different
computers are connected with each other globally, also they can be connected with different
devices like cell phones.
Critical applications (refer glossary) and bulk data processing require computer environments
which can guarantee high reliability and stability. Most such large scale,high end commercial
system architectures (refer glossary) are referred as Mainframes.

Mainframe Computing Environment


It usually refers to one or more very big computer(s) capable of supporting a large number of
simultaneous users and doing bulk calculations and data processing. It is usually used for
extensive operations like Enterprise Resource Planning (refer glossary) or transaction processing.
The Mainframe environment (Refer Figure 5. 2) is expensive and ensures very high level of
security and reliability supporting massive throughput (refer glossary) . For example consider
banking applications like calculating balance of multiple customers who are doing their
transaction simultaneously from different locations. Also generating account statements for all
customers at the end of every month. These are all bulk operations requiring speed and accuracy.
Mainframes have come a long way from the ENIAC (Electronic Numerical Integrator And
Calculator) developed in 1942 to today's IBM z series of mainframes which are used in
organizations like National Aeronautics and Space Administration (NASA).
Page 63
ASPIRE 2014 ( Introduction to Computer systems )

Software for mainframes are written in following languages:

COmmon Business-Oriented Language (COBOL)

Job Control Language (JCL)

5.1.1. Storing Data on a Mainframe


On computers data is stored in the form of binary bits that is, 0s and 1s . Characters like A..Z are
formed with 8 bits called as Bytes. When we press a key on the keyboard eight bits get emitted
from the cable. All the keys are represented with an unique combination of binary numbers that
is 0s and 1s. As we use 8 bits to store a single character, 2^8 = 256 different type of patterns can
be stored. On Mainframes, we use a unique 8-bit pattern to store each character. This
representation of characters and data in mainframe is referred as Extended Binary Coded
Decimal Interchange Code (that is EBCDIC). Here, every character uses storage of one byte in
memory.
For example, in EBCDIC,
The number 1 is represented as 1111 0001.
The number 2 is represented as 1111 0010.
5.1.2. Mainframe Datasets
On a mainframe the information is stored in datasets (files -refer glossary ). Each dataset should
have an unique name of maximum 44 characters long in this format:
XXXXXXXX.XXXXXXXX.XXXXXXXX (For example, AGY0232.CUSTOMER.DATA)
Page 64
ASPIRE 2014 ( Introduction to Computer systems )

Following points should be considered while creating mainframe datasets.

A dataset name consists of segments or qualifiers.

Each qualifier has maximum eight characters and are separated by a period(.).

The qualifier or segment should start with a capital letter (alphabet).

The operating system looks into the segments to keep a track of groups of datasets. The
first segment of the dataset name is its High-level Qualifier (HLQ).

Datasets should have meaningful names. For example, Customers data should be stored
in a file named CUSTOMER.DATA. Here customer and data are the two segments or
qualifiers of your dataset name.

To access or log-in to Mainframes, we need a TSO (refer glossary) USER-ID, which is similar to
user-id that we use to login to a windows machine.
Suppose your TSO-id is AGY0232. So give the High-level qualifier AGY0232 to all your
datasets. This way you can identify the datasets belonging to you.
For example, name your Customer dataset as AGY0232.CUSTOMER.DATA.
Mainframes have Security software products like RACF( Resource Access Control Facility)
which control access to datasets. For example, you may want to grant read-only access to the file
AGY0232.CUSTOMER.DATA to other users. This will prevent other users from making any
changes to your dataset.
5.1.3. Mainframe Programing
High level language like COBOL is used for Mainframe programing. There are online
mainframe compilers available as well as software like Hercules can be installed on any
Operating System to simulate a mainframe environment.
IBM's MVS Operating system(Multiple Virtual Storage (refer glossary) ) up to release
3.8j(released in the year 1981) is also available. IBM provides a pre-configured starter system in
which you can do some coding to describe the configuration to be installed. This is called System
Generation (Sysgen) that is, the process of setting up or installing an operating system on the
mainframe.
We can code COBOL-Programs and run them using a Job (JCL Job Control Language) on a
Mainframe-Computer using its TSO User-id for a given time. Refer Figure 5. 3 for the basic
Page 65
ASPIRE 2014 ( Introduction to Computer systems )

skeleton of a COBOL Program. A COBOL program is written in structures called divisions.


Divisions in turn can have many sections. Sections can have many paragraphs.
The Mainframe terminal has 80 columns on a line for coding. The area from columns 8 to 11 is
called Area A. The area between columns 12 to 72 is called Area B. Refer Figure 5. 4 for a
sample program to display a message Hello World.
A COBOL program has following divisions :

IDENTIFICATION DIVISION This division records useful information like author


name or date when the program was created. It should at least have the program name or
ID.

ENVIRONMENT DIVISION - This division tells the computer about the other
resources that the program will interact with (that is, its environment) such as printers,
disk drives, other files etc. example, SOURCE-COMPUTER. IBM PC. This information
tells the configuration of the computer on which the program will execute.

DATA DIVISION This division defines the names that the program will use to refer to
the data that it manipulates. For example, USER-NAME PIC A(15). The PIC (or the
Picture clause ) states that the data stored in this USER-NAME will be of type alphabets
only and a maximum of 15 characters (like Tom or John) can be stored in USER-NAME.

PROCEDURE DIVISION It is the starting-point of the COBOL-Program. The


programing instructions must be written inside this PROCEDURE DIVISION. In
PROCEDURE DIVISION we can write instructions one-after-the other. The Mainframe
executes these instructions one-by-one and step-by-step sequentially. The last-instruction
must be STOP RUN to stop running the COBOL Program.

Page 66
ASPIRE 2014 ( Introduction to Computer systems )

5.2. Networks
A computer network joins two or more different categories of computing devices enabling them
to communicate to each other by sending and receiving instructions. A computer network can be
wired or wireless. Also, smaller networks in turn may be connected to larger networks through
bridges, gateways or routers (refer glossary) . Communication in a network follows certain rules
that is, it is protocol (refer glossary) based.
Following are the major categories of a Computer Network:

LAN (Local Area Network) : A LAN connects computer devices over a short distance. A
networked office, school or home usually contains a single LAN and occasionally it may
connect a group of nearby buildings. LAN is mostly connected using a technology called
Ethernet (refer glossary).

WAN (Wide Area Network) : A WAN is a geographically-dispersed collection of multiple


LANs. Various LANs are connected to a WAN using a router. The Internet is the largest
WAN and it spans the Earth. WAN networks exist under collective or distributed
ownership and management and do not belong to any single organization.

WLAN (Wire Less Area Network) : A Wireless Local Area Network (WLAN) links two
or more devices using some wireless method that is without any physical cables. This
enables the to move around within a local coverage area while being connected to the
network. WLANs are used in places like in-home networks, airplanes, trains, restaurants,
hotels.

Page 67
ASPIRE 2014 ( Introduction to Computer systems )

Computer networks (refer glossary) can be classified according to the hardware and associated
software technology that is used to interconnect the individual devices in the network like
electrical cable, optical fiber, and radio waves (wireless LAN).
A well-known family of communication media is collectively known as Ethernet. Ethernet uses
various standards and media to enable communication between computer devices.
Wireless LAN technology connects computer devices without the use of wires or cables.
These devices use transmission mediums like radio waves or infrared signals as shown in Figure
5. 5 where a desktop computer, a laptop and a cell phone are all connected using wireless
technology. Figure 5.5 : Computer Network

5.2.1. Wired Technologies


Wired networks are of following types :
a. Twisted Pair
b. Coaxial Cable
c. Optic Fiber
a. Twisted Pair
It is the most widely used medium for telecommunication. It is made of copper wires that are
twisted into pairs.
Page 68
ASPIRE 2014 ( Introduction to Computer systems )

Ordinary land line telephones are a good example where the wires consist of two
insulated copper wires that are twisted into pairs.

Computer network cabling (wired Ethernet) consists of 4 pairs of copper cabling that can
be utilized for both voice and data transmission. This twisting of two wires together helps
to reduce crosstalk (refer glossary) and electromagnetic induction.

Its transmission speed varies from 2 million to 10 billion bits per second. The Twisted
pair cables are of two types: Unshielded Twisted Pair (UTP) and Shielded Twisted-Pair
(STP).

b. Coaxial cable
It is generally used for cable television, office buildings, and other work-sites for local area
networks.

The cables consist of copper or aluminum wire surrounded by an insulating layer, which
in turn is surrounded by a conductive layer. This insulation helps in minimizing
interference and distortion.

Its transmission speed is between 200 million bits per second to more than 500 million
bits per second

c. Optical fiber
It is a glass fiber. It makes use of pulses of light to transmit data.

Its advantages over metal wires include less transmission loss, immunity from
electromagnetic radiation, and very fast transmission speed, up to trillions of bits per
second.

Page 69
ASPIRE 2014 ( Introduction to Computer systems )

Different colors of lights can be used to increase the number of messages being sent over
a fiber optic cable.

5.2.2. Wireless technologies


Wireless network refers to computer network that is not connected by cables of any kind.
Wireless networks can be of following types:

Wireless PAN - Wireless personal area networks (WPANs) interconnect devices within a
relatively small area, generally within a person's reach. Bluetooth radio or invisible
infrared light provide a WPAN for connecting a headset to a laptop.

Wireless LAN - A wireless local area network (WLAN) links two or more devices over a
short distance using a wireless method providing a connection through an access point for
Internet access. The use of spread-spectrum or OFDM (refer glossary) technologies may
Page 70

ASPIRE 2014 ( Introduction to Computer systems )

allow users to move around within a local coverage area, still remaining connected to the
network.

Wireless mesh network - It is made up of radio nodes organized in a mesh topology


(Refer section 2.2.3 Network Topology). Each node forwards messages on behalf of the
other nodes. Mesh networks can automatically re-route around a node that has lost
power.

Wireless MAN - Wireless metropolitan area networks are a type of wireless network that
connect many wireless LANs. WiMAX is an example of Wireless MAN.

Wireless WAN - Wireless wide area networks are wireless networks that typically cover
large areas, like networking neighboring towns and cities.

Cellular network - A cellular network or mobile network is a radio network distributed


over land areas known as cells. Each cell has at least one fixed-location transceiver( It is
usually installed on a communication tower and basically has the role of sending and
receiving signals), known as a cell site or base station. These cells are joined together to
provide radio coverage over a wide geographic area and enable a large number of
portable transceivers (e.g., mobile phones, tablets) to communicate with each other.

Following Technologies are used to support the Wireless network connections:

Terrestrial microwave communication It uses Earth-based transmitters and receivers


resembling satellite dishes (refer Figure 5.11). Terrestrial microwaves are in the
low-gigahertz range limiting all communications to line-of-sight. The relay stations are
placed approximately 48 km (30 mi) apart.

Communications satellites - These communicate via microwave radio waves. These


waves are not deflected by the Earth's atmosphere. These satellites stationed in space
typically in geosynchronous orbit 35,400 km (22,000 mi) above the equator (Refer Figure
5.10) can receive and relay data, voice and TV signals.

Spread spectrum (refer glossary) technologies use a high-frequency radio technology to


enable communication between multiple devices in a limited area.

Infrared communication can transmit signals for small distances typically less than 10
meters. It uses line-of-sight propagation which limits the physical positioning of
communicating devices.

Page 71
ASPIRE 2014 ( Introduction to Computer systems )

5.2.3. Network topology


A network topology is the layout describing how the nodes(all computer terminals) of a
computer network are interconnected. Common layouts are explained as follows:
Bus Network

Page 72
ASPIRE 2014 ( Introduction to Computer systems )

All nodes are connected to a common cable which is called a Bus.


Advantages

Implementation is easier.

Best Topology for small networks

Disadvantages

Due to the cable length, the number of nodes that can be connected is also less.

It can perform well for a limited number of nodes only.

If the main cable or the Bus fails, then all the nodes connected to it also fail to serve.

Star Network
All nodes are connected to a central node or hub. This layout found typically in a Wireless LAN,
where each client connects to the central Wireless access point.
Advantages

As it is centralized in nature, it is simple in terms of operation.

It also keeps each device isolated in the network. It means if one node stops working, it
does not affect the function of other nodes.

Disadvantages

The whole network operation is dependent on the central hub.

The entire network fails if the central hub fails.

Ring Network
Advantage

There is no requirement of a central server as the communication between two nodes


channelizes through all the intermediate nodes.

Disadvantages
Page 73
ASPIRE 2014 ( Introduction to Computer systems )

Even if a single node of the network fails, it can cause the entire network to fail.

Entire network is affected whenever any change or movement is made for a network
node.

Mesh Network
Each node connects with a random number of neighbors such that there is at least one traversal
from each node to any other. Here each node has the responsibility of propagating the data.
Advantage

This arrangement of the network nodes makes it is possible to transmit data from one
node to many other nodes at the same time.

Disadvantage

In an arrangement where each node is connected to every other node of the network,
many of the connections may serve no major purpose as they behave as redundant
connections.

Fully Connected Network


Each node connects with all the other nodes in the network.
Advantages

A fault in one terminal on the network will not effect other nodes, as the data has multiple
redundancy paths that can be used.

Data transfer rates can be kept at an acceptable level as whenever network usage is high
the data can be transmitted via different route hence reducing network clogging.

Disadvantage
It requires a large amount of wiring.

Page 74
ASPIRE 2014 ( Introduction to Computer systems )

5.2.4. Network Programming


Computer network programming involves writing computer programs that communicate with
each other across a computer network. We need two separate programs for this. The Client
program initiates the communication and The server program which waits or listens for the
communication from client. Both endpoints of the communication flow are called network
sockets. Network programming is also known as socket programming.
Network Programing can be implemented using any language which needs to provide following
network layer functions. Refer Figure 5.13.

socket() creates a new socket, identified by an integer number, and allocates system
resources to it.

bind() is used on the server side to associate a socket with a socket address structure, that
is a specified local port number and IP address.

listen() is used on the server side and it causes a bound TCP socket to enter listening
state.

connect() is used on the client side to assign a free local port number to a socket. For TCP
socket, it causes an attempt to establish a new TCP connection.
Page 75

ASPIRE 2014 ( Introduction to Computer systems )

accept() is used on the server side to accept a received incoming attempt to create a new
TCP connection from the remote client. It creates a new socket associated with the socket
address pair of this connection.

send()-recv(), write()-read() or sendto()-recvfrom() can be used to send and receive data


to/from a remote socket.
o

The methods send() and recv() are used for sockets using TCP that is
Transmission Control Protocol like HTTP. This mechanism has error checking
and guarantees no data loss. It is used for all such applications where you can not
allow data loss like browsing websites.

The methods sendto() and recvfrom() are used for sockets using UDP (User
Datagram Protocol like Voice over Internet Protocol or VOIP used to make phone
calls using internet. This has lower level of security and does not guarantee that
the data will reach its destination.)

close() causes the system to release resources that are allcated to a socket. The connection
is terminated in case of TCP sockets.

unlink() removes the file names created for the socket. So now the socket is removed and
new socket with same name can be created when required.

Some additional methods that can be used are as follows:

gethostbyname() and gethostbyaddr() are used to resolve host/server names and


addresses.

select() is used for one or more of a provided list of sockets to be ready to read or ready
to write.

poll() is used to check the socket's state. The whole set of sockets can be tested to see if
we can read or write to any socket or if an error occurred.

setsockopt() is used to set the socket option for the given socket. These options can be
like SO_KEEPALIVE (keep the connection alive by periodic transfer of messages),
SO_BROADCAST (Allows a single message to be sent (broadcasted) to all the
networked clients), etc.

getsockopt() gives the current value of a socket option for the specified socket.

Page 76
ASPIRE 2014 ( Introduction to Computer systems )

5.3. Internet
The Internet is a network connecting computers from across the world enabling data exchange
between them. Internet consists of independent hosts following the protocols. The World Wide
Web is a way of exchanging information over this medium of internet. The system consists of at
least two computers connected in such a way that at any instance of time one acts as a client
(requesting data or service) and the other machine works as a host or server (providing the data
or service). The Internet can be accessed almost anywhere in many ways. Data cards, mobile
phones, hand-held game consoles and cellular routers provide wireless connection to the
Internet.

Page 77
ASPIRE 2014 ( Introduction to Computer systems )

5.3.1. Internet Protocols


A protocol is a common means or rules for unrelated objects to communicate with each other. A
protocol is a description of:

The messages that are understood by both the communicating objects.

The arguments or data that these messages may be supplied with.

The types of results returned by these messages.

The information that is preserved despite modifications to the state of an object.

Any exceptional situations that needs to be handled during this communication.

The protocol used for data flow or communication between the networks connected in an internet
is called Internet Protocol. The Internet protocol suite is a model architecture that divides
methods into a layered system of protocols.
The layers represent the scope or environment in which their services operate. (refer Figure
5.15). The layers are as follows:

Application Layer - It is the space for the application-specific networking methods used
in software applications like a web browser program.

Transport layer - It connects applications on different hosts via the network (like
clientserver model) with appropriate data exchange methods.

Internet layer - It enables computers to identify and locate each other via Internet
Protocol (IP) addresses. It connects them to one another via intermediate (transit)
networks. (refer Figure 5.16).

Software layer It is the link layer and provides connectivity between hosts on the same
local network link, such as a local area network (LAN) or a dial-up connection.

The model known as TCP/IP, is designed to be independent of the underlying hardware.


Internet Protocol (IP) is the most prominent component of the Internet model. It provides
addressing systems (IP addresses) for computers on the Internet.
IP Version 4 (IPv4) is the initial version of Internet Protocol. It was designed to address up to
approximately 4.3 billion (109) Internet hosts and is still in dominant use.
Page 78
ASPIRE 2014 ( Introduction to Computer systems )

A new protocol version IPv6 was developed in the mid-1990s and is currently in growing
deployment around the world. It provides vastly larger addressing capabilities and more efficient
routing of Internet traffic.

5.3.2. Internet Routing


IP forwarding also known as Internet routing is a process used to determine the path for your
data contained in structures called datagrams or packets (refer glossary) . The process uses
routing information to make decisions and is designed to send a packet over multiple networks.
Internet Service Providers (ISPs are the organizations that provide access to internet) connect
their customers to those of other ISPs.
At the top of the routing hierarchy are Tier-1 networks held by large telecommunication
companies which exchange traffic directly across to all other Tier-1 networks via agreements
such that they don't have to pay each other for the data transferred every now and then .
Tier-2 networks buy Internet transit from Tier-1 ISP to reach the global Internet. That is, to reach
a remote network, the smaller ISPs have to connect to first Tier-1 network which in turn may be
connected to that remote network. For this connectivity they have to pay some amount.
ISPs generally use a single upstream provider for connectivity. They may use multihoming (refer
glossary) to provide protection from problems with individual links.
Internet exchange points hold the physical connections between multiple ISPs.

Page 79
ASPIRE 2014 ( Introduction to Computer systems )

Computers and routers use routing tables (Refer Figure 5.17) to direct IP packets among locally
networked machines. These tables can be constructed manually or automatically via DHCP
(Dynamic Host Configuration Protocol) for an individual computer or a routing protocol for
routers themselves. In single-homed networks, a default route usually points up toward an ISP
providing transit. The higher-level ISPs use the Border Gateway Protocol (refer glossary) to
determine paths to any given range of IP addresses across the complex connections of the global
Internet.

Page 80
ASPIRE 2014 ( Introduction to Computer systems )

5.4. Websites
A website is a set of related web pages containing information in form of text, images, audio,
video etc. A website is hosted on one or more web server(s) and can be accessed by internet.
World Wide Web (WWW) is the term used to refer collection of all public websites.
A web page is a single document written in plain text. It is formatted using instructions of
Hypertext Markup Language (HTML).
The general features of a website are described as follows:
A protocol is a common means or rules for unrelated objects to communicate with each other. A
protocol is a description of:

The home page of a website contains an introduction to that site and links to other related
pages or to other websites.

A website can be owned by an organization or an individual also.

Websites may host static content that remains same for all the viewers or they may host
dynamic content that changes as per the visiting user's preferences.

To access a website, we need its address. For example, www.tcs.com

The letters in the website address after the last dot (.) indicates the type of websites. For
example, .com means Commercial Organization, .edu refers to educational sites, .gov is
for government websites, .jobs means job websites, etc.

A website is accessed using Hypertext Transfer Protocol (HTTP) . It may also use
encryption (HTTP Secure, HTTPS (refer glossary) ) to provide security and privacy.

The user's web browser understands the HTML instructions and displays the page content
accordingly.

Page 81
ASPIRE 2014 ( Introduction to Computer systems )

5.4.1. Static website


A static website usually displays the same information (static information) to all visitors. It is
similar to a printed brochure.
It provides consistent and standard information for a considerable long period.
The website may however receive updates occasionally. These updates are done using a manual
process to edit the text, photos and other content. This kind of editing requires a software and
basic skills to use it.
Static websites can be edited using the following categories of software:

Text editors - Here content and HTML markup are manipulated directly within the editor
program. For example, Notepad, Notepad++.

Page 82
ASPIRE 2014 ( Introduction to Computer systems )

WYSIWYG (refer glossary) offline editors These provide a GUI interface. The output
is in form of HTML markup generated automatically by the editor software. For example,
Microsoft FrontPage and Adobe Dreamweaver

WYSIWYG online editors These can be used to create online web pages including
widgets, blogs, and other documents containing images and other media. For example,
SnapEditor.

Template-based editors - These allow quick creation and uploading of web pages to a
web server. A detailed HTML knowledge is not required. You just need to pick a desired
template from available options and add pictures and text to it without directly writing or
updating HTML code. For example, RapidWeaver and iWeb.

5.4.2. Dynamic Website


A dynamic website has the ability to change or customize itself frequently and automatically at
some specific time interval or based on some criteria.
Dynamic websites offer dynamism in two aspects : Code and Content. The dynamic code
execution is not visible to the user. The user can see the dynamic content only.
Dynamic code - The code is executed on the fly based on some user event. Scripting languages
like Javascript, Ajax are used for this. A website with dynamic code has following
characteristics:

It recalls all the bits of information from a database and consolidates them in a predefined
format.

It interacts with users in various ways like using cookies for finding previous history.

Direct interaction using form elements and mouse hovers also reflect the user event and
cause the dynamic code to execute.

It can display the current state of a interaction between users. It can capture information
personalized to the requirements of the user.

Dynamic content - The web page content keeps on varying based on some criteria, either
predefined rules or variable user input.

Page 83
ASPIRE 2014 ( Introduction to Computer systems )

For example, a news website can use a predefined rule which tells it to display all news
articles for today's date and for your country or location only.

Such a website automatically shows the most current news articles on any given date.

Consider a retail website which allows a user to input a search request for the keyword
like Guitar. In response, the content of the web page will spontaneously change and will
then display a list of Guitar and music products like CDs (Compact Disks) and DVDs
(Digital Versatile Disk).

Summary

Computing Environment is a collection of computers, and various software in a network.


All these computers collaborate with each other for storing,processing and exchanging
electronic information.

Mainframe computing environment is capable of doing bulk calculations with very high
level of accuracy,security and speed.

Mainframe programs are written using COBOL and JCL. We need a TSO (refer glossary)
user id to access the time slot on a mainframe server.

A computer network joins two or more computing devices so that they can communicate
with each other. Networks can be of two types that is, wired or wireless.

Twisted pair, Coaxial cables and Optic fiber technologies are used to connect a wired
network.

Terrestrial Microwave, Satellites, Spread Spectrum and Infrared technologies are used to
connect various computing devices without wires.

Computer networks can have their nodes connected in forms like Bus, Star Ring, Mesh or
Fully Connected topology.

Network or Socket programing can be done using various programing language and all of
them provide the basic methods for reading and writing to a network and listening for
requests from the client.

Internet connects computers across the world. It is based on protocols. Each computer in
the internet is identified by an IP address.

The communication between two computers may be routed through various networks.
Page 84

ASPIRE 2014 ( Introduction to Computer systems )

A Website may be accessed using http protocol from any where on the internet. It can be
of two types : Static and dynamic.

Static websites are like the profile of a company or product and does not change often
and displays the same details to all visitors.

Dynamic websites change their content as per time and user preferences like news,
e-commerce websites.

Dynamic code - The code is executed on the fly based on some user event. Scripting
languages like Javascript, Ajax are used for this. A website with dynamic code has
following characteristics:

It recalls all the bits of information from a database and consolidates them in a
predefined format.

It interacts with users in various ways like using cookies for finding previous
history.

Direct interaction using form elements and mouse hovers also reflect the user
event and cause the dynamic code to execute.

It can display the current state of a interaction between users. It can capture
information personalized to the requirements of the user.

Dynamic content - The web page content keeps on varying based on some criteria, either
predefined rules or variable user input.
o

For example, a news website can use a predefined rule which tells it to display all
news articles for today's date and for your country or location only.

Such a website automatically shows the most current news articles on any given
date.

Consider a retail website which allows a user to input a search request for the
keyword like Guitar. In response, the content of the web page will spontaneously
change and will then display a list of Guitar and music products like CDs
(Compact Disks) and DVDs (Digital Versatile Disk).

Page 85
ASPIRE 2014 ( Introduction to Computer systems )