You are on page 1of 48

MASTER OF COMPUTER

APPLICATIONS
(MCA)

(4th SEMESTER)
ASSIGNMENTS
JULY 2009 & JANUARY 2010

(MCS-041, MCS-042, MCS-043, MCS-044, MCSL-045)

SCHOOL OF COMPUTER AND INFORMATION SCIENCES


INDIRA GANDHI NATIONAL OPEN UNIVERSITY
MAIDAN GARHI, NEW DELHI – 110068
CONTENTS

Course Code Assignment No. Maximum Last Date of Page


Marks Submission No.

MCS-041 MCA(4)/041/Assign/09 100 15th October, 2009 (For 3


July Session)

15th April, 2010


(For January Session)

MCS-042 MCA(4)/042/Assign/09 100 15th October, 2009 (For 4


July Session)

15th April, 2010


(For January Session)

MCS-043 MCA(4)/043/Assign/09 100 15th October, 2009 (For 6


July Session)

15th April, 2010


(For January Session)

MCS-044 MCA(4)/044/Assign/09 100 15th October, 2009 (For 9


July Session)

15th April, 2010


(For January Session)

MCSL-045 MCA(4)/045/Assign/09 100 15th October, 2009 (For 11


July Session)

15th April, 2010


(For January Session)

Important Notes
Viva-voce worth 20 Marks is compulsory for each course.
Please follow the guidelines given in the MCA Programme Guide for solving, presentation
format and submission of the assignments.

2
Course Code : MCS-041
Course Title : Operating Systems
Assignment Number : MCA(4)/041/Assign/09
Maximum Marks : 100
Weightage : 25%
Last Date of Submission : 15th October, 2009 (for July, 2009 session)
15th April, 2010 (for January, 2010 session)

This assignment has six questions which total carries 80 marks. Answer all
questions. Rest 20 marks are for viva voce. You may use illustrations and diagrams
to enhance the explanations. Please go through the guidelines regarding
assignments given in the Programme Guide for the format of presentation. Answer
to each part of the question should be confined to about 300 words.

Question 1:

State the Readers and Writers problem and write its semaphore based solution. Also describe
the algorithm. Can the producer consumer problem be considered as a special case of
Reader/Writer problem with a single Writer (the producer) and a single Reader (consumer)?.
Explain.
(20 Marks)
Answer:
The readers/writers problem is one of the classic synchronization problems. It is often used to
compare and contrast synchronization mechanisms. It is also an eminently used practical
problem. A common paradigm in concurrent applications is isolation of shared data such as a
variable, buffer, or document and the control of access to that data.
This problem has two types of clients accessing the shared data. The first type, referred to as
readers, only wants to read the shared data. The second type, referred to as writers, may want to
modify the shared data.
There is also a designated central data server or controller. It enforces exclusive write semantics;
if a writer is active then no other writer or reader can be active. The server can support clients that
wish to both read and write. The readers and writers problem is useful for modelling processes
which are competing for a limited shared resource.
Semaphores can be used to restrict access to the database under certain conditions. In this
example, semaphores are used to prevent any writing processes from changing information in the
database while other processes are reading from the database.
semaphore mutex = 1; //Controls access to the reader count
semaphore db = 1; //Controls access to the database
int reader_count; //The number of reading processes accessing the data
Reader()
{
while (TRUE) { // loop forever
down(&mutex); //gain access to reader_count
reader_count = reader_count + 1; //increment the reader_count
if (reader_count == 1)
down(&db); //If this is the first process to read the database,
// d down on db is executed to prevent access to the
// database by a writing process
up(&mutex); //allow other process to access reader_count
read_db(); //read the database
down(&mutex); // gain access to reader_count
reader_count = reader_count – 1; //decrement reader_count
if(reader_count == 0)
up(&db); //if there are no more processes reading from the
//database, allow writing process to access the data
up(&mutex); //allow other processes to access
reader_countuse_data(); //use the data read from the database (non-critical)
}

3
Writer()
{

while(TRUE) { // loop forever


create_data(); // create data to enter into database (non-critical)
down(&db); // gain access to the database
write_db(); // write information to the database
up(&db); // release exclusive access to the database
}

Question 2:

Describe different schemes for deadlock prevention, avoidance and detection with major
advantages and disadvantages of each scheme.
(10 Marks)

Deadlock Prevention:
As per Havender’s algorithm, since all four of the conditions are necessary for deadlock to occur, it follows
that deadlock might be prevented by denying any one of the conditions.

Havender’s Algorithm

Elimination of “Mutual Exclusion” Condition

The mutual exclusion condition must hold for non-shareable resources. That is several processes cannot
simultaneously share a single resource. This condition is difficult to eliminate because some resources,
such as the tap drive and printed, are inherently non-shareable. Note that shareable resources like read-
only-file do not require mutually exclusive access and thus cannot be involved in deadlock.

Elimination of “Hold and Wait” Condition

There are two possibilities for the elimination of the second condition. The first alternative is that a
process request be granted all the resources it needs at once, prior to execution. The second alternative is
to disallow a process from requesting resources whenever it has previously allocated resources. This
strategy requires that all the resources a process will need must be requested at once. The system must
grant resources on “all or none” basis. If the complete set of resources needed by a process is not
currently available. While the process waits, however, it may not hold any resources. Thus the “wait for”
condition is denied and deadlocks simply cannot occur. This strategy can lead to serious waste of
resources.

For example, a program requiring ten tape drives must request and receive all ten drives before it begins
executing. If the program needs only one tape drive to begin execution and then does not need the
remaining tape drives for several hours then substantial computer resources (9 tape drivers) will sit idle
for several hours. This strategy can cause indefinite postponement (starvation), since not all the required
resources may become available at once.

Elimination of “No-pre-emption” Condition

The non-pre-emption condition can be alleviated by forcing a process waiting for a resource that cannot
immediately be allocated, to relinquish all of its currently held resources, so that other processes may use
them to finish their needs. Suppose a system does allow processes to hold resources while requesting
additional resources. Consider what happens when a request cannot be satisfied. A process holds
resources a second process may need in order to proceed, while the second process may hold the
resources needed by the first process. This is a deadlock. This strategy requires that when a process that
is holding some resources is denied a request for additional resources, the process must release its held
resources and, if necessary, request them again together with additional resources. Implementation of
this strategy denies the no-preemptive” condition effectively.

High Cost
When a process releases resources, the process may lose all its work to that point. One serious
consequence of this strategy is the possibility of indefinite postponement (starvation). A process might be
held off indefinitely as it repeatedly requests and releases the same resources.

4
Elimination of “Circular Wait” Condition
The last condition, the circular wait, can be denied by imposing a total ordering on all of the resource
types and than forcing all processes to request the resources in order (increasing or decreasing). This
strategy imposes a total ordering of all resource types, and requires that each process requests resources
in a numerical order of enumeration. With this rule, the resource allocation graph can never have a cycle.
This strategy, if adopted, may result in low resource utilisation and in some cases starvation is possible
too.

Deadlock Avoidance:
This approach to the deadlock problem anticipates a deadlock before it actually occurs. This approach
employs an algorithm to access the possibility that deadlock could occur and act accordingly. This method
differs from deadlock prevention, which guarantees that deadlock cannot occur by denying one of the
necessary conditions of deadlock. The most famous deadlock avoidance algorithm, from Dijkstra [1965],
is the Banker’s algorithm. It is named as Banker’s algorithm because the process is analogous to that
used by a banker in deciding if a loan can be safely made or not.

The Banker’s Algorithm is based on the banking system, which never allocates its vailable cash in such a
manner that it can no longer satisfy the needs of all its customers. Here we must have the advance
knowledge of the maximum possible claims for each process, which is limited by the resource availability.
During the run of the system we should keep monitoring the resource allocation status to ensure that no
circular wait condition can exist.

If the necessary conditions for a deadlock are in place, it is still possible to avoid deadlock by being careful
when resources are allocated. The following are the features that are to be considered for avoidance of the
deadlock as per the Banker’s Algorithms.
• Each process declares maximum number of resources of each type that it may need.
• Keep the system in a safe state in which we can allocate resources to each process in
some order and avoid deadlock.
• Check for the safe state by finding a safe sequence: < P1, P2, …, Pn > where resources
that Pi needs can be satisfied by available resources plus resources held by Pj where j < i.
• Resource allocation graph algorithm uses claim edges to check for a safe state. The resource allocation
state is now defined by the number of available and allocated resources, and the maximum demands of
the processes. Subsequently the system can be in either of the following states:
• Safe State: Such a state occur when the system can allocate resources to each process (up to its
maximum) in some order and avoid a deadlock. This state will be characterised by a safe sequence. It
must be mentioned here that we should not falsely conclude that all unsafe states are deadlocked
although it may eventually lead to a deadlock.
• Unsafe State: If the system did not follow the safe sequence of resource allocation from the beginning
and it is now in a situation, which may lead to a deadlock, then it is in an unsafe state.
• Deadlock State: If the system has some circular wait condition existing for some
processes, then it is in deadlock state.

It is important to note that an unsafe state does not imply the existence or even the eventual existence of
a deadlock. What an unsafe state does imply is simply that some unfortunate sequence of events might
lead to a deadlock.

The Banker’s algorithm is thus used to consider each request as it occurs, and see if granting it leads to a
safe state. If it does, the request is grated, otherwise, it is postponed until later.

Limitations of the Banker’s Algorithm:


• It is time consuming to execute on the operation of every resource.
• If the claim information is not accurate, system resources may be underutilised.
• Another difficulty can occur when a system is heavily loaded. Lauesen states that in this situation “so
many resources are granted away that very few safe sequences remain, and as a consequence, the jobs
will be executed sequentially”. Therefore, the Banker’s
algorithm is referred to as the “Most Liberal” granting policy; that is, it gives away
everything that it can without regard to the consequences.
• New processes arriving may cause a problem.
o The process’s claim must be less than the total number of units of the resource in the system. If not, the
process is not accepted by the manager.
o Since the state without the new process is safe, so is the state with the new process. Just use the order
you had originally and put the new process at the end.
o Ensuring fairness (starvation freedom) needs a little more work, but isn’t too hard
either (once every hour stop taking new processes until all current processes finish).
• A resource becoming unavailable (e.g., a tape drive breaking), can result in an unsafe
state.

5
Deadlock Detection:
Detection of deadlocks is the most practical policy, which being both liberal and cost efficient, most
operating systems deploy. To detect a deadlock, we must go about in a recursive manner and simulate
the most favoured execution of each unblocked process.
• An unblocked process may acquire all the needed resources and will execute.
• It will then release all the acquired resources and remain dormant thereafter.
• The now released resources may wake up some previously blocked process.
• Continue the above steps as long as possible.
• If any blocked processes remain, they are deadlocked.

Question 3:

What is thrashing? How does it happen? When are the two mechanisms to prevent thrashing?
Describe them.
(10 Marks)

Answer :
Thrashing occurs when a system spends more time processing page faults than executing
transactions. While processing page faults it is necessary to be in order to appreciate the benefits of
virtual memory, thrashing has a negative effect on the system.

As the page fault rate increases, more transactions need processing from the paging device. The
queue at the paging device increases, resulting in increased service time for a page fault. While the
transactions in the system are waiting for the paging device, CPU utilisation, system throughput and
system response time decrease, resulting in below optimal performance of a system.

Thrashing becomes a greater threat as the degree of multiprogramming of the system increases.

The two techniques for prevent thrashing are Working-Set Model and Page-Fault Rate.

Working-Set Model:

Principle of Locality
Pages are not accessed randomly. At each instant of execution a program tends to use only a small
set of pages. As the pages in the set change, the program is said to move from one phase to
another. The principle of locality states that most references will be to the current small set of pages
in use.
Examples:

1) Instructions are fetched sequentially (except for branches) from the same page.

2) Array processing usually proceeds sequentially through the array functions repeatedly, access
variables in the top stack frame.

