Sunteți pe pagina 1din 42

1 1.

1 What is a Computer
2  
3                 A computer is a machine that executes a set of arithmetic or
logical instructions.
4 The sequence of these instructions can be changed to perform a variety of operations
and get various outputs.
5 ============================================================
=============================
6
7  journey starts with pioneer Charles Babbage.
8 Charles Babbage ,the father of computer, designed the first automatic computing
engine.
9 It was to operate on steam and was called the Difference Engine
10 ============================================================
====
11
12                 Harvard Mark-I (refer Figure 1. 6) computer was built as a
partnership between Harvard and IBM in 1944.
13 It was the first programmable digital computer made in the U.S.
14 ============================================================
=========================
15
16 But it was not a purely electronic computer. The Mark-I computer was constructed
out of switches, clutches, relays and rotating shafts.
17 ============================================================
===============================
18   The first completely electronic computer is well known as ENIAC (Electronic
Numerical Integrator And Calculator) and was developed by University of Pennsylvania
in 1946.
19 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.
20 ============================================================
=======================================================
21   The computers that we use today is a transformation which was a result of the
invention of the microprocessor.
22 A microprocessor (uP) is a computer that is fabricated on an integrated circuit (IC -
refer Glossary).
23 ============================================================
===================
24 Computers had been around for 20 years before
25 the first microprocessor was developed by Intel (one of the leading companies that
manufactures hardware) in 1971.
26 =======================================================
27 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.
28 Intel followed the 4004 with the 8008 and 8080.
29 ============================================================
===================
30          Few of the latest use of computer technology can be listed as
below. (Refer glossary for details)
31 Digital Signature verification
32 Natural Language Speech to Text
33 Augmented Reality
34 Cloud Computing
35 Phablets
36 Omnidirectional Imaging
37 Social Networking
38 ============================================================
==========================
39 1.2 Components in a Computer System
40  
41         A computer consists of following components:
42 Hardware
43 Software
44 Firmware
45 ===================================================
46 Also called VDU (Visual Display Unit), the Monitor is the primary output device.
47 ============================================================
48  1.2.1.4 Memory Devices
49         These are the devices which store the information.
50
51         The term primary memory is used for the information in physical
systems which functions at high-speed
52 . For example, it is capable of performing complex calculations and displaying the
results at the same time.
53         Secondary memory devices are physical devices for program and
data storage which are slow to access but offer higher memory capacity.
54         
55 Primary memory stored on secondary memory is called virtual memory.
56         RAM (refer Figure 1. 14, Glossary), and Computer cache (refer
Glossary)are examples of Primary memory storage.
57 Magnetic tapes, Compact Disks (CDs), Digital Versatile Disks(DVDs - refer Figure
1. 15) are all examples of Secondary Memory Storage.
58
59 The memory is organized into memory cells each storing one binary bit (0 or 1).
60 ============================================================
=============
61
62  1.2.1.5 Central Processing Unit
63  
64 The Central Processing Unit (CPU) or the computer processor performs calculations,
processes information, stores data in memory and controls the flow of data.
65 ============================================================
======
66
67 The conventional processors are small in size and have all the circuits integrated on a
single chip.
68 Because of its small size, the processor is also known as microprocessor.A minimal
hypothetical microprocessor might only include an arithmetic logic unit (ALU) and a
control logic section.
69 ============================================================
============
70
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).

71 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)
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

Software can be categorized into three types as follows:

1 System Software
2 Utility Software
3 Application Software

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

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.
1
2 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.
3 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.

4 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.
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.
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.

1 It is software stored in hardware.


2
3 Firmware – The embedded systems that store software and data inside the hardware
as the hardware's inseparable part.
4 =============================================
1.2.3 Firmware

Examples include
remote control.
5 Devices like printers, scanners, cameras and USB drives have firmware stored
internally.
6
7 ==========================================
1.3 Computer Language

8 The term computer language includes a wide variety of languages used to


communicate with computers
9 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 a
programming language
10
11 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.

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.

1 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.
2 =====================================================

3 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
4 Scripting languages are very useful for web-based programing. For example :
javascript, perl.

1 Computer Architecture - refer to the relationship between different hardware


