Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

Experiment 1

Aim: To study various operating systems and their


comparisons
Introduction to operating systems:
A Operaung system is a program that controls the execution of application programs and
acts as an interface between the user of a computer and the computer hardware. A mo
common definition is that the operating system is the one program running at all unes
the computer (usually called the kernel), with all else being application programs. A
Operating system is concerned with the allocation of resources and services, suh as
memory, processors, devices, and information. The operating system corresponding'y
1ncludes programs to manage these resources, such as a traffic controller, a scheduler, a

memory management module, I/O programs, and a file system.

Features of Operating system:

Operating system has the following features:


1. Convenience: An OS makes a computer more convenient to use.
2. Efficiency: An OS allows the computer system resources to be used efficiently.,
3. Ability to Evolve: An OS should be constructed in such a way as to permit the effective
development, testing, and introduction of new system functions at the same time without
interfering with service.
4 Throughput: An OS should be eonstructed so that It can give maximum throughput
(Number of tasks per unit íme).
Architecture of operating system:
User n
User 1 User 2 User 3
Databaso Systom
Assombler
Compiler Text Editor
PROGRAMS
SYSTEM AND APPICATION

OPERATING SYSTEM
COMPUTER
HARDWARE

Major Functions of Operating System:


OS means when
Management: When parallel accessing happens in the
Resource Resource Manager, Its
accessing the system the OS workS as
multiple users are system.
provide hardware to the user. It decreases the load in the
responsibility is to
tasks like scheduling and termination of the
Process Management: It includes various
CPU Scheduling algorithms.
process. It is done with the help of
management of the
The file system mechanism used for the
Storage Management: data is stored in
CIFS, NFS, etc. are some file systems. All the
storage. NIFS, CFS, included Hard
Hard disks that are all managed by the storage manager. It
various tracks of
Disk.
Management:Refers to the management of primary memory.
The operating
Memory been used and by whom. It has to
of how much memory has
track
system has te Keep OS also has to allocate and
process needs memory space and how much.
decide which
space.
deallocate the memory
Management: Privacy is also provided by the Operating system by
Security/Privacy
unauthorized applications can't access prograns or data. For
passwords so that
means of Kerberos authentication to prevent unauthorized access to data.
uses
example, Windows
Dif erentiate between Cloud OS and Mobile OS.

Mobile OS
Attributes Cloud OS

designed Mobile OS is designed for


Cloud OS is devices like
Device computing mobile
for cloud
smartphones and tablets.
infrastructure.

Cloud OS provides Mobile OS provides


complete set of functionalities
functionalities
required for cloud
that are required for mobile
Functionality computing such as
devices such as making phone
data storage,
calls, sending text messages,
procesing, and
and accessing the internet.
security.

Cloud OS typically
has web-based
Mobile OS has a user interface
interface that can be
that is optimized for smaller
User interface accessed throughT
screens and touch input.
web browser on any
device.
CloudOS stores data Mobile OS typically stores
Storage and applications on
data and applications on the
remote servers in the
device.
cloud.

Cloud OS provides
Mobile OS provides security
security features to
features to protect against
Security protect data and
and other
theft, malware,
applications stored
threats to the device.
on remote SserverS.

Cloud OS requires
an internet Mobile OS is designed to work
Connection to access with cellular networks and
Connectivity Wi-Fi for internet
the cloud based
applications and connectivity.
services.
Cloud OS
Comparison of CloudMe, Amoeba OS, and Slap Os.
Slap OS
Attributes CloudMe AmoebaOS

Amocba OS is a Slap OS is an open


distributed operating source operating
CloudMe is a cloud that is
system that allows system
Architecture based storage and designed to run on a
the use of multiple
file-sharing platform. computers to work variety of hardware

together seamlessly. platforms.


Slap OS has

graphical user

CloudMe provides a Amoeba OS has a interface that


user-friendly web command-line similar to other
User Interface interface for users to interface, which
popular operating
their files requires technical
manage systems like
and folders. expertise to operate. Windows and
macOS.

Amoeba OS does not