Ramification
If we have locality, we are unlikely to continually suffer page-faults. If a page consists of 1000
instructions in self-contained loop, we will only fault once (at most) to fetch all 1000 instructions.

Working Set Definition


The working set model is based on the assumption of locality. The idea is to examine the most
recent page references in the working set. If a page is in active use, it will be in the Working-set.

If it is no longer being used, it will drop from the working set.

The set of pages currently needed by a process is its working set.


WS(k) for a process P is the number of pages needed to satisfy the last k page references for
process P.

WS(t) is the number of pages needed to satisfy a process’s page references for the last t units of

6
time.
Either can be used to capture the notion of locality.

Working Set Policy


Restrict the number of processes on the ready queue so that physical memory can accommodate
the working sets of all ready processes. Monitor the working sets of ready processes and, when
necessary, reduce multiprogramming (i.e. swap) to avoid thrashing.

Exact computation of the working set of each process is difficult, but it can be estimated, by using
the reference bits maintained by the hardware to implement an aging algorithm for pages.

When loading a process for execution, pre-load certain pages. This prevents a process from having
to “fault into” its working set. May be only a rough guess at start-up, but can be quite accurate on
swap-in.

Page-Fault Rate
The working-set model is successful, and knowledge of the working set can be useful for prepaging,
but it is a scattered way to control thrashing. A page-fault frequency (page-fault rate) takes a more
direct approach. In this we establish upper and lower bound on the desired pagefault rate. If the
actual page fault rate exceeds the upper limit, we allocate the process another frame. If the page
fault rate falls below the lower limit, we remove a Frame from the process. Thus, we can directly
measure and control the page fault rate to prevent thrashing.

Establish “acceptable” page-fault rate.


• If actual rate too low, process loses frame.
• If actual rate too hign, process gains frame.

Question 4:

What are the factors important for selection of a file organisation? Discuss three important
file organisations mechanisms and their relative performance.
(10 Marks)
Answer :
The operating system abstracts (maps) from the physical properties of its storage devices to define a
logical storage unit i.e., the file. The operating system provides various system calls for file management
like creating, deleting files, read and write, truncate operations etc. All operating systems focus on
achieving device-independence by making the access easy regardless of the place of storage (file or
device). The files are mapped by the operating system onto physical devices. Many factors are considered
for file management by the operating system like directory structure, disk scheduling and management,
file related system services, input/output etc. Most
operating systems take a different approach to storing information.

Three common file organisations are byte sequence, record sequence and tree of disk blocks. Unix files
are structured in simple byte sequence form. In record sequence, arbitrary records can be read or written,
but a record cannot be inserted or deleted in the middle of a file. CP/M works according to this scheme. In
tree organisation each block hold n keyed records and a new record can be inserted anywhere in the tree.
The mainframes use this approach. The OS is responsible for the following activities with regard to the file
system:

• The creation and deletion of files


• The creation and deletion of directory
• The support of system calls for files and directories manipulation
• The mapping of files onto disk
• Backup of files on stable storage media (non-volatile).

A file directory is a group of files organised together. An entry within a directory refers to the file or
another directory. Hence, a tree structure/hierarchy can be formed. The directories are used to group files
belonging to different application/users.

The most common schemes for describing logical directory structure are:
Single-level directory
Two-level directory
Tree-structured directory

7
Acyclic-graph directory
General graph directory

Disk space management: The direct-access of disks and keeping files in adjacent areas of the disk is
highly desirable. But the problem is how to allocate space to files for effective disk space utilisation and
quick access. Also, as files are allocated and freed, the space on a disk become fragmented. The major
methods of allocating disk space are:

Continuous
Non continuous (Indexing and Chaining)

The operating system abstracts (maps) from the physical properties of its storage devices to def define a
logical storage unit i.e., the file. The operating system provides various system calls

Question 5:

How do you differentiate between pre-emptive and non pre-emptive scheduling? Briefly
describe round robin and shortest process next scheduling with examples for each.
(10 Marks)
Answer :
CPU scheduling deals with the problem of deciding which of the processes in the ready queue is to be
allocated to the CPU. A major division among scheduling algorithms is that whether they support pre-
emptive or non-pre-emptive scheduling discipline.

Pre-emptive scheduling: Pre-emption means the operating system moves a process from running to
ready without the process requesting it. An OS implementing these algorithms switches to the processing
of a new request before completing the processing of the current request. The preempted request is put
back into the list of the pending requests. Its servicing would be resumed sometime in the future when it
is scheduled again. Pre-emptive scheduling is more useful in high priority process which requires
immediate response. For example, in Real time system the consequence of missing one interrupt could be
dangerous.

Round Robin scheduling, priority based scheduling or event driven scheduling and SRTN are considered to
be the pre-emptive scheduling algorithms.

Non-Pre-emptive scheduling: A scheduling discipline is non-pre-emptive if once a process has been


allotted to the CPU, the CPU cannot be taken away from the process. A non-pre-emptive discipline always
processes a scheduled request to its completion. In non-pre-emptive systems, jobs are made to wait by
longer jobs, but the treatment of all processes is fairer.

First come First Served (FCFS) and Shortest Job First (SJF), are considered to be the non-preemptive
scheduling algorithms.

Round Robin (RR)


Round Robin (RR) scheduling is a pre-emptive algorithm that relates the process that has been waiting the
longest. This is one of the oldest, simplest and widely used algorithms. The round robin scheduling
algorithm is primarily used in time-sharing and a multi-user system environment where the primary
requirement is to provide reasonably good response times and in general to share the system fairly
among all system users. Basically the CPU time is divided into time slices.

Each process is allocated a small time-slice called quantum. No process can run for more than one
quantum while others are waiting in the ready queue. If a process needs more CPU time to complete after
exhausting one quantum, it goes to the end of ready queue to await the next allocation. To implement the
RR scheduling, Queue data structure is used to maintain the Queue of Ready processes. A new process is
added at the tail of that Queue. The CPU scheduler picks the first process from the ready Queue, Allocate
processor for a specified time Quantum. After that time the CPU scheduler will select the next process is
the ready Queue.

Consider the following set of process with the processing time given in milliseconds:

Process Processing Time


P1 24
P2 03

8
P3 03

If we use a time Quantum of 4 milliseconds then process P1 gets the first 4 milliseconds. Since it requires
another 20 milliseconds, it is pre-empted after the first time Quantum, and the CPU is given to the next
process in the Queue, Process P2. Since process P2 does not need 4 milliseconds, it quits before its time
Quantum expires. The CPU is then given to the next process, Process P3 one each process has received 1
time Quantum, the CPU is returned to process P1 for an additional time quantum. The Gantt chart will be:

P1 P2 P3 P1 P1 P1 P1 P1
0 4 7 10 14 18 22 26 30

Process Processing Time Turn around time=t(Process Completed)- t(Process Submitted) Waiting
Time=Turn around time – Processing time

P1 24 30 – 0 = 30 30 – 24 = 6
P2 03 7 – 0 = 7 7 – 3 = 4
P3 03 10 – 0 = 10 10 – 3 = 7

Average turn around time = (30+7+10)/3 = 47/3 = 15.66


Average waiting time = (6+4+7)/3 = 17/3 = 5.66
Throughput = 3/30 = 0.1
Processor utilization = (30/30)*100 = 100%

Shortest Remaining Time Next (SRTN): (Shortest Process Next)


This is the pre-emptive version of shortest job first. This permits a process that enters the ready list to
pre-empt the running process if the time for the new process (or for its next burst) is less than the
remaining time for the running process (or for its current burst). Example:

Consider the set of four processes arrived as per timings described in the table:

Process Arrival Time Processing Time


P1 0 5
P2 1 2
P3 2 5
P4 3 3

At time 0, only process P1 has entered the system, so it is the process that executes. At time 1, process
P2 arrives. At that time, process P1 has 4 time units left to execute. At this juncture process 2’s
processing time is less compared to the P1 left out time (4 units). So P2 starts executing at time 1. At
time 2, process P3 enters the system with the processing time 5 units.Process P2 continues executing as it
has the minimum number of time units when compared with P1 and P3. At time 3, process P2 terminates
and process P4 enters the system. Of the processes P1, P3 and P4, P4 has the smallest remaining
execution time so it starts executing. When process P1 terminates at time 10, process P3 executes. The
Gantt chart is shown below:

P1 P2 P4 P1 P3
0 1 3 6 10 15

Turnaround time for each process can be computed by subtracting the time it terminated from the arrival
time.

Turn around Time = t(Process Completed) – t(Process Submitted)


The turnaround time for each of the processes is:
P1: 10 – 0 = 10
P2: 3 – 1 = 2
P3: 15 – 2 = 13
P4: 6 – 3 = 3
The average turnaround time is (10+2+13+3) / 4 = 7
The waiting time can be computed by subtracting processing time from turnaround time, yielding the
following 4 results for the processes as
P1: 10 – 5 = 5
P2: 2 – 2 = 0
P3: 13 – 5 = 8
P4: 3 – 3 = 0
The average waiting time = (5+0+8+0) /4 = 3.25 milliseconds.
Four jobs executed in 15 time units, so throughput is 15/4 = 3.75 time units/job.

9
Question 6:

i) What are the main differences between capabilities lists and access lists? Explain through
examples.
(10 Marks)
Answer :
The access matrix model for computer protection is based on abstraction of operating system
structures. Because of its simplicity and generality, it allows a variety of implementation techniques,
as has been widely used.

There are three principal components in the access matrix model:


• A set of passive objects,
• A set of active subjects, which may manipulate the objects,
• A set of rules governing the manipulation of objects by subjects.

Objects are typically files, terminals, devices, and other entities implemented by an operating system.
A subject is a process and a domain (a set of constraints within which the process may access certain
objects). It is important to note that every subject is also an object; thus it may be read or otherwise
manipulated by another subject. The access matrix is a rectangular array with one row per subject
and one column per object. The entry for a particular row and column reflects the mode of access
between the corresponding subject and object. The mode of access allowed depends on the type of
the object and on the functionality of the system; typical modes are read, write, append, and
execute.

