Cs 63
Cs 63
There are six questions in this Assignment. Answer all the questions. You may use
illustrations and diagrams to enhance explanation.
Question 1: Find out the reasons those have made the UNIX an amazingly successful operating system. What are
the Features on existing UNIX based operating systems like Linux Red Hat, Fedora and Ubantu
Operating system. Also, compare them with Windows Vista.
The UNIX operating system has clearly emerged as one of the primary software
platforms for the '90s, providing distributed computing capabilities for even the most diverse
networks. Its remarkable success has been due both to its portability and to its long history of
innovation. In the more than 25 years that UNIX has been around, it has had plenty of time to
"soak up" good ideas from some of the sharpest computer people in the business. From AT&T, the
University of California at Berkeley, Sun Microsystems, and many other companies, UNIX has
acquired a tremendous collection of powerful tools and maintained an open architecture that
continues to invite development.
UNIX today runs on three or four million computers, maybe more. These computers
range from very small personal computers to Crays. The concept of creating ad hoc "programs" by
interconnecting commands is extremely powerful whether you're working on a laptop or a
supercomputer.
Because of its portability and because of an elegant design that appeals to developers,
UNIX has proliferated into many different "flavors" over the past couple decades. As much as this
divergence has profited UNIX by providing many venues for innovation, it has also frustrated the
growing need for portable applications. Without an adequate market share, any particular UNIX
flavor has suffered from a dearth of software or, at least, a dearth of affordable software, especially
compared with personal computer systems such as those built by IBM and Apple. The flavors of
UNIX are different enough that it became difficult and, therefore, costly to port applications from
one to the other. In addition, UNIX is not the same simple creature that it was back in Bell Labs.
Windowing systems, graphical user interfaces, and years of innovation have complicated UNIX
and dramatically affected the complexity of porting applications.
The need for simplified application portability was not, however, the only factor pushing for
a more unified UNIX. Improvements in networking put interoperability among different UNIX
systems, as well as between UNIX and non-UNIX systems, high on everyone's agenda. Today's
businesses are demanding enterprise-wide computing solutions. These solutions entail a high
degree of data sharing—both distributed applications and an ease of moving information and
people expertise around the organization. Today's procurements are specifying standard
interfaces and protocols to help meet this demand and leverage organizations' investments in
computing technology.
Portability:
From a technical point of view, portability was probably the most important factor in the
overall success of UNIX. Users could move UNIX to many different platforms with very little
change. Coded in the high-level language C, UNIX was easily ported to a variety of very different
hardware platforms.
Extensibility:
Another reason for the early success of UNIX was its extensibility and simplicity. UNIX was
able to grow without losing its fundamental elegance and without excessive risk of introducing
serious new bugs. Previously, as systems grew, they became increasingly complex and
increasingly difficult to maintain.
Additional Features
The multi-user and multiprocessing nature of UNIX greatly amplified the productivity of its users;
they could work on several things at a time.
Appeal
Finally, the success of UNIX is based on its appeal to its users. Enthusiasm for UNIX is
generally correlated with the time people spend with it. Users must get to a certain level of
expertise before they can string together commands and "compose" their own functionality or
embed their tricks into scripts that they use as if they were UNIX commands themselves
3
Question 2: Write a shell program to generate the first hundred numbers in the Fibonacci series.
Ans :
#!/bin/bash
num1=0
num2=1
echo $num1
echo $num2
count=2
Output
Enter how many number
5
Fibonacci series
0
1
1
2
3
5
8
13
21
34
Question 3: Design an algorithm that accepts an input a decimal number and converts it into BCD
(Binary Coded Decimal) representation. Also, draw its Flow Chart.
Ans :
It's basically the algorithm to break a number down to digits. Then each digit would be represented
as a natural binary number on its own.
To break it down to digits, get a remainder after division with 10 (that's the last digit), then divide
the number by 10 to remove that digit. Repeat until there are digits, and store each one into an array
(or print them to screen without storing).
4
Question 4: Consider the following set of processes that arrive in the ready queue at the same time:
Process CPU time
P1 2
P2 1
P3 4
P4 3
P5 1
P6 2
Consider the following scheduling algorithms: FCFS, SJF and Round Robin (quantum = 1)
(i) What is turnaround time of each process for each of the above
Scheduling algorithms?
(ii) What is the waiting time of each process for each of the above
Algorithms?
Ans
The FCFS (First come First serve) scheduling
P1 p2 p3 p4 p5 p6
Time Process Turn around time = t1 (process Waiting time = turn around
complete complete ) – t2 ( process time – processing time
submitted )
0 - - -
2 P1 2-0 = 2 2-2=0
3 P2 3-0=3 3-1=2
7 P3 7-0=7 7-4 =3
10 P4 10-0=10 10-3=7
11 P5 11-0=11 11-1=10
13 P6 13-0=13 13-2=11
5
The SJF (Short Job First) scheduling
p2 p5 p1 p6 p4 p3
Time Process Turn around time = t1 (process Waiting time = turn around
complete complete ) – t2 ( process time – processing time
submitted )
0 - - -
1 P2 1- 0=1 1-1=0
2 P5 2-0=2 2–1=1
4 P1 4- 0=4 4-2=2
6 P6 6-0=6 6–2=4
9 P4 9- 0=9 9–3=6
13 P3 13-0=13 13 - 4 = 9
P1 p2 p3 p4 p5 p6 p1 p3 p4 p6 p3 p4 p3
Time Process Turn around time = t1 (process Waiting time = turn around
complete complete ) – t2 ( process time – processing time
submitted )
0 - - -
2 P2 2-0 = 2 2-1 = 1
5 P5 5-0=5 5-1=4
7 P1 7-0=7 7-2=5
9 P6 9-0=9 9-2=7
12 P4 12-0=12 12-3=9
13 P6 13-0=13 13-4=9
6
Question 5: Write a shell program to find the Greatest Common Divisor among the two positive
non-zero integers given.
mx=0
if [ $a -gt $b ]
then
mx=$a
mn=$b
else
mx=$b
mn=$a
fi
while [ $r -gt 0 ]
do
mx=$mn
mn=$r
r=`expr $mx % $mn`
done
echo "The GCD is " $mn
The output
Enter Number 1
36
Enter number 2
24
The GCD is 12
7
Question 6: List the UNIX commands for the following:
(a) To search files for lines that match a particular string pattern given.