CloudMe OS uses Slap OS also uses
have built-in security
encryption encryption
features and requires to
technologies to technologies
Security additional
protect users' data protect users' data
security tools to be
and ensure privacy. and ensure privacy.
installed.

Amoeba OS is
designed to be
CloudMe is also
scalable acrosS Slap OS
scalable platform multiple computers, scalable and can run
that can handle large making it suitable for on a variety of
Scalability
amounts of data and high-performance hardware platforms.
users. computing
applications.
also open
Slap OS is
Amoeba OS is open free to
SOurce and
CloudMe is Source and free
to users mnay
use, but
Cost subscription-based but additional need to pay for
use,
service with varying security tools may additional support
plans and pricing. purchased. and services.
need to be
Mobile OS
" Windows Mobile OS.
Differentiate betweeen Android S, BlBlackberry OS and
Windows
Attributes Android OS Blackberry OS Mobile OS

Androjd OS has a
customizable user Mobile OS
BlackberTy OS has a Windows
interface, which traditional interface has tile-based

User Interface allows users to physical interface that


with
arrange their home
keyboard and Resembles the desktop
SCreens and add version of Windows.
trackbal.
widgets as per their
choice.
Windows Mobile OS
Android OS has the
Blackberry OS has a has a moderate app
largest app much smaller app ecosystem with several
ecosystem, wih
App Ecosystem store and most of the popular apps available
millions of apps apps are business
available on the
focused. the Microsoft Store.
Google Play Store.
Android OS has
Blackberry OS has Windows Mobile OS
improved its security been known for its also has several
features in recent
strong security security features,
years with features
Security features, including including device
such as Google Play
encryption and encryption and remote
Prótect and biometric
secure messaging. Wipe.
authentication.
Windows Mobile OS is

compatible with

Android OS is devices from multiple


Blackberry OS is
available on a wide manufacturers, but its
Hardware limited to availability is limited
Compatibility range of devices from
Blackberry devices
Microsoft's
different due to
only. decision to discontinue
manufacturers.
its

development.
Blackberry OS has Windows Mobile OS
Android has
more limited also has robust
robust multitasking
capabilities, allowing multitasking
multitasking
Multitasking users to switch capabilities due to its capabilities, allowing
hardware limitations users to switch
between apps
and limited app between apps
seamlessly. ecosystem. seanlessly.
foxpuimnd -2
Conmas

Taey LINUX DPERATING SYSTEM


limuse

knel. os
Tenvalds bu scplemby I1991. t is a

beercially le t
eonmerially uims
en-
1. Qutly , inr
GNU [Gennt Publie

ed n h macin iko
was cemputer etr
man fooume cemtus, usl
alee wed n embediol
vide eeden,matuth
ete. ekatiy ygtm hat
a cellstien ) bas
made libiw and

tho
4. Ubuntin
1: Mx linus
5. debian
Manjare
Miit k. Solus
RCHITEe TURE
(INUX
tho
coumen haaluse
Vlual

that de
tto

iks RAMY HND / CPU ete

LINUX COMMAUDS

Qutpt
rooteip-172-31-8-51 ec2-user]i pwd
/home/ec2-user

olit.
k din: beate