All accesses to objects by subjects are subject to some conditions laid down by an enforcement
mechanism that refers to the data in the access matrix. This mechanism, called a reference monitor,
rejects any accesses (including improper attempts to alter the access matrix data) that are not
allowed by the current protection state and rules. References to objects of a given type must be
validated by the monitor for that type. While implementing the access matrix, it has been observed
that the access matrix tends to be very sparse if it is implemented as a two-dimensional array.

Consequently, implementations that maintain protection of data tend to store them either row wise,
keeping with each subject a list of objects and access modes allowed on it; or column wise, storing
with each object a list of those subjects that may access it and the access modes allowed on each.
The former approach is called the capability list approach and the latter is called the access control list
approach.

In general, access control governs each user’s ability to read, execute, change, or delete information
associated with a particular computer resource. In effect, access control works at two levels: first, to
grant or deny the ability to interact with a resource, and second, to control what kinds of operations
or activities may be performed on that resource. Such controls are managed by an access control
system.

ii) What is the Kernel of an operating system? What functions are normally performed by
the Kernel? Gives several reasons why it is effective to design micro Kernel.
(10 Marks)

Answer :
The operating system, referred to in UNIX as the kernel, interacts directly with the hardware and provides
the services to the user programs. These user programs don’t need to know anything about the hardware.
They just need to know how to interact with the kernel and it’s up to the kernel to provide the desired
service. One of the big appeals of UNIX to programmers has been that most well written user programs
are independent of the underlying hardware, making them readily portable to new systems.

User programs interact with the kernel through a set of standard system calls. These system calls request
services to be provided by the kernel. Such services would include accessing a file: open close, read,
write, link, or execute a file; starting or updating accounting records; changing ownership of a file or
directory; changing to a new directory; creating, suspending, or killing a process; enabling access to
hardware devices; and setting limits on system resources.

UNIX is a multi-user, multi-tasking operating system. You can have many users logged into a system

10
simultaneously, each running many programs. It is the kernel’s job to keep each process and user
separate and to regulate access to system hardware, including CPU, memory, disk and other I/O devices.

Operating systems can be either monolithic (e.g., UNIX and Windows) or modular (e.g., Mach and
Windows NT). A modular operating system is called a micro kernel. A micro-kernel OS has a small
minimalist kernel that includes as little functionality as possible.

------------------------------------------

Course Code : MCS-042


Course Title : Data Communication and Computer Networks
Assignment Number : MCA(4)/042/Assign/09
Maximum Marks : 100
Weightage : 25%
Last Date of Submission : 15th October, 2009 (for July,2009 session)
15th April, 2010 (for January, 2010 session)

This assignment has five questions, which carries 80 marks. Answer all questions.
Rest 20 marks are for viva voce. You may use illustrations and diagrams to enhance
the explanations. Please go through the guidelines regarding assignments given in
the Programme Guide for the format of presentation. Answer to each part of the
question should be confined to about 300 words.

Question 1:

i) What are the Nyquist and the Shannon limits on the channel capacity? Elaborate through
examples.
(8 Marks)
In information theory, the Shannon–Hartley theorem is an application of the noisy channel coding
theorem to the archetypal case of a continuous-time analog communications channel subject to
Gaussian noise. The theorem establishes Shannon's channel capacity for such a communication link, a
bound on the maximum amount of error-free digital data (that is, information) that can be
transmitted with a specified
bandwidth in the presence of the noise interference, under the assumption that the signal power is
bounded and the Gaussian noise process is characterized by a known power or power spectral
density. The law is named after Claude Shannon and Ralph Hartley

Statement of the theorem


Considering all possible multi-level and multi-phase encoding techniques, the Shannon–Hartley
theorem states that the channel capacity C, meaning the theoretical tightest upper bound on the
information rate (excluding error correcting codes) of clean (or arbitrarily low bit error rate) data that
can be sent with a given average signal power S through an analog communication channel subject to
additive white Gaussian noise of power N, is:
C = B log2(1 + S/N)

where
C is the channel capacity in bits per second;
B is the bandwidth of the channel in hertz (passband bandwidth in case of a modulated signal);
S is the total received signal power over the bandwidth (in case of a modulated signal, often denoted
C, i.e. modulated carrier), measured in watt or volt2;
N is the total noise or interference power over the bandwidth, measured in watt or volt2; and
S/N is the signal-to-noise ratio (SNR) or the carrier-to-noise ratio (CNR) of the communication signal
to the Gaussian noise interference expressed as a linear power ratio (not as logarithmic decibels).

Historical development
During the late 1920s, Harry Nyquist and Ralph Hartley developed a handful of fundamental ideas
related to the transmission of information, particularly in the context of the telegraph as a

11
communications system. At the time, these concepts were powerful breakthroughs individually, but
they were not part of a comprehensive theory. In the 1940s, Claude Shannon developed the concept
of channel capacity, based in part on the ideas of Nyquist and Hartley, and then formulated a
complete theory of information and its transmission.

Nyquist rate
In 1927, Nyquist determined that the number of independent pulses that could be put through a
telegraph channel per unit time is limited to twice the bandwidth of the channel. In symbols, where fp
is the pulse frequency (in pulses per second) and B i s the bandwidth (in hertz). The quantity 2B later
came to be called the Nyquist rate, and transmitting at the limiting pulse rate of 2B pulses per second
as signalling at the Nyquist rate. Nyquist published his results in 1928 as part of his paper "Certain
topics in Telegraph Transmission Theory."

ii) Differentiate between the followings:

a) FDM and TDM


b) Circuit switching and packet switching
c) Virtual circuit and diagram
d) Stop and wait protocol and sliding window protocol
(12 Marks)

a) FDM and TDM


The resource allocation method is the most important factor for the efficient design of SubMAP.
Particularly, the multiplexing between data regions and control regions is a key hardware out there to
support. Second, and perhaps more or at least very important, it could well turn up on the test. If one
question stands between you and passing, don’t make this the one you miss. In principle, circuit
switching and packet switching both are used in high-capacity networks. In circuit-switched networks,
network resources are static, set in “copper” if you will, from the sender to receiver before the start of
the transfer, thus creating a “circuit”. The resources remain dedicated to the circuit during the entire
transfer and the entire message follows the same path. In
packet-switched networks, the message is broken into packets, each of which can take a different
route to the destination where the packets are recompiled into the original message. All the above
can be handled by a router or a switch but much of IT today is going toward flat switched networks.
So when we’re talking about circuit switching or packet switching, we are more and more talking
about doing it on a switch.

Switched Networks
First, let’s be sure we understand what we mean by a switched network. A switched network goes
through a switch instead of a router. This actually is the way most networks are headed, toward flat
switches on VLANs instead of routers. Still, it’s not always easy to tell a router from a switch. It’s
commonly believed that the difference between a switched network and a routed network is simple
binary opposition. T’ain’t so. A router operates at Layer 3 of the OSI Model and can create and
connect several logical networks, including those of different network topologies, such as Ethernet
and Token Ring. A router will provide multiple paths (compared to only one on a bridge) between
segments and will map nodes on a segment and the connecting paths with a routing protocol and
internal routing tables. Being a Layer 3 device, the router uses the destination IP address to decide
where a frame should go. If the destination IP address is on a segment directly connected to the
router, then the router will forward the frame out the appropriate port to that segment. If not, the
router will search its routing table for the correct destination, again, using that IP address.

Having talked about a router as being a Layer 3 device, think about what I’m about to say next as a
general statement. I know there are exceptions, namely the Layer 3 switch. We’re not going to get
into that, not in this article.

A switch is very like a bridge in that is usually a layer 2 device that looks to MAC addresses to
determine where data should be directed. A switch has other applications in common with a bridge.
Like a bridge, a switch will use transparent and source-route methods to move data and Spanning
Tree Protocol ( STP) to avoid loops. However, switches are superior to bridges because they provide
greater port density and they
can be configured to make more intelligent decisions about where data goes.

The three most common switch methods are:

12
1. Cut-through - Streams data so that the first part of a packet exits the switch before the rest of
the packet has finished entering the switch, typically within the first 12 bytes of an Ethernet frame.

2. Store-and-Forward - The entire frame is copied into the switch's memory buffer and it stays
there while the switch processes the Cyclical Redundancy Check CRC) to look for errors in the frame.
If the frame contains no errors, it will be forwarded. If a frame contains an error, it will be dropped.
Obviously, this method has higher latency than cut-through but there will be no fragments or bad
frames taking up bandwidth.

3. Fragment-free Switching - Think of this as a hybrid of cut-through and store-and-forward. The


switch reads only the first 64 bytes of the frame into buffer

c) Virtual Circuit and Diagram


Differences between datagram and virtual circuit networks
There are a number of important differences between virtual circuit and datagram networks. The
choice strongly impacts complexity of the different types of node. Use of datagram’s between
intermediate nodes allows relatively simple protocols at this level, but at the expense of making the
end (user) nodes more complex when end-to-end virtual circuit service is desired.

The Internet transmits data grams between intermediate nodes using IP. Most Internet users need
additional functions such as end-to-end error and sequence control to give a reliable service
(equivalent to that provided by virtual circuits). This reliability may be provided by the Transmission
Control Protocol (TCP) which is used end-to-end across the Internet, or by applications such as the
trivial file transfer protocol (tftp) running on top of the User Datagram Protocol (UDP).

d) Stop and Wait Protocol and Sliding Window Protocol


This experiment will bring out the correct choice of the packet sizes for transmission in noisy
channels.Open two sliding window (S/W) applications, each in one computer. Assign Node Id 1 as
receiver and Node Id 0 as sender. Conduct the experiment for 200 secs. Set the link rate to be 8kbps.
Set the protocol to CSMA/CD.Set the No. of Packets (Window size) to 1 in both nodes (because Stop
and Wait protocol is a window size-1 algorithm). Make sure the No. of Nodes is set to 2 and the Inter
Packet delay (IPD) in both the nodes is set to 0. This makes sure no delay is introduced in the
network other than the transmission delay. Set the Tx/Rx Mode to be Promiscous mode and the
direction as sender or Receiver accordingly. Set BER to 0 and run the experiment. Find out the size of
the transmitted packets and the acknowledgement packets received. Calculate the overhead involved
in the transmitted packets for different packet sizes. Choose packet sizes 10 ..100 bytes in multiples
of 10. Now set BER to 10-3 and perform the experiment. Give timeout as 1000ms. Calculate the
throughputs. Perform the previous steps now for a BER of 10-4 for packet sizes (100..900) bytes in
steps of 100 and calculate the throughputs. Packet sizes are chosen longer, as the BER is less. Give
larger timeout as packets are longer(say, 2000ms). Plot throughput vs packet size curves and find out
the optimum packet size for the different BERs .

Sliding Window Protocol


This experiment will bring out the necessity of increasing the transmitter and receiver window sizes
and the correct choice of the window size in a delay network.

1. Set up the same configuration as for the previous experiment.

2. Set BER to 0 and fix the packet size at 100 bytes.

