NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
Practical 1
Aim : Compare windows and Linux OS (latest version)
Linux Windows
Linux is a open source While windows are the not the
operating system. open source operating system
Linux is free of cost. While it is costly.
It’s file name case-sensitive While it’s file name is case-
insensitive
In Linux, monolithic kernel is While in this, micro kernel is
used used
Linux is more efficient in While windows are less
comparison of windows. efficient.
Linux is widely used in hacking While windows dose not
purpose based system provide much efficiency in
hacking.
Linux provide more security While it provides less security
than windows. than Linux.
BASIC OF OPERATING SYSTEM (4330703) Page 1
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
Practical 2
Aim : Solve below given example with SJF, FCFS and Round
robin algorithm, draw Gantt chart.
❖ FCFS
Process Arrival Execution Time OR burst
Time(T0) time(∆T)
P0 0 5
P1 1 3
P2 2 8
P3 3 6
❖ Gantt Chart:
P0 P1 P2 P3
0 3 8 16 22
Arrival Execution Completio
Process Time time OR n Turnaroun Waiting
(T0) burst time (T.A.T=T1 d Time (ta (T.A .T-
(∆T) – T0) ∆T)
P0 0 5 5 5 0
P1 1 3 8 7 4
P3 2 8 16 14 6
P4 3 6 22 19 13
BASIC OF OPERATING SYSTEM (4330703) Page 2
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
Average Turnaround time = [Completion Time – Arrival
Time]/ total no. processes
= [(5 - 0) + (8 - 1) + (16-2) + (22-3)]/4
P0 P1 P2 P3 P4
= [(5 + 7 + 14 + 19]/4
= 45/4
= 11.25 ms
Average Waiting time
= [Turnaround Time – burst / Total no. of processes
= [(5 – 5) + (7 – 3) + (14 – 8) + (19 – 6)]/4
P0 P1 P2 P3 P4
= ( 0 + 4 + 6 + 13] /4
= 23/4
=5.75 ms
BASIC OF OPERATING SYSTEM (4330703) Page 3
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
❖ SJF
Process Arrival Execution Time OR burst
Time(T0) time(∆T)
P0 0 10
P1 1 6
P2 3 2
P3 5 4
Turnaround time = Completion – Arrival Time
Waiting time = Turnaround time – Burst Time
❖ Gantt Chart:
P0 P3 P4 P1
0 10 12 16 22
Arrival Execution Completio
Process Time time OR n Turnaroun Waiting
(T0) burst time (T.A.T=T1 d Time (ta (T.A .T-
(∆T) – T0) ∆T)
P0 0 10 10 10 0
P1 1 6 22 21 15
P3 2 2 12 9 7
P4 3 4 16 11 7
BASIC OF OPERATING SYSTEM (4330703) Page 4
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
Average Turnaround time = [Completion time – Arrival time]
/ Total no processes
= [(10-0) + (22-1) + (12 -3) + (16-5)] / 4
P0 P1 P4 P3
= [10 + 21 + 9 + 11] / 4
= 51/4
= 12.75.ms
Average Waiting time = [Turnaround time – Burst time] /
total no processes
= [(10 - 10) + (21 – 6) + (9 – 2) + (11 – 4) / 4
P0 P1 P2 P3
= [0+15+7+7] /4
= 29/4
= 7.25.ms
BASIC OF OPERATING SYSTEM (4330703) Page 5
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
❖ RR’ Round Robin
Process Execution time OR
burst time (∆T)
P1 24
P2 3
P3 3
Turnaround time = Completion time – Arrival time
Waiting time = turnaround time – burst time
❖ Gantt chart:
P1 P2 P3 P1 P1 P1 P1 P1
0 4 7 10 14 18 22 26 30
Execution Completion
Process time OR (T.A.T=T1 – Turnaround Waiting
burst time T0) Time (ta (T.A .T-∆T)
(∆T)
P1 24 30 30 6
P2 3 7 7 4
P3 3 10 10 7
BASIC OF OPERATING SYSTEM (4330703) Page 6
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
Average Turnaround time = (Completion time – Arrival time)
/4 total no. of processes
= [(30 – 0) + (7 – 0) + (10 – 0) / 3
P1 P2 P3
= [ 30 + 7 + 10] /3
= 15.67.ms
Average Waiting time = (Turnaround time – burst time) Total
no. of processes
= [(30 – 24) + (7 – 3) + (10 – 3) / 3
P1 P2 P3
= [ 6 + 4 + 7] /3
= 17/3
=5.6.ms
BASIC OF OPERATING SYSTEM (4330703) Page 7
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
Practical 3
Aim : Processes requests are given as:
25k,50k,100k,75,
Solve above example using following algorithm:
1. First fit
2. Best fit
3. Worst fit
1. 25 K requirement
The algorithm scans the list until it gets first hole which should
be big enough to satisfy the request of 25 K. it gets the space in
the second partition which is free hence it allocates 25 K out of
75 K to the process and the remaining 50 K is produced as hole.
BASIC OF OPERATING SYSTEM (4330703) Page 8
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
2. 50 K requirement
The 50 K requirement can be fulfilled by allocating the third
partition which is 50 K in size to the process. No free space is
produced as free space.
3. 100 K requirement
100 K requirement can be fulfilled by using the fifth partition of
175 K size. Out of 175 K, 100 K will be allocated and remaining
75 K will be there as a hole.
BASIC OF OPERATING SYSTEM (4330703) Page 9
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
4. 75 K requirement
Since we are having a 75 K free partition hence we can allocate
that much space to the process which is demanding just 75 K
space.
Using first fit algorithm, we have fulfilled the entire request
optimally and no useless space is remaining.
Let's see, How Best Fit algorithm performs for the problem.
Using Best Fit Algorithm
1. 25 K requirement
To allocate 25 K space using best fit approach, need to scan the
whole list and then we find that a 75 K partition is free and the
smallest among all, which can accommodate the need of the
process.
Therefore 25 K out of those 75 K free partition is allocated to the
process and the remaining 5o K is produced as a hole.
BASIC OF OPERATING SYSTEM (4330703) Page 10
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
2. 50 K requirement
To satisfy this need, we will again scan the whole list and then
find the 50 K space is free which the exact match of the need is.
Therefore, it will be allocated for the process.
3. 100 K requirement
100 K need is close enough to the 175 K space. The algorithm
scans the whole list and then allocates 100 K out of 175 K from
the 5th free partition.
4. 75 K requirement
75 K requirement will get the space of 75 K from the 6th free
partition but the algorithm will scan the whole list in the process
of taking this decision.
BASIC OF OPERATING SYSTEM (4330703) Page 11
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
Practical 4
Aim : Page replacement algorithms
i. First in First out (FIFO) - Consider page reference string 1, 3, 0, 3, 5,
6, 3 with 3 page frames. Find the number of page faults.
Page reference: 1,3,0,3,5,6,3
1 3 0 3 5 6 3
0 0 0 0 3
3 3 3 3 6 6
1 1 1 5 5 5
1
Miss Miss Miss Hit Miss Miss Miss
➔ Total Page Fault = 6
• Initially, all slots are empty, so when 1, 3, 0 came they are
allocated to the empty slots —> 3 Page Faults.
• when 3 comes, it is already in memory so —> 0 Page Faults. Then
5 comes, it is not available in memory so it replaces the oldest
page slot i.e. 1. —>1 Page Fault. 6 comes, it is also not available
in memory so it replaces the oldest page slot i.e. 3 —>1 Page
Fault. Finally, when 3 come it is not available so it replaces 0 1-
page fault.
• Be lady’s anomaly proves that it is possible to have more page
faults when increasing the number of page frames while using the
First in First Out (FIFO) page replacement algorithm. For
example, if we consider reference strings 3, 2, 1, 0, 3, 2, 4, 3, 2,
1, 0, 4, and 3 slots, we get 9 total page faults, but if we increase
slots to 4, we get 10-page faults.
BASIC OF OPERATING SYSTEM (4330703) Page 12
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
ii. Least Recently Used – Consider the page reference string 7, 0, 1, 2,
0, 3, 0, 4, 2, 3, 0, 3, 2 with 4 page frames. Find number of page faults.
Page reference: 7,0,1,2,0,3,0,4,2,3,0,3,2 No. of page from:4
7 0 1 2 0 3 0 4 2 3 0 3 2
2 2 2 2 2 2 2 2 2 2
1 1 1 1 1 4 4 4 4 4 4
0 0 0 0 0 0 0 0 0 0 0 0
7 7 7 7 7 3 3 3 3 3 3 3 3
Miss Miss Miss Miss Hit Miss Hit Miss Hit Hit Hit Hit Hit Hit
Total Page Fault = 6
Initially, all slots are empty, so when 7 0 1 2 are allocated to the empty
slots —> 4 Page faults
0 is already there so —> 0 Page fault. when 3 came it will take the place
of 7 because it is not used for the longest duration of time in the future.
—>1 Page fault. 0 is already there so —> 0 Page fault. 4 will takes
place of 1 —> 1 Page Fault.
Now for the further page reference string —> 0 Page fault because they
are already available in the memory.
Optimal page replacement is perfect, but not possible in practice as the
operating system cannot know future requests. The use of Optimal Page
replacement is to set up a benchmark so that other replacement
algorithms can be analysed against it.
BASIC OF OPERATING SYSTEM (4330703) Page 13
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
Practical 5
Disk Scheduling Algorithm:
1.Scan: suppose the requests to be addressed are
82,170,43,140,24,16,190. And the read/write arm is at 50, and
it is also given that disk arm should move “towards the
larger value”.
0 16 24 43 50 82 100 140 150 170 190
199
Therefore, the seek time is calculated as:
= (82-50) + (100-82)+(140-100)+(150-140)+(170-150)+(190-
170)+(190-43)+(43-24)+(24-16)+(16-0)
= 330
BASIC OF OPERATING SYSTEM (4330703) Page 14
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
2.CSan: suppose the requests to be addressed are
82,170,43,140,24,16,190. And the read /write arm is at 50,
and it is also given that the disk arm should move “towards
the larger value”.
0 16 24 43 50 82 100 142 150 170 190
199
So, seek time is calculated as:
= (82-50) + (100-82) + (142-100)+(150-142)+(170-150)+(190-
170)+(190-0)+(16-0)+(24-16)+(43-24)
= 373
BASIC OF OPERATING SYSTEM (4330703) Page 15
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
Practical 6
AIM: Test and run basic Unix commands.
➔ Input
yashg@DESKTOP-AJR5RHE MINGW64 ~
$ pwd
➔ Output
➔ Input
yashg@DESKTOP-AJR5RHE MINGW64 ~
$ mkdir yash
yashg@DESKTOP-AJR5RHE MINGW64 ~
$ cd yash
➔ Output
BASIC OF OPERATING SYSTEM (4330703) Page 16
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
➔ Input
yashg@DESKTOP-AJR5RHE MINGW64 ~/yash
$ mkdir xyz
yashg@DESKTOP-AJR5RHE MINGW64 ~/yash
$ dir
➔ Output
➔ Input
yashg@DESKTOP-AJR5RHE MINGW64 ~
$ dir
➔ Output
➔ Input
yashg@DESKTOP-AJR5RHE MINGW64 ~
$ who
yashg@DESKTOP-AJR5RHE MINGW64 ~
$ whoami
BASIC OF OPERATING SYSTEM (4330703) Page 17
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
➔ Output
➔ Input
yashg@DESKTOP-AJR5RHE MINGW64 ~
$ date
➔ Output
BASIC OF OPERATING SYSTEM (4330703) Page 18
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
Practical 7
AIM: Test and run advanced Unix commands.
➔ Input
yashg@DESKTOP-AJR5RHE MINGW64
~/OneDrive/Desktop
$ echo "hello world"
➔ Output
➔ Input
yashg@DESKTOP-AJR5RHE MINGW64
~/OneDrive/Desktop
$ echo $23+23
➔ Output
➔ Input
yashg@DESKTOP-AJR5RHE MINGW64
~/OneDrive/Desktop
$ ps
BASIC OF OPERATING SYSTEM (4330703) Page 19
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
➔ Output
➔ Input
yashg@DESKTOP-AJR5RHE MINGW64
~/OneDrive/Desktop
$ ls –a
➔ Output
➔ Input
yashg@DESKTOP-AJR5RHE MINGW64
~/OneDrive/Desktop
$ cat
➔ Output
BASIC OF OPERATING SYSTEM (4330703) Page 20
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
➔ Input
yashg@DESKTOP-AJR5RHE MINGW64
~/OneDrive/Desktop
$ ls -i
➔ Output
BASIC OF OPERATING SYSTEM (4330703) Page 21
NEOTECH TECHNICAL CAMPUS
Faculty of Diploma Engineering
Department of Computer Engineering
g
Practical 8
➔ Input
vi /home/sssit/Downloads/file.txt
➔ output
BASIC OF OPERATING SYSTEM (4330703) Page 22