shiva
[root&ip-172-31-8-51 ec2-user] # mkir
Erooteip-172-31-8-51 ec2-user] # ls
kartik shiva
eelpud:
diuley
(root@ip-172-31-8-51 ec2-user# mdir shiva
(Toot®ip-172-31-8-51 ec2-user] ls
|kartik

cd:
clang
(rootip-172-31-8-51
bash: cd: ec2-userl! cd Documents
Documents: No such file or directory
(rooteip-172-31-8-51 ec2-user]
[rooteip-172-31-8-51~]#
Iroot pwd cd

(rootlip-172-31-8-51]!/] pwd
[root@ip-172-31-8-51 cd .
(root@ip- 172-31-8-51 /)
cd/
(rootlip-172-31-8-51 /1 pwd

5. touehi

[root@ip-172-31-8-51 N# touch filel,text


(root@ip-172-31-8-51
total 20
/] ls -1

te a

cuteut
[root@ip-172-31-8-51 /] cat >£ile3. txt
line 1
1ine 2
line 3
line 4
line 5
(rooteip-172-31-8-51 /) cat file3.txt
line 1
line 2
ine 3
line 4
line 5
7:

Qetput -
root0ip-172-31-8-51)E cat: S£ileltext
New Filel,
[rooteip-172-31-8-51
m cemove
reqular
{1mfilel.text y
filefile1.text'?

ut
rooteip-172-31-8-51 /# cp tile3. txt dirl
[rooteip-172-31-8-51 /1,cp file3.txt filez.txt dirl
FP overwrite dic1/file3.txt'? yes

9. tig
amth

(rootip-172-31-8-51 /11 my file2.txt ile3.txt


mv overwrite file3.txt? y

huad ciuplay 9 fle,


dutputi (root@ip,172-31-8-51 /] cat fil 3.txt
1ine
1ine 2
line 3
line4
line 5
(rooteip-172-31-8-51 /] head file3 txt
Line 1
1ine 2
1ine 3
ine4
Line S

(root@ip-172-31-8-51/]tail file3. tyt


line 1
1ine 2
1ine3
1ine 4
Troot@ip-172-31-8-51/iT
1ine 5
diaplag
Lrooteip-172-31-8-51'/14 tac file3. txt
1ine 5
line 4
line 3
1ine 2
Line 1
(rooteip-172-31-8-51 /)1

diplay eenl pud


2lang ,
tine.
(ec2-userip-172-31-8-51 ~]$ cat file2. t t

6
7

6
[ec2user@ip-172*31-8-51 ]$ more file2.txt

7
6

14. as
winlude
tumina
total4
rw-rW-I 1 ec2--user ec2-user 16 Mar 27 14:17. file2. txt
r w - r - 1 root rOot 0 Mar 2513:26 kartik
ESC

The

rec2-user@ip-172-31-8-51 ~$ cat file2.txt


1

7
6

6
rec2-sereip-172-31-85RNS grep 9 file2: txt
29Ybeam
thes colins fut
both column
(ec2-user@ip-172-31-8-51 ]_ cat fl.txt
10
20
30
40
40
[ec2-usereip-172-31-8-51 ~]_ cat f2.txt
30
40
50
60
70
(ec2-userip-172-31-8-51)s comm fl.txt f2.tXt
10
20
30
40
40
50
60
70

[ec2-user@ip-172-31-8-54-]$

17: : Ta danalete

[ec2-user@ip-172-31-8-51 -1S cat>geekfile


Welcome To
GeeksforGeeks
Lec2-usereip 172-31-8-51 19 cat geekfile
Welcome TO
GeeksforGeeks
rec2-user@ip-172-31-8-51 ~]$ cat geekfile. | tr Wla-z1q2-2
WELCOME, TO
GEEKSEORGEEKS
[ec2-user@ip-172-318-51 ~]s

348!
ehatrs in
(ec2-userlip-172-31-8-51 ~]$ wc file2.txt
8816 file2: txt N
rec2usereip-172-31-8-51~J$ wc -l file2. txt
B file2.txt
rec2-userip-172-31l-8-51 J$ WC-c file2. txt
16ec2-usereip-172-31-8-51
file2.txt -]$ W -W file2. txt
8tec2-usereip-172-31-8-51-15
file2.txt, |
partiulas fito wthin
fid oqlisn lofd
dupocu vaniw dat
als

name f2.txt
(ec2-user@ip-172-31-8-51 +1$ find
./t2.txt
(ec2-usereip-172-31-8-51 1$

lonan
20. fud tt

pdalas
(ec2-usereip-172-31-8-51 ~]$ touch file3.txt
lec2-user@ip-172-31-8-51]$ touch file3.txt
[ec2-usereip-172-31-8-511$
[ec2-user@ip-172-31-8-511s
[ec2-user@ip-172-31-8-51,-]$
[ec2-usereip-172-31-8-51 -15 locate file3. txt
/Eile3.txt
/dir1/£ile3.txt
(ec2-user@ip-112-31-8

diplay dati tem,tino


ud to
lec2-user®ip-172-31-8-51 ]$ date
Mon Mar 27 15:13:17 UTC: 2023
[ec2-usereip-172-31-8-51 1$ date Mtd/sm/&y
27/03/23
ec2-usereip-172-31-8-51 1$ date "+%H:8M:%s"
15:14:36
(ec2-user0ip-172-31-8-51-1$ date "+tyn,
2023
(ec2-usereip-172-31-8-51 -1$ date "+%B"
March
(ec2-user8ip-172-31-8-51 1$ date8A"
Monday
[ec2-userip-172-31-8-51 ]$

(al: ti ued
92. calenoleL with
ec2-usereip-172-1K-blocks
Eitmpfs
lesystem
devtmpfs 31-495088
8-51 -)^ df Used Available Use% Mounted on
tmpfs 502916 495088 0% /dev
tmpfs 502916 502916 0% /dev/shm

Idev/xvdal
trmpfs 502916
8376300 4013512
428 502488
502916
1% /run
0% /sys/Es/cgroup

Lec2-usereip-172-31-8-51 -1$ 100584 0


4362788 48% /
100584 0% /run/user/1000

Llemnand pdatod Neion

(ec2-inetulink/loopback
13 l0:
seOOPBACK,
reip-172-31-00:8LOWER-5010:00:0000:00
UR 1$ ip addr
u 65536 gdisc
nogueue:state UNKNONN group default glen 1000
12,0.01/83cope host lo brd
valid 1tt torever 00:00:00:00:00:00
net6 :1/128 scopehost
yalid ltt torever
preferred 1ft forever
U BROADCAST, preferred
MULTICAST, lft
UP,LOHER torever
UP mu
link/ether 02:c4A:32:a11c:34 brd go01ddisc pfifo fast state UP groUP k
net
17231.8.51/20
valid brd ff:ff:ff:ff:£f:ff
172.3115.255
1ft 2669sec preferred scope
lft 2669sec global.dynamic etho,
net6-fe80:c4325E
ylidTEt toreve Led1:1c34/64scope link
PeferEed 1ftEorever
ec2-usereip-172-31-8-51JSi
d te ek t
bitweon
Cenneld
tue edu Lhethu
Packd
[ec2-user®ip-172--31-8-51 -1$
[ec2-user@ip 172--31-8-511$
[ec2-usereip-172-31-8-51-19s
ec2-usereip-172-31-8-51-)$ ping www.google.com
RING WWM, googlecom (172.217.2.36) 56(84), bytes of data.
64bvtes from ord37s52=in f4le100.net
A 12,217.2.36) : icmp seg1 ttl46
a hutesfromiord31352-in-f4 net22:2172.36)
1e100 :icmp seg2 ttl=46 times171
hutefromord37s52-1nf4lel00.net (172:217.236) :
Fromord37s52-in-£4le100.net (172.217.2.36) : icicmp seg=3 ttl46 tÉne=17:5
mp seg=4 ttl=46 time-17
imes17 Sn
5
ns
Autes trom ord31552-in
ues f41e100.net172.2112.30)3 icupcup seq=S ttl=46 tme-175mE
ms

64 bytes from ironiord37s52-ingf41el00-net(2.217.301:


ord37s52-in-£4.le100.net .217.2.36) (172. seq=6 ttl=46 time>17-A
icmp seq-7 ttl=46
time-17.5 ms
google.com ping statistics
Tpackets transmitted, 2received, 0 packet loss, time 6010m
rtt min/avg/max/mdev 11.562/17.608/17,734/0.089 m
[ec2-userlip-172-31-8-51-1$

Q8. uued do
oloan mame
fec2-user@ip-172-31-8-517)$ cal
Su No March 2023
Tu We Th
1 2
Er Sa
5 6 4
12 13 14 B9 10 11
19 20 21 1S 16 17 18
22 23 24 25
26 27 28 29 30 31

ec2-user@ip-172-31-8-51 )_ cal nov 2000


Su MoNovembe 2000
Tu Ne Th r
Sa
6 7e
12 13 14 9 10 l1
19 20 21 15 16 17 18
22 23 24 25
26 27 28 29 30

tec2-user@ip172-31-8-51
Su November
MoTu Ne.
2000 -1_ cal 11 2000
Th ErSa
234
67089 1011
12 1314 15 16 17
18
19 2021 22 23 24.25
26 27 28 2930

[ec2-user@ip172-31-8-51-1_
bash: ncal: commànd nÍt foundncal
[ec2-userip-172 31-8 51 NS cal3
Februa|y 2029 March2023 April 2023
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Er Sa Su Mo Tu We Th F Sa
3 1 2 3 4 1

567. 8 9 10 s 6 78 9 10 1 1 2 3 4 5 6 28
12 1314 15 16 17 18 12 13 14 1516 17 18 9 10 11 12 13 14,15.
16 17 18 19 20 21 22
19 20.21 24 25 19. 20 21 22 23 24 25
26 2728 26 27 28 29 30 31 23 24 25 26 27 28 29
30
[ec2-user@ip+172-31-8-51 -1s

3 elup the
tun.
[ec2-user@ip-172-31-8-51~)$ sleep 10
[ec2-userip-172-318-51~]s

tin ts eseete a Comd.


timo
lec2-userip-172-31-8-51 ~1$ type -a time
shell kyword
is a/ust/bin/time
time is
time
(eç2-iser@ip172-31-8-51 ~$

ten
dip y tho cliik pace
tec2usereip-172-31-0-51
google, com
google,ccom
google. om has address 1-1^ host google.com
142)250.191.142
has IPV6 address
mail is handled 2607:1Ob0:4009:81a;:200e

(ec2-user@lp-172-31-9-51-19
by 10 smtp.google.còm.

to
eltablih
a teghna ln machine
hes C teset
edito

test edton.
login as: ec2-user
R Authenticat
ating with public key "imported-openssh-key"
Amazon Linux 2023

https:Ilaw_.amazon.com/linux/amazon-linùux-2023

Last logine Thu Mar 3017:06:28 2023from103.237.157:29


[ec2-user@ip-172-31-9-42]$ sudo yum install gcc
Last metadata expiration check: 1:07:11 ago on Thu Mar 30 16:04:06.2023
Package gcc 13:14.amzn2023:0.3-x86
resolved2R
64 is already inställed
Dependencies
Nothing to do.
Complete!
ec2-userei 172-31-9-42-19 nano, hello.c

nt aito
totlasg cade
ec2-user@ip-172-31-9-42:
GNU nano S.8R
include <stdio, h>
int main() {
printf("Hello World!!\n):
return 0;
5. lae eoiten

[Runec2-uthserlip-172-31-9-42
hello
~]$ gcC hello.c -0

eneutate ey
[ec2-user@ip-172-31-9-42 -1$ /hello
Hello World!!
lec2-user@ip-172-31-9-42 ~15

Viva Quutios

linud a uni- baud


snau
inun Toweld wes
uin. The way to gve a

wnslo.0s ii

e pimisnen in linus?

omnals?
(w) mkdi
GIpwd:
(V) moli
ts Cemnena
Guep clenstu
te oaeh tor tesct
n

malshg
te Ak!
()) Meut t teoppy duk,

diuk.
EXPERIMENT-3
AIM: - Implementation of FCFS using
Linux.
THEORY: -
Frst COme First Serve (FCES) is an onerating system scheduling algorithm that automatically
ueued requests and processes in order of their arrival. It is the casiest and simplest CPU
SCheduling algorithm, In this tyne of algorithm, processes that requests the CPU first get the CPU
alocat1on first. This is managed with a FIEO aueue. The full form of FCFS 1s First Come First
Serve.

s tne process enters the ready gueue, its PCB (Process ControlBlock) is linked with the tailof
the queue and, when the CPU becomes free, it should be assigned to the process at the beginning
of the queue.
Characteristics of the FCES method
It supports non-pre-emptive and pre-emptive scheduling algorithms.
Jobs are always executed on a first-come, frst-servebasis.
It is easy to implement and use.
Thismethod is poor in performance, and the general wait time isquite high.

CODE:
1. #include <stdio.h>

2. int main)
3. {
4. int pid[15];
5. int bt[15];
6. int n;

7. printf("Enter the number of proccsses: ");


scanf("%d",&n);
8.
processes: "):
printf"Enter process id of all the
9.
for(int i=0;i<n;it+)
10.

A1.
15. forint =is
16.

17.

18.
Scanik:
19. int i. wa[n]:
20. w[O:
21. for i=l: in;
22.

23.
24.

25. printt "Process ID


26. tloat tw-0.0;
27. tloat tat= 0,0;
28. foni-0; i ; i )
29.

30. print"d", pidli):


31. print" olir", beli):
32. print"dl\", wli):
33. print"odll", blilw|iD:
34. print"u":
35.

30. tat t(nli] blip;


37.
38. float at,w;

39,
40. att = tat/n:
41.

42.
printf("Avg. waiting time=%fAn",awt);
printf("Avg. turnaround time= %f",att);
43.}

OUTPUT: -

|[ec2-user@ip-112-31-42-186
[Enter
ec2-user@inumber
nter the p-l72-31-42-186~1_
o
gcc
-J$ /fcfsfcfs.c-o
processes: 3.
fcfs
process id of all the
Enter burst time of all processes:111 11,23
PrOcess proçesses:5
BurstTime Waiting Time TurnAround Tne
5

11 16
Avg 16
waitingtime 1 000000 27
ec2-usereip 112-31-42-1861S
of SJF EXPERIMENT-4
AIM: -
Impl
THEORY: -ementation Non-Pre-emptive using Linux operating system.
The
shortest job first (SJF) or
procesS with the
(SJN), can be Smallest executionshortesttimejobto next, is a scheduling policy that selects the waiting
prc-cmptive or execute next. SJN, also known as Shortest Job Next

eristics Jobof SJF Schedulnon-pre-cmpt


CharactShortest ing: ive.
all schedulingfirst has the
algorithms.
It is a
advantage of having a minimum average waiting time among

It
Greedy Algorithm.
may cause
starvation
using the concept if
of ageing.shorter processes keep conming. This problem can be solved
It is
practicallythem.
may not sort infeasible as
be used to While it is Operating System may not know burst times and
not possible to predict therefore
estimate the execution time for a iob, execution time, several methods can
execution times. such as a weighted
average of previous
SJF can be used in
are available, specialized environments where accurate
estimates of running time
Algorithm:
Sort all the
processes according to the arrival time.
Then select a process that
has minimum
After completion of the arrival time and
process make
minimum Burst time.
completion the previous process and processes that arrives
of a pool of

among theafterward
having minimun Burst time. select that process till the
pool which is
CODE:
1. #include<stdio.h>
2. int main()
3. {
4. int bt{201,p[20],wt[20],tat[20],1j,n,total-0,pos,temp;
5. float
6.
avg_wt,avg_ tat;
printf("Enter number of process:");
7. scanf("%d",&n);
8. printf("nEnter Burst Time:n");
9. for(i-0;i<n;i++)
10. {
11. printf("p%d:",i+l);
12. scanf("%d",&bt[i]);
13. p[i]=it1;
14. }
15. l/sorting of
burst times
16. for(i-0;i<n;i++)
17. {
18. posF0;
19. for(j=itl;j<n;j++)
20. {
if(bt[j]<bt[pos])
b. pos=j;
21. }
22. temp-bt[i];
23. bt[i]=bt[pos];
24. bt[pos]=temp;
25. temp-p[i];
26. p[i]p[pos];
27. p[pos]=temp;
28. }
29. wt[0]-0;
30. for(i=1;i<n;i++)
31. {
32. wt[i]=0;
33. for(j-0;j<i;j++t)
a. wt[i]+=bt[j];
34. total+=wt[i];
35. }avg_ wt-(float)total/n;
36.
TimetTurnaround Time"):
37. total-0; tWaiting
printf("nProcesst Burst Time
38.for(i-0;i<n;it+)
39.
40. tat[i]=bt[i]twt[i];
41. {
42. total+-tat[i]; %dttVodttt%d"p[i],b{[i], wt[i],tat/i):
printf("np%dtt
43.
44.} tat-(float)total/n; Time-%",avg wt):
avg Waiting Time-9%fn",avg tat);
45. printf("nnAverage Turnaround
46. printf("nAverage
47.
48. }

You might also like