3. Set IPD at the sender constantly at 20 ms and the IPD at the receiver to vary between 40 to 190
ms (in steps of 50). This setting simulates various round-trip delays in the network.

4. Change the Window sizes from 1 to 5 in both the nodes together. Give large timeout, 10000ms, as
this will make sure that there are very few re-transmissions. Now perform the experiment.

5. Plot the throughput vs Window Sizes for different IPDs and find out the optimum window size for
different delays.

Question 2:

i) Compare the features of different 10 Mbps, 100 Mbps and 1000 Mbps Ethernet technologies.

13
(5 Marks)
----->
10-Mbps Ethernet—10Base-T
10Base-T provides Manchester-encoded 10-Mbps bit-serial communication over two unshielded twisted-pair
cables. Although the standard was designed to support transmission over common telephone cable, the more
typical link configuration is to use two pair of a four-pair Category 3 or 5 cable, terminated at each NIC with an 8-
pin RJ-45 connector (the MDI), as shown in Figure 7-15. Because each active pair is configured as a simplex link
where transmission is in one direction only, the 10Base-T physical layers can support either half-duplex or full-
duplex operation.

Figure 7-15 The Typical 10Base-T Link Is a Four-Pair UTP Cable in Which Two Pairs Are Not Used

Although 10Base-T may be considered essentially obsolete in some circles, it is included here because there are
still many 10Base-T Ethernet networks, and because full-duplex operation has given 10BaseT an extended life.
10Base-T was also the first Ethernet version to include a link integrity test to determine the health of the link.
Immediately after powerup, the PMA transmits a normal link pulse (NLP) to tell the NIC at the other end of the link
that this NIC wants to establish an active link connection:
• If the NIC at the other end of the link is also powered up, it responds with its own NLP.

• If the NIC at the other end of the link is not powered up, this NIC continues sending an NLP about once every
16 ms until it receives a response.

The link is activated only after both NICs are capable of exchanging valid NLPs.

100 Mbps—Fast Ethernet


Increasing the Ethernet transmission rate by a factor of ten over 10Base-T was not a simple task, and the effort
resulted in the development of three separate physical layer standards for 100 Mbps over UTP cable: 100Base-TX
and 100Base-T4 in 1995, and 100Base-T2 in 1997. Each was defined with different encoding requirements and a
different set of media-dependent sublayers, even though there is some overlap in the link cabling. Table 7-2
compares the physical layer characteristics of 10Base-T to the various 100Base versions.

Table 7-2 Summary of 100Base-T Physical Layer Characteristics

Ethernet Transmit Encoding Cabling Full-Duplex


Version Symbol Rate1 Operation

10Base-T 10 MBd Manchester Two pairs of UTP Supported


Category -3 or better

100Base-TX 125 MBd 4B/5B Two pairs of UTP Supported


Category -5 or Type 1
STP

14
100Base-T4 33 MBd 8B/6T Four pairs of UTP Not supported
Category -3 or better

100Base-T2 25 MBd PAM5x5 Two pairs of UTP Supported


Category -3 or better

1
One baud = one transmitted symbol per second, where the transmitted symbol may contain the equivalent value of 1 or more binary bits.
Although not all three 100-Mbps versions were successful in the marketplace, all three have been discussed in the
literature, and all three did impact future designs. As such, all three are important to consider here.

100Base-X
100Base-X was designed to support transmission over either two pairs of Category 5 UTP copper wire or two
strands of optical fiber. Although the encoding, decoding, and clock recovery procedures are the same for both
media, the signal transmission is different—electrical pulses in copper and light pulses in optical fiber. The signal
transceivers that were included as part of the PMA function in the generic logical model of Figure 7-14 were
redefined as the separate physical media-dependent (PMD) sublayers shown in Figure 7-16.

Figure 7-16 The 100Base-X Logical Model

The 100Base-X encoding procedure is based on the earlier FDDI optical fiber physical media-dependent and
FDDI/CDDI copper twisted-pair physical media-dependent signaling standards developed by ISO and ANSI. The
100Base-TX physical media-dependent sublayer (TP-PMD) was implemented with CDDI semiconductor
transceivers and RJ-45 connectors; the fiber PMD was implemented with FDDI optical transceivers and the Low
Cost Fibre Interface Connector (commonly called the duplex SC connector).
The 4B/5B encoding procedure is the same as the encoding procedure used by FDDI, with only minor adaptations
to accommodate Ethernet frame control. Each 4-bit data nibble (representing half of a data byte) is mapped into a
5-bit binary code-group that is transmitted bit-serial over the link. The expanded code space provided by the 32 5-
bit
code-groups allow separate assignment for the following:
• The 16 possible values in a 4-bit data nibble (16 code-groups).

• Four control code-groups that are transmitted as code-group pairs to indicate the start-of-stream delimiter
(SSD) and the end-of-stream delimiter (ESD). Each MAC frame is "encapsulated" to mark both the beginning

15
and end of the frame. The first byte of preamble is replaced with SSD code-group pair that precisely identifies
the frame's code-group boundaries. The ESD code-group pair is appended after the frame's FCS field.

• A special IDLE code-group that is continuously sent during interframe gaps to maintain continuous
synchronization between the NICs at each end of the link. The receipt of IDLE is interpreted to mean that the
link is quiet.

• Eleven invalid code-groups that are not intentionally transmitted by a NIC (although one is used by a repeater
to propagate receive errors). Receipt of any invalid code-group will cause the incoming frame to be treated as
an invalid frame.

Figure 7-17 shows how a MAC frame is encapsulated before being transmitted as a 100Base-X code-group
stream.

----->
ii) Explain the basic operation of collision detection in Ethernet.
(5 Marks)

CSMA/CD is a modification of pure Carrier Sense Multiple Access (CSMA).

Collision detection is used to improve CSMA performance by terminating transmission as soon as a


collision is detected, and reducing the probability of a second collision on retry.

Methods for collision detection are media dependent, but on an electrical bus such as Ethernet,
collisions can be detected by comparing transmitted data with received data. If they differ, another
transmitter is overlaying the first transmitter's signal (a collision), and transmission terminates
immediately. A jam signal is sent which will cause all transmitters to back off by random intervals,
reducing the probability of a collision when the first retry is attempted.

In our conversation, we can handle this situation gracefully. We both hear the other speak at the
same time we are speaking, so we can stop to give the other person a chance to go on. Ethernet
nodes also listen to the medium while they transmit to ensure that they are the only station
transmitting at that time. If the stations hear their own transmission returning in a garbled form, as
would happen if some other station had begun to transmit its own message at the same time,
then they know that a collision occurred. A single Ethernet segment is sometimes called
a collision domain because no two stations on the segment can transmit at the same time
without causing a collision. When stations detect a collision, they cease transmission, wait a
random amount of time, and attempt to transmit when they again detect silence on the medium.
The random pause and retry is an important part of the protocol. If two stations collide when
transmitting once, then both will need to transmit again. At the next appropriate chance to
transmit, both stations involved with the previous collision will have data ready to transmit. If they
transmitted again at the first opportunity, they would most likely collide again and again
indefinitely. Instead, the random delay makes it unlikely that any two stations will collide more
than a few times in a row.

iii) Compare the advantages of fibre optics over copper wire and coaxial cable.
(5 Marks)

16
Fiber Optic Benefits and Fiber Optic Advantages
Fiber-optic systems use pulses of light traveling through an optical fiber to transmit data. This
method offers many advantages over copper wire, some of which are not available with other
technology:

 Complete input/output electrical isolation


 No electromagnetic interference (EMI) susceptibility or radiation along the transmission
media
 Broad bandwidth over a long distance
 Light-weight, small-diameter cables
 Equal to the cost of copper wire and connectors (except when copper wire is already
installed)
So let’s explain the fiber optic benefits and advantages in detail below:
1. Electromagnetic Interference (EMI)
Because optical fiber transmits light rather than electrons, it neither radiates EM (electromagnetic)
fields nor is it susceptible to any EM fields surrounding it. This is important in a number of
applications:

 Industrial control, where cables run along factory floors in proximity to electrically noisy
machinery. The optical medium permits the control signals to be carried error-free through
the electrically noisy environment.
 Telecommunications equipment manufacturers use optical fiber because it eliminates cross
talk between the telecommunication lines.
 Financial institutions and gaming equipment manufacturers require data security. Tapping
into a fiber cable without being detected is extremely difficult.
2. High Bandwidth
Optical fiber has a relatively high bandwidth in comparison to other transmission media. This
permits much longer transmission distances and much higher signal rates than most media. For
example, all undersea long-haul telecommunications cable is fiber-optic.

This technology is allowing worldwide communications (voice, video and data) to be available
mainstream. With new technologies, such as VCSEL transmitters, parallel optics and wavelength
division multiplexing (WDM), services such as video-on-demand and video conferencing will be
available to most homes in the near future.

3. Voltage Isolation and Voltage Insulation


Fiber isolates two different voltage potentials. and insulates in high-voltage areas. For example, it
will eliminate errors due to ground-loop potential differences and is ideal for data transmission in
areas subject to frequent electrical storms, and presents no hazard to the field installer.

4. Weight and Diameter


A 100 meter coaxial cable transmitting 500 megabits of data per unit time is about 800 percent
heavier than a plastic fiber cable and about 700 percent heavier than a hard-clad silica cable, all of
equal length and transmitting at the same data rate.

The relative diameters of various types of fiber cable and coaxial copper cable for the same distance
and data rate are shown in the illustration below.

17
T
BRIEF OVER VIEW OF FIBER OPTIC CABLE ADVANTAGES OVER COPPER:

• SPEED: Fiber optic networks operate at high speeds - up into the


gigabits
• BANDWIDTH: large carrying capacity
• DISTANCE: Signals can be transmitted further without needing to be
"refreshed" or strengthened.
• RESISTANCE: Greater resistance to electromagnetic noise such as
radios, motors or other nearby cables.
• MAINTENANCE: Fiber optic cables costs much less to maintain.

--0

Advantages:
Capacity Optical fibres carry signals with much less energy loss than copper cable and with a much higher
bandwidth . This means that fibres can carry more channels of information over longer distances and with
fewer repeaters required. Size and Weight Optical fibre cables are much lighter and thinner than copper
cables with the same bandwidth. This means that much less space is required in underground cabling
ducts. Also they are easier for installation engineers to handle. Security Optical fibres are much more
difficult to tap information from undetected; a great advantage for banks and security installations. They
are immune to Electromagnetic interference from radio signals, car ignition systems, lightning etc. They
can be routed safely through explosive or flammable atmospheres, for example, in the petrochemical
industries or munitions sites, without any risk of ignition. Running Costs The main consideration in
choosing fibre when installing domestic cable TV networks is the electric bill. Although copper coaxial cable
can handle the bandwidth requirement over the short distances of a housing scheme, a copper system
consumes far more electrical power than fibre, simply to carry the signals. Disadvantages:

18
Price