component of a computer system.
Computer Organization - refer to how operational attributes are linked together to
realized the architecture specifications.
12

The model of a computer consists of four basic units, shown in


following figure (Figure 2.1). The basic units are :

1 Central Processing Unit (CPU)


2 Input and Output Devices
3 Memory Unit

Figure 2.1 : Basic unit of a Computer

CPU consist of three basic blocks (refer Figure 2.2):

1 Arithmetic Logical Unit


2 Control Unit
3 Registers
Figure 2.2 : Central Processing
Unit

In some computer processors, ALU is divided into two distinct


parts:

1 Arithmetic Unit
2 Logical Unit

i. Arithmetic Unit(AU)

Arithmetic Unit performs arithmetic operations

ii. Logical Unit(LU)

Logical Unit performs the logical operations. ALU is having three


logical operands:

1 AND
2 OR
3 NOT
2.1.1 Central Processing Unit (CPU)

b. Control Unit(CU)

The Control Unit extract instructions from memory, decodes and


executes them, and then sends the necessary signals to the ALU to perform the
operations required.
c. Registers

Registers are contained within the central processing unit

Registers 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 Performs following operations:-

1 Fetch - The Fetch Operation is used for taking the instructions given by the user.
2 Decode - The Decode Operation is used for interpreting the meaning of the
instructions fetched by registers. Decoding instructions means the CPU will find out
which operation is to be performed on the instructions.
3 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.

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.

The unit that communicates directly with CPU is called the main memory.
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.
There are following types of Memories:

1 Main memory
1 RAM (Random Access Memory)
2 ROM (Read Only Memory)
2 Auxiliary Memory
3 Magnetic Disks
4 Magnetic tapes etc.

1 RAM (Random Access Memory):


RAM, also known as Volatile memory that loses its contents when the computer or
hardware device loses power.
2 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.

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.

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 which are termed as a common bus,

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


devices for transfer of data.

Basically, all computers utilize two types of bus:


1 Internal Bus : also known as local bus,enables a communication between internal
components such as a computer video card and memory.
1 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:

1 Data Bus
1 Address Bus
1 Control Bus
1
Data Bus
1 Data bus is a computer subsystem that allows transferring of data from one
component to another on a motherboard, or between two computers.
2 Address Bus
1 An address bus is used to specify a physical address.

3 Control Bus
1 A control bus is a part of a computer bus, used by CPUs for communicating with
other devices within the computer.
2 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.

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

1 Immediate Addressing Mode (Refer to glossary for detail).


1 Direct Addressing Mode (Refer to glossary for detail).
1 Indirect Addressing Mode (Refer to glossary for detail)

Immediate Addressing Mode - In immediate addressing, the


instruction contains the value to be used.

Direct Addressing Mode - In direct addressing, the instruction tells where the value can
be found, but the value itself is out in the memory.

1 There are two sub-classification of direct addressing mode-


1 Absolute Addressing - The mode is referred to as Absolute addressing, when the
location is in memory.
2 Register Direct Addressing - The mode is referred to as Register Direct
Addressing, when the location is a processor register.

Indirect Addressing Mode - Indirect addressing uses address register to point at the
location of the operand in memory, that is, the address of an operand is obtained
indirectly via an address register.

System software

System software refers to the files and programs that makes 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 consist of the following programs:

1 Assemblers
2 Compilers
3 File Management Tools
4 System Utilities
5 Debuggers

The system software is installed on the computer when the operating system is installed.

Application programs are used by end user, whereas system software is not meant to be
run by the end user.

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.
3.1 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.

1 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.

2 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.

3.2

Assembly Language

The native language of the computer is assembly language . The


processor of the computer understands machine code (consisting of ones and
zeroes). 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 to machine code.

Assembly language program consists of mnemonic codes which are easy to remember as
they are similar to words in the 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.

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

Advantages of Assembly language

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.

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

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

Binary Hex Mnemonic Description


1001111 4F CLRA Clears the A accumulator
110110 36 PSHA Saves A accumulator on stack
1001101 4D TSTA Tests A accumulator for 0
Figure 3.3 : Assembly Language Programming
Advantages of using mnemonics are:
1 Mnemonics are easy to understand than hex or binary values.
2 Its less likely to make an error.
3 Mnemonics are easy to remember.