In spite of the fact that the raw material for making optical fibres, sand, is abundant and cheap,
optical fibres are still more expensive per metre than copper. Having said this, one fibre can carry
many more signals than a single copper cable and the large transmission distances mean that fewer
expensive repeaters are required.

Special Skills

Optical fibres cannot be joined together (spliced) as a easily as copper cable and requires additional
training of personnel and expensive precision splicing and measurement equipment.

Print RSS
Top 5 Reasons to Use Fiber Optic Cables
Posted Friday, July 17, 2009 By Paul Holstein, COO,CableOrganizer.com
ADVERTISEMENT

Industrys one of the leading eTailer adds an array of new Fiber Optic solutions to its comprehensive online
catalogue now boasting more than 2,300 Fiber Optic-related SKUs.

To help consumers better, discern the benefits of using Fiber Optic cabling over copper cabling for
telecommunications and datacom network applications, CableOrganizer.com, among the worlds foremost
providers of Fiber Optic and other cable, wire and equipment management-related products for use in
business and at home, today issued 5 key reasons to choose Fiber Optics.

Why Fiber Optic cables over copper?

1. Fiber Optic is so much more efficientand secure than copper cabling. In comparison, Fiber Optic cables
can transmit far more information, and with a greater degree of fidelity. In fact, fiber links offer over 1,000
times as much bandwidth over distances over 100 times further than copper. Fiber Optic cabling also offers
extra security for the data being transmitted, since it is far more difficult to tap than copper cable.

2. Only Fiber Optics can go the distance. Not only is Fiber Optic cable capable of carrying far more data
than copper, it also has the ability to carry that information for much longer distances. Indeed, a Fiber Optic
cable can easily transmit a signal as far as 80 km or more without the need for amplification.
Â
3. Fiber Optics cant be interfered with! Because Fiber Optic cables are glass-based, they dont conduct
electricity. This eliminates the need for grounding, and makes them immune to any type of electrical
interference - even lightning. Since Fiber Optic cabling is so resistant to interference and atmospheric
conditions, it can be used outdoors - and in close proximity to electrical cables - without concern.

4. Fiber Optic cables dont mind roughing it. Glass fibers dont only escape interference but they are also
virtually free from the threat of corrosion, too! While copper cabling is sensitive to water and chemicals,
Fiber Optic cabling runs almost no risk of being damaged by harsher elements. As a result, Fiber Optic
cables can easily endure living conditions that coaxial cable just cant, such as being put in direct contact
with soil, or in close proximity to chemicals.

5. You may be surprised by Fiber Optics, but you wont be shocked. A major benefit of Fiber Optic cabling
is that it doesnt pose a threat of physical injury to the user if it breaks. Since Fiber Optic cabling transmits
light and not electricity, the people handling it run no risk of injury from fire, sparking or electrocution.

Fiber Optic cabling has advantages over standard copper coaxial cables, in that it can transmit larger
quantities of data with far less loss, is able to maintain signals over long distances, carries little risk of
corrosion, and is virtually free from interference, concludes Paul Holstein, COO,CableOrganizer.com

Question 3:

19
i) Describe how is the TCP/IP protocol stack organised compared to the ISI/OSI protocol stack.
(5 Marks)
A protocol stack (sometimes communications stack) is a particular software implementation of
a computer networking protocol suite. The terms are often used interchangeably. Strictly speaking,
the suite is the definition of the protocols, and the stack is the software implementation of them.

A. TCP/IP Protocol Stack

The Internet Protocol Suite (commonly known as TCP/IP) is the set of communications
protocols used for the Internet and other similar networks. It is named from two of the most
important protocols in it: the Transmission Control Protocol (TCP) and the Internet Protocol (IP),
which were the first two networking protocols defined in this standard.

20
1. Application Layer

Application Layer is a term used in categorizing protocols and methods in architectural models
of computer networking. Both the OSI model and the Internet Protocol Suite (TCP/IP) define
application layers.

In TCP/IP, the Application Layer contains all protocols and methods that fall into the realm of process-
to-process communications via an Internet Protocol (IP) network using the Transport Layer protocols
to establish underlying host-to-host connections.

In the OSI model, the definition of its Application Layer is not narrower in scope, distinguishing
explicitly additional functionality above the Transport Layer at two additional levels: Session
Layer and Presentation Layer. OSI specifies strict modular separation of functionality at these layers
and provides protocol implementations for each layer.

The common application layer services provide semantic conversion between associated application
processes. Note: Examples of common application services of general interest include the virtual
file, virtual terminal, and job transfer and manipulation protocols.

2. Transport Layer

Transport Layer is a group of methods and protocols within a layered architecture of network
components within which it is responsible for encapsulating application data blocks into data units
(datagrams, TCP segments) suitable for transfer to the network infrastructure for transmission to the
destination host, or managing the reverse transaction by abstracting network datagrams and delivering
their payload to an application. Thus the protocols of the Transport Layer establish a direct, virtual

21
host-to-host communications transport medium for applications and therefore also referred to
as transport protocols.

Transport layers are contained in both the TCP/IP model (RFC 1122),[1] which is the foundation of
the Internet, and the Open Systems Interconnection (OSI) model of general networking. The
definitions of the Transport Layer are slightly different in these two models

3. Internet Layer

The Internet Layer is a group of internetworking methods in the TCP/IP protocol suite which is the
foundation of the Internet (RFC 1122). It is the group of methods, protocols, and specifications which
are used to transport datagrams (packets) from the originating host across network boundaries, if
necessary, to the destination host specified by a network address (IP address) which is defined for this
purpose by the Internet Protocol (IP). The Internet Layer derives its name from its function of forming
an "internet" (uncapitalized), or facilitating "internetworking", which is the concept of connecting
multiple networks with each other through gateways.

Internet Layer protocols use IP-based packets. The Internet Layer does not include the protocols that
define communication between local ("on-link") network nodes which fulfill the purpose of maintaining
link states between the local nodes, such as the local network topology, and that usually use protocols
that are based on the framing of packets specific to the link types. Such protocols belong to the Link
Layer.

4. Link Layer

Link Layer is the lowest layer in the Internet Protocol Suite, the networking architecture of
the Internet (RFC 1122, RFC 1123). It is the group of methods or protocols that only operate on a
host's link. The link is the physical and logical network components used to
interconnect hosts or nodes in the network and a link protocol is a suite of methods and standards that
operate only between adjacent network nodes of a Local area network segment or a wide area
network connection.

Despite the different semantics of layering in TCP/IP and OSI, the Link Layer is often described as a
combination of the Data Link Layer (Layer 2) and the Physical Layer (Layer 1) in theOpen Systems
Interconnection (OSI) protocol stack. However, TCP/IP's layers are descriptions of operating scopes
(application, host-to-host, network, link) and not detailed prescriptionsof operating procedures, data
semantics, or networking technologies.

22
B. OSI Protocol Stack

The Open Systems Interconnection (OSI) protocols are a family of information exchange standards
developed jointly by the ISO and the ITU-T starting in 1977. The OSI model describes seven layers of
interconnection:

1. Physical Layer

2. Data Link Layer

3. Network Layer

4. Transport Layer

5. Session Layer

6. Presentation Layer

7. Application Layer

OSI protocols are used to implement various networks. The OSI protocol stack is split into layers for
modularity and orthogonal design. The layers form a hierarchy of functionality starting with the physical
hardware components to the user interfaces at the software application level. Each layer receives
information from the layer above, processes it and passes it down to the next layer. Each layer adds
its own encapsulation information (header) to the incoming information before it is passed to the lower
layer. Headers generally include address of destination and source, check sums (for error control),
type of protocol used in the current layer, and other options such as flow control options and sequence
numbers (used to ensure data is sent in order).

1. Physical Layer

This layer deals with the physical plugs and sockets and electrical specification of signals.

This is the medium over which the digital signals are transmitted. It can be twisted pair, coaxial
cable, optical fiber, wireless, or other transmission media.

[edit]2. Data Link Layer

The Data Link layer packages raw bits from the Physical layer into frames (logical, structured packets
for data). It is specified in ITU-T Rec. X.212 [ISO/IEC 8886], ITU-T Rec. X.222 and others. This layer is
responsible for transferring frames from one host to another. It might perform error checking.

23
[edit]3. Network Layer

 Connectionless Network Service (CLNS) – ITU-T Rec. X.213 [ISO/IEC 8348]. SCCP is based
on X.213.

 Connectionless Network Protocol (CLNP) – ITU-T Rec. X.233 [ISO/IEC 8473-1].

 Connection-Oriented Network Service (CONS) – ITU-T Rec. X.213 [ISO/IEC 8348].

 Connection-Oriented Network Protocol (X.25) – ITU-T Rec. X.233 [ISO/IEC 8878]. This is the
use of the X.25 protocol to provide the CONS.

 Network Fast Byte Protocol – ISO/IEC 14700

 End System to Intermediate System Routing Exchange Protocol (ES-IS) - ISO/IEC 9452
(reprinted in RFC 995).

 Intermediate System to Intermediate System Intra-domain Routing Protocol (IS-IS) - ISO/IEC


10589 (reprinted in RFC 1142), later adapted for the TCP/IP model.

 End System Routing Information Exchange Protocol for use with ISO/IEC 8878 (SNARE)
– ITU-T Rec. X.116 [ISO/IEC 10030].

This level is in charge of transferring data between systems in a network, using network-layer
addresses of machines to keep track of destinations and sources. This layer uses routers and switches
to manage its traffic (control flow control, error check, routing etc).

[edit]4. Transport Layer

The connection-mode and connectionless-mode transport services are specified by ITU-T Rec. X.214
[ISO/IEC 8072]; the protocol that provides the connection-mode service is specified by ITU-T Rec.
X.224 [ISO/IEC 8073], and the protocol that provides the connectionless-mode service is specified
by ITU-T Rec. X.234 [ISO/IEC 8602].

 Transport Protocol Class 0 (TP0)

 Transport Protocol Class 1 (TP1)

 Transport Protocol Class 2 (TP2)

 Transport Protocol Class 3 (TP3)

 Transport Protocol Class 4 (TP4)

 Transport Fast Byte Protocol – ISO 14699

The transport layer transfers data between source and destination processes. Generally, two
connection modes are recognized, connection-oriented or connectionless. Connection-oriented service
establishes a dedicated virtual circuit and offers various grades of guaranteed delivery, ensuring that

24
data received is identical to data transmitted. Connectionless mode provides only best-effort service
without the built-in ability to correct errors, which includes complete loss of data without notifying the
data source of the failure. No logical connection, and no persistent state of the transaction exists
between the endpoints, lending the connectionless mode low overhead and potentially better real-time
performance for timing-critical applications such as voice and video transmissions.

[edit]5. Session Layer

 Session service – ITU-T Rec. X.215 [ISO/IEC 8326]

 Connection-oriented Session protocol – ITU-T Rec. X.225 [ISO/IEC 8327-1]

 Connectionless Session protocol – ITU-T Rec. X.235 [ISO/IEC 9548-1]

[edit]6. Presentation Layer

 Presentation service – ITU-T Rec. X.216 [ISO/IEC 8822]

 Connection-oriented Presentation protocol – ITU-T Rec. X.226 [ISO/IEC 8823-1]

 Connectionless Presentation protocol – ITU-T Rec. X.236 [ISO/IEC 9576-1]

This layer defines and encrypts/decrypts data types from the application layer. Protocols such as MIDI,
MPEG, and GIF are presentation layer formats shared by different applications.

[edit]7. Application Layer


[edit]Common-Application Service Elements (CASEs)

 Association Control Service Element (ACSE) – ITU-T Rec. X.217 [ISO/IEC 8649], ITU-T Rec.
X.227 [ISO/IEC 8650-1], ITU-T Rec. X.237 [ISO/IEC 10035-1].

 Reliable Transfer Service Element (RTSE) – ITU-T Rec. X.218 [ISO/IEC 9066-1], ITU-T Rec.
X.228 [ISO/IEC 9066-2].

 Remote Operations Service Element (ROSE) – ITU-T Rec. X.219 [ISO/IEC 9072-1], ITU-T
Rec. X.229 [ISO/IEC 9072-2]. TCAP is related to X.219.

 Commitment, Concurrency, and Recovery service element (CCRSE)

 Security Exchange Service Element (SESE)

This keeps track of how each application talks to another application. Destination and source
addresses are linked to specific applications.

[edit]Application processes

 Common management information protocol (CMIP) – ISO 9596 / X.700

25
 Directory services (DS) – X.500, later modified for the TCP/IP stack as LDAP

 File transfer, access, and management (FTAM)

 Message handling system (MHS) – X.400)

 Virtual terminal protocol (VT) - ISO 9040/9041

 Remote Database Access (RDA)

 Distributed Transaction Processing (OSI TP)

 Interlibrary Loan Application Protocol (ILAP)

 Document Transfer And Manipulation (DTAM)

 Document Printing Application (DPA)

 Document Filing and Retrieval (DFR)

ii) Describe the relationship between IP addresses and MAC address.


(5 Marks)

MAC-address and IP-address relationship - MAC-addresses are used on local Ethernet


networks.IP-addresses are more abstract and can be used on top of multiple types of networks.

Where does IP-addresses come in? - Local networks like an Ethernet network sends all traffic to
all computers that sits on the same network bus. Global networks like the Internet will not send all
traffic to all of the connected computers. IP-communication (that is used on the Internet) have a
much more sophisticated way to deal with sending and routing the data communication that we will
not cover here. If you want to learn more about how the Internet communication works there is
plenty of information on the Internet. However IP-communication is very useful on local networks
as well but we have to separate the physical part of the network from the logical part.

The communication difference between the physical and the logical part of the networks goes within
a grey area in software.
To the physical (hardware) domain belongs cables and network cards. Ones the data signals have
been detected on the network card the low level software on the card and in the operating system
takes on the task to process this data. That processing is divided in different levels.
There are standard models for this leveling of software. One such model is called the OSI modeland
have 7 levels. When studying the IP-communication you will find that it doesn't comply fully with
the OSI model but in general it works the same way. The OSI model will not be explained here. You
will find plenty of information on the Internet about the OSI model.

26
On an Ethernet network you do not have to use IP-communication to communicate. Before the
Internet become popular and dominating other protocols like NOVELL IPX was common on local
networks. Many companies already have working local networks when Internet and IP-
communication become popular. However there is no problem running several different protocols at
the same time on an Ethernet network as long as all "physical" (low level) communication uses the
fundamental Ethernet rules using Ethernet frames with source and destination MAC-addresses.
Today the majority of Ethernet networks only runs the IP-protocol.

Network packets are like Russian dolls. An IP-packet resides within an Ethernet-packet. A TCP-
packet resides within an IP-packet. A HTTP-packet resides within a TCP-packet.

The data part of an Ethernet packet can hold up to 1500 bytes. MAC-addresses (48bits) are 6 bytes
wide each and the Number Of Bytes field is 2 byte wide. That gives the maximum size of an
Ethernet frame to be 1514 bytes.

When introducing the IP-protocol on Ethernet the Number Of Bytes field is used to mark that the
Ethernet frame holds an IP-packet by the number of 0x0800. By using a number that is greater
than the maximum length an Ethernet frame can hold indicates that the Ethernet frame holds
another protocol frame in the data part. The Ethernet standard says that if the Number Of Bytes
field is greater than 0x0600 the Ethernet frame holds another protocol.

In the old times, MAC addresses used to be manufacturer-specific. So if you had two
network cards from the same manufacturer, they would normally have the same MAC
address, even though they are slightly different models. Since then, there’s a movement
underway toward unique MAC addresses; in the extreme, every Ethernet device (network
card, router, hub, etc.) would have its own MAC address.

IP address, conversely, is assigned to a computer (or other IP-enabled device) by the


router every time the computer connects to the network. Generally, it's not fixed, so the
same device may have a different IP address at different times...

Question 4:

27
i) Why use FTP to transfer files rather than e-mail ?
(5 Marks)

FTP/Email Files

FTP is the protocol for exchanging files over the Internet. FTP is most commonly used to download
or upload files from or to an internet server. You will need an FTP application and you can download
them: Fetch for Macintosh, and for Windows use WinZip or WS_FTP. (These applications usually
have a 30-day trial period and then you can decide whether to purchase it or not). FTP is preferred
when files get large because they will upload much faster than through email and FTP can handle
much larger files.

Sending large attachments through email can be problematic. Some corporate email servers do not
allow email attachments to guard against possible viruses, or an outgoing server may have a limit
on the size of an attachment. Sometimes the limit of an attachment may be as low as a 2 mg file.
Therefore, FTP may be the only option to sending your files electronically. FTP is also a much faster
way to send files than through email.

If your files are especially large, 100 mg or more, it is recommended that you send a CD disk rather
than sending files electronically.

ii) What is the purpose of time to live field of the IP datagram header?
(5 Marks)

TIME TO LIVE (8 bits)


This field determines how long a datagram will exist. At each hop along a network path, the datagram is
opened and it's time to live field is decremented by one (or more than one in some cases). When the time
to live field reaches zero, the datagram is said to have 'expired' and is discarded. This prevents
congestion on the network that is created when a datagram cannot be forwarded to it's destination. Most
applications set the time to live field to 30 or 32 by default.

There may sometimes be a problem, usually temporary, that data is sent back and forth, or goes
around in a loop, due to some routing error. If this happens, the data will eventually be
discarded. Every time a packet is re-sent, the TTL is reduced by one; when it goes down to
zero, the packet "dies".

IP header:

00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Version IHL Differentiated Services Total length
Identification Flags Fragment offset
TTL Protocol Header checksum
Source IP address
Destination IP address
Options and padding :::

TTL, Time to Live. 8 bits.

28
A timer field used to track the lifetime of the datagram. When the TTL field is
decremented down to zero, the datagram is discarded.

iii) How does the 3-way handshake mechanism for creating a TCP connection work?
(7 Marks)

The three-way handshake in Transmission Control Protocol (also called the three message
handshake) is the method used to establish and tear down network connections. This
handshaking technique is referred to as the 3-way handshake or as "SYN-SYN-ACK" (or more
accurately SYN, SYN-ACK, ACK). The TCP handshaking mechanism is designed so that two
computers attempting to communicate can negotiate the parameters of the network connection
before beginning communication. This process is also designed so that both ends can initiate
and negotiate separate connections at the same time.

The three-way handshake in Transmission Control Protocol (also called the three message handshake) is
the method used to establish and tear down network connections. This handshaking technique is
referred to as the 3-way handshake or as "SYN-SYN-ACK" (or more accurately SYN, SYN-ACK, ACK).
The TCP handshaking mechanism is designed so that two computers attempting to communicate can
negotiate the parameters of the network connection before beginning communication. This process is
also designed so that both ends can initiate and negotiate separate connections at the same time.

3-Way Handshake Description


Below is a (very) simplified description of the TCP 3-way handshake process. Refer to the diagram on
the right as you examine the list of events on the left.

EVENT DIAGRAM
Host A sends a TCP SYNchronize packet to Host B
Host B receives A's SYN
Host B sends a SYNchronize-ACKnowledgement
Host A receives B's SYN-ACK
Host A sends ACKnowledge
Host B receives ACK. TCP connection is ESTABLISHED.

SYNchronize and ACKnowledge messages are indicated by a bit inside the TCP header of the segment.
TCP knows whether the network connection is opening, synchronizing or established by using the
SYNchronize and ACKnowledge messages when establishing a network connection. When the
communication between two computers ends, another 3-way communication is performed to tear
down the TCP connection. This setup and teardown of a TCP connection is part of what qualifies TCP a
reliable protocol. Note that UDP does
not perform this 3-way handshake and for this reason, it is referred to as an unreliable protocol.

iv) What is the difference between a port and a socket?


(3 Marks)

A port is a software address on a computer on the network--for instance, the News server is a piece
of software that is normally addressed through port 119, the POP server through port 110, the
SMTP server through port 25, and so on.

A socket is a communication path to a port. When you want your program to communicate over the
network, you have given it a way of addressing the port and this is done by creating a socket and
attaching it to the port.

Basically, socket = IP + ports Sockets provide access to the port+ip

29
Socket

A socket is a network communications endpoint. The analogy is to a wire (the


network data connection) being plugged into a socket.

Sockets come in two primary flavors. An active socket is connected to a remote


active socket via an open data connection. Closing the connection destroys the
active sockets at each endpoint. A passive socket is not connected, but rather
awaits an incoming connection, which will spawn a new active socket.

A socket is not a port, though there is a close relationship between them. A


socket is associated with a port, though this is a many-to-one relationship. Each
port can have a single passive socket, awaiting incoming connections, and
multiple active sockets, each corresponding to an open connection on the port.

Question 5:

i) Explain the difference between distance vector and link state routing protocol through
examples.
(9 Marks)
In a distance vector routing protocol, such as RIP or EIGRP, each router sends its routing table to
neighboring routers. The routers don't know the topology, i.e., how other routers are
interconnected.

In a link state routing protocol, such as OSPF or IS-IS, routers first exchange information about
connections within the network (or an area of the network), and build a topology table. Then each
router uses Dijkstra's algorithm to calculate the best route to each destination.

There are two major classes of routing protocol: distance vector and link-state. It's easy to remember
which protocols belong to either class, but comprehending their differences between the two classes
takes a bit more effort.

30
Distance vector routing is so named because it involves two factors: the distance, or metric, of a
destination, and the vector, or direction to take to get there. Routing information is only exchanged
between directly connected neighbors. This means a router knows from which neighbor a route was
learned, but it does not know where that neighbor learned the route; a router can't see beyond its own
neighbors. This aspect of distance vector routing is sometimes referred to as "routing by rumor."
Measures like split horizon and poison reverse are employed to avoid routing loops.
Link-state routing, in contrast, requires that all routers know about the paths reachable by all other
routers in the network. Link-state information is flooded throughout the link-state domain (an area in
OSPF or IS-IS) to ensure all routers posess a synchronized copy of the area's link-state database.
From this common database, each router constructs its own relative shortest-path tree, with itself as
the root, for all known routes.