A line of an assembly language program can contain the following


four fields:

1 Label
1 Opcode
1 Operand
1 Comments

LOOP: LDAA #24H

JMP LOOP

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 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.

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.

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

The following are the five stages of a compiler:

1 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
Table is a data structure that contains information about symbols and groups of symbols
in the program being translated.
2 Syntactic Analyzer : Analyzes the tokenized code for structure,groups symbols
into syntactic groups,tags groups with type information.
3 Semantic Analyzer : Analyzes the Parsed Code for meaning, fills in assumed or
any missing information and tags the groups with the meaning.
4 Code Generator : Linearizes the qualified Code and produces the object code.
5 Optimizer: Checks the object code to determine whether there are more efficient
means of execution.
Figure 3.5 : Stages of a compiler

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

a compiler translates high-level instructions directly into machine language. The


compiled programs generally run faster than interpreted programs. One of the 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.

Advantages of using interpreter

1 Execution is done in a single stage. Compilation stage is not required.


2 Alteration of code is possible during runtime.
3 Really useful for debugging the codes.
4 Helps in interactive code development.

Interpreter vs Compiler

5 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.
6 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.
Computing Environments

Computing Environment is a collection of computers, software, and networks that


support the processing and exchange of electronic information.

5.1 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

For example consider banking applications

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).
Software for mainframes are written in following languages:

1 COmmon Business-Oriented Language (COBOL)


2 Job Control Language (JCL)

5.1.1 Storing Data on


a Mainframe

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.

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.

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)

Following points should be considered while creating mainframe


datasets.

1 A dataset name consists of segments or qualifiers.


2 Each qualifier has maximum eight characters and are separated by a period(.).
3 The qualifier or segment should start with a capital letter (alphabet).

4 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.

IBM's MVS Operating system(Multiple Virtual Storage (refer glossary) ) up to release


3.8j(released in the year 1981) is also available.

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.

1 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.
2 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.
For example, SOURCE-COMPUTER. IBM PC.
This information tells the configuration of the computer on which the program will
execute.
3 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.
4 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.
Figure 5.3 : COBOL
Program Skeleton

Figure 5.4 : COBOL Program

Following are the major categories of a Computer Network:

LAN (Local Area Network)


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

1 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.

5.2.1 Wired Technologies

Wired networks are of following types :

1 Twisted Pair
2 Coaxial Cable
3 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.
1 This twisting of two wires together helps to reduce crosstalk (refer glossary) and
electromagnetic induction.

1 Twisted pair cables are of two types: Unshielded Twisted Pair (UTP) and Shielded
Twisted-Pair (STP).

1 The unshielded cables are individually covered but do not have any wrapping or
layer surrounding the twisted pair, that is why they are called unshielded.
The shielded cables are individually covered and the twisted pair is wrapped in a
foil shielding to help provide a more reliable data communication.

Its transmission speed varies from 2 million to 10 billion bits per second.

b. Coaxial cable

It is generally used for cable television, office buildings, and other


work-sites for local area networks.

1 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.
2 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.

3 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.

5.2.2 Wireless technologies

Wireless network refers to computer network that is not connected by cables of any kind.

1 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.

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


2 Mesh networks can automatically re-route around a node that has lost power.

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

4 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.

Following Technologies are used to support the Wireless network


connections:

1 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.
2 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.
3 Spread spectrum (refer glossary) technologies use a high-frequency radio
technology to enable communication between multiple devices in a limited area.

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

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

Advantages
1 Implementation is easier.
2 Best Topology for small networks.
Disadvantages
3 Due to the cable length, the number of nodes that can be connected is also less.
4 It can perform well for a limited number of nodes only.
5 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
6 As it is centralized in nature, it is simple in terms of operation.
7 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.
Disadvantage
8 The whole network operation is dependent on the central hub. The entire network
fails if the central hub fails.
Ring Network

Advantage
9 There is no requirement of a central server as the communication between two nodes
channelizes through all the intermediate nodes.
Disadvantages
10 Even if a single node of the network fails, it can cause the entire network to fail.
11 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
12 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
13 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
14 A fault in one terminal on the network will not effect other nodes, as the data has
multiple redundancy paths that can be used.
15 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
16 It requires a large amount of wiring.