Consider the following topology.

Both distance vector and link-state routing protocols are suitable for deployment on this network, but
each will go about propagating routes in a different manner.

Distance Vector

If we were to run a distance vector routing protocol like RIP or EIGRP on this topology, here's how R1
would see the network, assuming each link has a metric of 1 (locally connected routes have been
omitted):

31
Notice that although R1 has connectivity to all subnets, it has no knowledge of the network's structure
beyond its own links. R4 has even less insight:

Because they do not require routers to maintain the state of all links in the network, distance vector
protocols typically consume less overhead at the expense of limited visibility. Because routers have
only a limited view of the network, tools like split horizon and poision reverse are needed to prevent
routing loops.

Link-State

Now, let's look at the same topology running a link-state routing protocol (in a single area). Because
each router records the state of all links in the area, each router can construct a shortest-path tree
from itself to all known destinations. Here's what R1's tree would look like:

R4 has constructed its own shortest-path tree, different from that of R1:

32
Although maintaining link-state information for the entire area typically requires more overhead than
does processing advertisements only from direct neighbors, but provide more robust operation and
scalability.

ii) Why is the security of web very important today? Also outline the design goals and features
of SSL 3.0.
(6 Marks)
The great importance of Web security
However, while using the Internet, along with the convenience and speed of access to information come
new risks. Among them are the risks that valuable information will be lost, stolen, corrupted, or misused
and that the computer systems will be corrupted. If information is recorded electronically and is available
on networked computers, it is more vulnerable than if the same information is printed on paper and
locked in a file cabinet. Intruders do not need to enter an office or home, and may not even be in the
same country. They can steal or tamper with information without touching a piece of paper or a
photocopier. They can create new electronic files, run their own programs, and even hide all evidence of
their unauthorized activity.

Basic Web security concepts


the three basic security concepts important to information on the Internet are:
Confidentiality.
Integrity.
Availability.
This document introduces the Secure Sockets Layer (SSL) protocol. Originally developed by Netscape, SSL
has been universally accepted on the World Wide Web for authenticated and encrypted communication
between clients and servers. The new Internet Engineering Task Force (IETF) standard called Transport
Layer Security (TLS) is based on SSL. This was recently published as an IETF Internet-Draft, The TLS
Protocol Version 1.0. Netscape products will fully support TLS. This document is primarily intended for
administrators of Netscape server products, but the information it contains may also be useful for
developers of applications that support SSL. The document assumes that you are familiar with the basic
concepts of public-key cryptography, as summarized in the companion document Introduction to Public-
Key Cryptography.

The SSL Protocol


The Transmission Control Protocol/Internet Protocol (TCP/IP) governs the transport and routing of data
over the Internet. Other protocols, such as the Hypertext Transport Protocol (HTTP), Lightweight Directory
Access Protocol (LDAP), or Internet Messaging Access Protocol (IMAP), run "on top of" TCP/IP in the sense
that they all use TCP/IP to support typical application tasks such as displaying web pages or running email
servers.

The SSL protocol runs above TCP/IP and below higher-level protocols such as HTTP or IMAP. It uses

33
TCP/IP on behalf of the higher-level protocols, and in the process allows an SSL-enabled server to
authenticate itself to an SSL-enabled client, allows the client to authenticate itself to the server, and
allows both machines to establish an encrypted connection. These capabilities address fundamental
concerns about communication over the Internet and other TCP/IP networks:

· SSL server authentication allows a user to confirm a server's identity. SSL-enabled client software can
use standard techniques of public-key cryptography to check that a server's certificate and public ID are
valid and have been issued by a certificate authority (CA) listed in the client's list of trusted CAs. This
confirmation might be important if the user, for example, is sending a credit
card number over the network and wants to check the receiving server's identity.

· SSL client authentication allows a server to confirm a user's identity. Using the same techniques as
those used for server authentication, SSL-enabled server software can check that a client's certificate and
public ID are valid and have been issued by a certificate authority (CA) listed in the server's list of trusted
CAs. This confirmation might be important if the server, for example, is a bank sending confidential
financial information to a customer and wants to check the recipient's
identity.
· An encrypted SSL connection requires all information sent between a client and a server to be
encrypted by the sending software and decrypted by the receiving software, thus providing a high degree
of confidentiality. Confidentiality is important for both parties to any private transaction. In addition, all
data sent over an encrypted SSL connection is protected with a mechanism for detecting tampering--that
is, for automatically determining whether the data has been altered in transit. The
SSL protocol includes two sub-protocols: the SSL record protocol and the SSL handshake protocol. The
SSL record protocol defines the format used to transmit data. The SSL handshake protocol involves using
the SSL record protocol to exchange a series of messages between an SSL-enabled server and an SSL-
enabled client when they first establish an SSL connection. This exchange of messages is designed to
facilitate the following actions:
· Authenticate the server to the client.
· Allow the client and server to select the cryptographic algorithms, or ciphers, that they both support.
· Optionally authenticate the client to the server.
· Use public-key encryption techniques to generate shared secrets.
· Establish an encrypted SSL connection

Course Code : MCS-043


Course Title : Introduction to Database Management Systems
Assignment Number : MCA(4)/043/Assign/09
Maximum Marks : 100
Weightage : 25%
Last Date of Submission : 15th October, 2009 (For July, 2009 Session)
15th April, 2010 (For January, 2010 Session)

This assignment has four questions, which carries 80 marks. Answer all the
questions. Rest 20 marks are for viva voce. You may use illustrations and diagrams
to enhance explanations. Please go through the guidelines regarding assignments
given in the Programme Guide for the format of presentation. Answer to each part
of the question should be confined to about 300 words.

Question 1:

Consider a University like IITs having different Engineering departments. The University offers
PhD, Master of Technology and Bachelor of Technology programmes in various Engineering
disciplines. Each department has a number of full time faculty members - Professors, Associate

34
Professors and Assistant Professors. Several Guest faculties can also be visiting the University.
A student may take up only one programme at a time from the University.

(a) Draw the EER diagram for the hospital showing all entities, relationship, aggregation,
generalisation and specialisation. (5 Marks)

(b) Create the normalised tables till 5 NF, highlighting all the different types of
dependencies including Multi-Valued and Join dependencies (if your design does not
have any such dependency, then you must explain the MVD and JD with the help of an
example situation related to any University). (5 Marks)

(c) Draw the class diagram for the University above and relate it to database design as
done in part (b). (5 Marks)

(d) Create an embedded SQL query to find out the list of faculties who have been involved
with UG, PG and doctoral programmes. (2 Marks)

(e) List the contents of the catalogue considering that the system has been developed using
a commercial database management system? (3 Marks)

Question 2

(a) Consider the following relations: (6 Marks)


Faculty (fa_id, fa-name, f-designation)
Student(st_ id, st_name, st_address, st_programme, st_programmeRegistrationdate)
Project_Consultation (fa_id, pa_id, pc_consultationDate, pc_hours)

You may assuming that pc_hours represents the number of hours of consultation on a
particular day.

Write the SQL commands to find the total number of hours spent by each faculty on
each student.

Now, assume that there are 100 faculty records, 5000 student records and 50000 project
consultation records. Also assume that in a block of data 10 faculty records or 5 student
records or 50 project consultation records can be accommodated. Find the minimum
cost for the query given above, if Block Nested- Loop join is performed. Also find the
query evaluation plan for the given query.

(b) What is a timestamp? Explain a timestamp based protocol that ensures serialisability
during concurrent transactions with the help of an example involving at least two
concurrent transactions that are trying to modify the same data items. List the differences
between timestamp based protocols and locking protocols. (4 Marks)

(b) Consider the relations given in part (a) of this question. Design two types of users –
faculty and the student. The faculty is allowed to view and change the data in Project
consultation relation, but not allowed to change any thing in the Faculty and Student
relations. The student users can only view the data about her/him. Design the suitable

35
access control and use SQL to grant the desired access rights to the users. Make suitable
assumptions, if any. (3 Marks)

(c) Describe the process of distributed deadlock detection with the help of an example.
(3 Marks)

(d) Explain the 2 phase commit protocol with the help of an example. (2
Marks)

(e) Explain the log based recovery scheme with deferred database modification approach
with the help of an example. (2 Marks)

Question 3:

(a) A University like IGNOU maintain a list of published blocks and its sales in its
store management system. A block is a part of a course. All these publications have an
ISBN number, block title, price and the course code this block belongs to. A student can
purchase one or more blocks from the store. Design a suitable object oriented database
management system with the help of ODL. Also write a query that finds the price that is
to be paid by one student on purchase of some blocks. (5 Marks)

(b) Create a semi structured data using XML for a software company employee (assume a
maximum of 5 employees). You may include the fields – ID, Name, contact phones,
address – home, office and emergency. Create a suitable DTD for this document. What
kind of support is build by commercial DBMS for XML? (5 Marks)

(b) Consider a data warehouse of a departmental store that contains three dimension tables
and one fact tables – Dimension table of Year, Product and Branch and fact table of
Sales. Create the star schema for the data warehouse with some sample data. Explain the
process of ETL for the data warehouse so designed. (5 Marks)

(c) What are classification, clustering and association rule mining? Explain the Apriori
algorithm for association rule mining with the help of an example. (5 Marks)

Question 4:

(a) Explain the following with appropriate examples.


(i) Multimedia Database
(ii) Geographic Information Systems
(iii) Web Database
(iv) Data Grid
(10 Marks)

(b) Explain the following in the context of PostgreSQL


a. oid and tableoid

36
b.R-Tree and Hash indexes
c. Isolation levels supported by PostgreSQL
d.Postmaster process
e. Query processing
(5 Marks)

(c) Explain the following in the context of Oracle


a. Integrity constraints
b. Tablespace
c. Branch and leaf index blocks
d. Locking mechanism
e. Commit and savepoints
(5 Marks)

Course Code : MCS-044


Course Title : Mini Project
Assignment Number : MCA (4)/044/Assign/09
Assignment Marks : 100
Maximum Marks : 25%
Last Date of Submission : 15th October, 2009 (For July, 2009 Session)
15th April, 2010 (For January, 2010 Session)

There are eight questions in this assignment, which carries 80 marks. Rest 20 marks are for
viva-voce. You may use illustrations and diagrams to enhance the explanations.
Please go through the guidelines regarding assignments given in the Programme Guide for
the format of presentation. Assumptions made if any, should be stated.

Background and Project Specifications:

ABC University has different course on offer. It wants to provide web support to their students
mainly in Course Registration and Examination. In Online course registration, student can

37
register for different available courses of the University after he/she filled up online registration
form with details of DD/Cheque no. etc. The filled up students form will stored in a database and
will be send to the administration section. Administration after checking the eligibility criteria,
fee details and payments will provide the user name, enrollment number, and password to the
students. The goal of second module Online Examination is to develop a system for testing a
student’s knowledge of different available courses. Once student is eligible for examination based
on duration, fees payments, attendance etc, student can fix up the time for examination of a
course. After authentication using user name and password of the student. The system will
generate questions at random from a database. Some questions will be factual, multi-choice
questions. Some will require an exact answer. For example, the computer may generate a random
8-bit binary integer and the student will be asked to convert it into a decimal value. The
examination system should be diagnostic and locate the student’s problems. For example, if
students perform well in one area, further questions at the same level in the same area will not be
asked.

Question 1:
Describe the Systems Development Life Cycle (SDLC) that suits the above specifications. Also,
evaluate the systems requirements. (10 Marks)

Question 2:

Perform and evaluate feasibility studies like cost-benefit analysis, technical feasibility, time
feasibility and operational feasibility for the project. Project Scheduling should be made using
both GANTT and PERT charts. (10 Marks)

Question 3:

Design and draw the data flow diagrams (DFD’s) up to the required levels, entity-relationship
(ER) diagram and also produce a data dictionary. (20 Marks)

Question 4:

Create the systems flow chart and state transition diagrams. (10 Marks)

Question 5:

Decide the S/W requirement specifications and H/W requirement specifications. (5 Marks)

Question 6:

Plan the systems design phase and distinguish between logical and physical design requirements.
(5 Marks)

Question 7:

Perform normalization to the required normal forms for the unnormalized tables. (10 Marks)

Question 8:

38
Design various test cases for different testing techniques/strategies. (10 Marks)

Course Code : MCSL-045 (Done)


Course Title : UNIX and DBMS Lab
Assignment Number : MCA(4)/045/Assign/09
Maximum Marks : 100
Weightage : 25%
Last Date of Submission : 15th October, 2009 (For July, 2009 Session)
15th April, 2010 (For January, 2010 Session)

The assignment has two parts A and B. Answer all the questions. Each part is for
20 marks. UNIX and DBMS lab record carries 40 Marks. Rest 20 marks are for
viva voce. You may use illustrations and diagrams to enhance the explanations.
Please go through the guidelines regarding assignments given in the MCA
Programme Guide for the format of presentation. If any assumptions made, please
state them.

PART-A: MCS-041

39
Question 1:

Write and demonstrate the UNIX commands for the following:

(a) Find the number of users currently logged in.


(b) Find the number of lines in a specified file.
(c) Kill a background process.
(d) Display the current environment variables.
(e) Change the file permissions to Read only for everyone on a data file created by you.
(f) Find the lines in a file that contains the string like b or ab or aab or aaab or aaaa…b
(g) Transfer the names of all the files in a directory to a file.
(h) Display a file such that only 10 lines get displayed at one time.
(i) Create a file containing 10 lines, split it into two files containing 5 lines each.
(j) Display only those lines that are common in two different files.
(5 Marks)

(a) Find the number of users currently logged in.


Answer
who

(b) Find the number of lines in a specified file.


Answer
wc – l filename

(c) Kill a background process.


Answer
kill processnumber
eg : kill 1000.

(d) Display the current environment variables.


Answer
set | less

(e) Change the file permissions to Read only for everyone on a data file created by you.
Answer
Chmod o+r file1

(f) Find the lines in a file that contains the string like b or ab or aab or aaab or aaaa…b
Answer
egrep -i “ab|aaaa|b|aaab” filename

(g) Transfer the names of all the files in a directory to a file.


Answer
cp -R /home/scripts /export/home/SIVA

(h) Display a file such that only 10 lines get displayed at one time.
Answer
Cat filename|head 10

(i) Create a file containing 10 lines, split it into two files containing 5 lines each.
Answer
split -l 5 file1.txt smallsplit.txt

(j) Display only those lines that are common in two different files.
Answer
$ comm -3 /path/to/file1/ /path/to/file2

40
Question 2:

(a) Create a text file containing name, ID and addresses of students. Write a shell program
that displays only the name and ID of the students. (5 Marks)

Create file
Vi student.txt

Name: siva

ID : 2120

Address:Tiruchendur

Name: Venkat

ID : 2121

Address: Chennai.

Name: Raja

ID : 2122

Address: Koimbatore.

Schell Program
egrep -i “name|id” student.txt

(b) Write a shell script that counts the number of occurrences of the word “IGNOU” in a file.
(5 Marks)
Answer :
#!/bin/bash

count=0

a=1

for i in $(cat check1.txt)

do

if [[ $i == $1 ]]; then

count='expr $count + $b'

fi

done

echo $count

41
(c) Write a shell script that displays the smaller of the two values given as arguments to it.
(5
Marks)

compare2.sh

a=$1

b=$2

if [[ $a -le $b ]] ; then

echo “Smaller value is : $a.”

else

echo “Smaller value is : $b.”

fi

To Run Script

./compare2.sh 5 12

Smaller value is : 5

PART-B: MCS-043
Question 1:
A database Management system is to be created for a Study Centre to keep track of the students
and the assignment records of the students. The database records the date of submission of
assignment, the date of evaluation, the date of viva, the date of declaration of results, who
evaluated the assignment, and the mark list description in which the assignment marks were sent
to Regional Office. The database also maintains the details of the evaluators. Please perform the
following activities for the description as given above.

(a) Design the database with suitable integrity constraints and create the database.
(3 Marks)
Table Name: stu_assignment_details

CREATE TABLE stu_assignment_details(assno number primary key,

stuno number(9), student_details(stuno),

stuname varchar(45),sem number(1) not null,

dos date not null,doev date,

doviva date,doresult date,evaluator varchar(45),

subject varchar(50) not null,mark number(3), not null,

42
remarks varchar(100));

Table Name: student_details

CREATE TABLE student_details(stuno number primary key,


stuname varchar(45) not null, yearofjoin char(4) not null,
addres varchar(50));

Table Name:Evaluator_details

CREATE TABLE evalulator_details(evalname varchar(50),empno number not


null,

phonon number,address varchar(50),subject varchar(25),not null);

(b) Write the following queries using SQL:


(i) Find the List of the students who have not submitted even a single assignment.
SELECT stuname FROM student_details where stuno IN ( SELECT
stuno FROM stu_assignment_details);

(ii) Find the details of the evaluators by whom average marks awarded are more than
70%.
ANSWER
SELECT * FROM evaluator_details WHERE empno IN

( SELECT empno FROM stu_assignment_details WHERE mark >=


70);

(iii) Find the students who have passed more than 5 assignments.
(iv) Find the list of students who have not appeared in viva. Make and state suitable
assumptions, if any.
ANSWER
SELECT stuno,stuname FROM stu_assignmet_detaisl WHERE
dovi=NULL;

(2 Marks)
(c) Assume two views for the above table. The first view is for the data entry person who is
only allowed to enter new data in all the three tables, however, once he/she enters the
data he/she is not allowed to modify it. Second for the students who can see only the
marks that he/she has obtained in his/her submitted assignments. Create the two views
and one user of the each view. Give the suitable access rights to the views/users.
(4
Marks)

43
CONNECT scott/tiger

SQL>CREATE VIEW assignmentview1 AS

SQL>SELECT * FROM stu_assign_details

SQL>CREATE USER staff IDENTIFIED BY

India123

User Created

SQL>GRANT CONNECT TO staff

Grant Succeed

SQL>GRANT resource to staff

Grant Succeed

SQL>GRANT SELECT ON assignview1 to staff

Grant Operation Successful.

SQL>CREATE USER student IDENTIFIED BY

Welcome123

User Created

SQL>GRANT CONNECT TO student

Grant Succeed

SQL>GRANT resource to student

Grant Succeed

SQL>GRANT SELECT ON assignview1 to student

Grant Operation Successful.

(d) Write a procedure that creates a mark list for the specified subject and evaluator. The
mark list at the top displays the subject code (course code) and title and the name of the
evaluator. The details shown in the mark list are – student ID, student name, student
marks and equivalent grades. Please note that Grades are to be calculated from marks by
this procedure as per the following scheme –
>=75% and above A
>=60% and < 75% B
>=50% and <60% C
<50% F

44
(4 Marks)

ANSWER
CREATE PROCEDURE marklist(cc in varchra2,evalname varchar2)

DECLARE

Grade varchar(20);

BEGIN

FOR pro1 IN (SELECT * FROM stu_assignmnet_details

WHERE subject=cc and evaluator=evalname)

If (pro1.mark >= 75)then

Grade := ‘A’;

elsIf (pro1.mark >= 75 and pro1.mark<75 then

Grade := ‘B’;

elsIf (pro1.mark >= 75 and pro1.mark<60)then

Grade := ‘C’;

elsIf (pro1.mark >=50)then

Grade := ‘F’;

Else

Grade :=’No Mark’;

End if

Set SERVEROUTPUT ON

DBMS_OUTPUT.PUT_LINE(‘CORUSE CODE’ || cc);

DBMS_OUTPUT.PUT_LINE(‘’EVALULATOR NAME :’ || evalname);

DBMS_OUTPUT.PUT_LINE(‘ STUDENTNAME STUNAME MARK GRADE);

DBMS_OUTPUT.PUT_LINE(pro1.stuname||pro1.stuno||pro1.mark|pro1.grade);

END;

(e) Perform the following activities:

45
(i) Create a trigger that prints the assignment result of the student if he fails in that
assignment.
CREATE TRIGGER stufail1

BEFORE INSERT OR UPDATE OF mark

ON scott.stu_assignment_details

FOR EACH ROW

BEGIN

If : new.nark < 50

DBMS_OUTPUT.PUT_LINE(‘The Students fail in the subject’);

Endif

END;

(ii) Create a trigger that automatically gives a grace of a maximum of 2%, if a student
gets 48% marks in the assignment. For example, if an assignment marks are
entered as 48%, then the trigger will automatically convert the marks to 50%, so is
the case of student who gets 49% marks. His/her marks will be updated to 50% by
the trigger.
(4 Marks)
CREATE TRIGGER stugrace

AFTER INSERT OR UPDATE OF mark

ON scott.stu_assignment_details

FOR EACH ROW

BEGIN

If : new.nark = 48 OR :new.mark = 49 then

UPDATE stu_assignment_details SET mark=50 WHERE


rowed=last_insert_rowid();

Endif

END;

(f) Create a transaction to enter the mark list obtained from an evaluator of a specific
assignment. (3 Marks)

ANSWER

46
CREATE OR REPLACE PROCEDURE transc(assno number,stuno number(9),

stuname varchar,sem number,dos date,doev date,doviva date,doresult


date,

evaluator varchar,subject varchar,mark number, remarks varchar)

IS

PRAGMA AUTONOMOUS TRANSACTION

BEGIN

INSERT INTO stu_assignment_details(assno,stuno,


stuname,sem,dos,doev,doviva,doresult,evaluator,

subject,mark, remarks) VALUE(assno,stuno,


stuname,sem,dos,doev,doviva,doresult,evaluator,

subject,mark, remarks)

COMMIT;

END;

47
48

You might also like