Figure 5.12: Network Topology


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

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.

1 socket() creates a new socket, identified by an integer number, and allocates system
resources to it.
2 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.
3 listen() is used on the server side and it causes a bound TCP socket to enter listening
state.
4 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.
5 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.
6 send()-recv(), write()-read() or sendto()-recvfrom() can be used to send and receive
data to/from a remote socket.
1 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.
2 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.)
7 close() causes the system to release resources that are allocated to a socket. The
connection is terminated in case of TCP sockets.
8 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:

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


addresses.
10 select() is used for one or more of a provided list of sockets to be ready to read or
ready to write.
11 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.
12 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.
13 getsockopt() gives the current value of a socket option for the specified socket.

Figure 5.13: Network Programing flow chart

5.3 Internet

The Internet is a network connecting computers from across the


world enabling data exchange between them.

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:

1 The messages that are understood by both the communicating objects.


2 The arguments or data that these messages may be supplied with.
3 The types of results returned by these messages.
4 The information that is preserved despite modifications to the state of an object.
5 Any exceptional situations that needs to be handled during this communication.

6 Application Layer - It is the space for the application-specific networking methods


used in software applications like a web browser program.
7 Transport layer - It connects applications on different hosts via the network (like
client–server model) with appropriate data exchange methods.
8 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).
9 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.

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

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.

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

1 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

For example, .com means Commercial Organization, .edu refers to educational sites, .gov
is for government websites, .jobs means job websites

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

Static websites can be edited using the following categories of


software:

Text editors
For example, Notepad, Notepad++.
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.
1 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

1 It recalls all the bits of information from a database and consolidates them in a
predefined format.
2 It interacts with users in various ways like using cookies for finding previous
history.

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

Bridge-------------------------- similar n/w.


Router---------------------------diff n/w.

Introduction to Operating System

Operating system is a collection of programs. It is a software that supports a computer's


basic functions. It acts as an interface between applications and computer 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 are available.

4.1 Basic Resources


Managed By Operating
System

1 Memory space (Memory management)


2 CPU time (Process management)
3 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

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 to be done by operating


system is how best to utilize the available memory. In this process we should try to
minimize fragmentation.

i. Fragmentation

It 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 to 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:

1 External fragmentation
2 Internal fragmentation
3 Data fragmentation

1 Internal Fragmentation
Internal fragmentation is the space wasted inside the allocated memory block because of
the restriction on allowed sizes of allocated blocks

2 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.

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

3 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

1 Single Contiguous Allocation


2 Partitioned Memory Management Scheme (Refer Glossary for scheme definition)
3 Paged Memory Management
Segmented Memory Managemen

Single Contiguous Allocation


Figure 4.3 : 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.

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.

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.
ii.

Memory Management Techniques

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


schemes:

1 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.Disadvantages are
inefficient use of memory due to internal fragmentation. Also maximum number of active
processes is fixed

2 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.

ii. Memory Management Techniques

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.

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

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.
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.

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.

o 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.

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


are created.

Some of the common reasons for process termination are:

1 User logs off


2 A service request to terminate is executed by process
3 Error and fault conditions
4 Normal completion
5 Time limit exceeded
6 Memory unavailable
7 I/O failure
8 Fatal error, etc.

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.

4.1.c File System Management

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.
Operating system keeps track of following tasks for providing
efficient file management:

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


2 It maintains a list to keep track of exact file location.
3 Provide fast and simple algorithms to write and read files in co-operation with
device manager.
4 Grant and deny access rights on files to programs and users.
5 Allocate and de-allocate files so that files can be processed in co-operation with
process manager.
6 Provide programs and users with simple commands for handling files.

4.1.c File System Management

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 Allocation Table (FAT).

Below are the different ways of allocating files:

1 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

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

2 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.

3 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.

he disadvantage of indexed allocation is that for each file an additional sector is needed to
keep track of the location of a file.
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.

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.

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

Figure 4.9 : Dead Lock

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.
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.

1 Detection and Recovery.


2 Avoiding deadlock by careful resource allocation.
3 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.

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)

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.

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 one gets a part of the resource. Hard disk, main memory, etc are
some of the examples of space multiplexing

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.

S-ar putea să vă placă și