0% found this document useful (0 votes)
48 views20 pages

Practical Os

Uploaded by

Saroj Kumari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views20 pages

Practical Os

Uploaded by

Saroj Kumari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PRACTICAL FILE ON OPERATING SYSTEM LAB

SUMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE


AWARD OF THE DEGREE OF

BACHELOR OF TECHNOLOGY

IN

COMPUTER SCIENCE & ENGINEERING (4TH SEMESTER)

[Link] PUNJAB TECHNICAL UNIVERSITY

HOSHIARPUR CAMPUS

SUBMITTED BY: SUBMITTED TO:

AMANDEEP KAUR ER. RAVNEET KAUR

ROLL NO. 2124112


PRACTICAL: 1
INSTALLATION OF WINDOW 10 OPERATING SYSTEM
Step 1: Download the windows installation files
To be able to install your desired window system, you need one so called ‘ISO’ file. This
contains all the necessary installation files. We will receive the download links for installing
the necessary ISO files by email with your key. If you already have an ISO file, you can do
this skip.

Please click on the “Downloads” link available from my key is provided. This download
image is suitable for installing windows. You can sign up for your desired version later
during the decide installation yet.

Step 2: Prepare a bootable operating system DVD or USB stick for devices
without a DVD reader
You prepare a USB stick specifically so that it becomes bootable and that operating system
can be started with it if the computer e.g. not has a DVD drive. There are two programs here
that we recommend windows USB/DVD download tool and rufus.
Method 1: Create a bootable USB stick in windows 10
1) A bootable USB stick can be easily created with the “windows USB/DVD download
tool”. It directly from Microsoft and can be downloaded here
[Link] . Please be patient, the website loads very slowly. Click
“download” on the right side of the website.

2) Install the program and open it. It should be in the “programs” folder.
3) Now select the windows operating system ISO file to be copied to be the USB stick
(“browse”) and click on “next”.

4) Now select “USB device”.

5) Now insert the USB stick, if it is not displayed, click on the small “update” symbol.
Attention: The USB stick will be deleted completely! If there is important data
on it, be sure to copy it to another location.
Now click on “begin copying”. The bootable USB stick is created. This can take a
few minutes.
Method 2: Create a bootabe USB stick from windows XP or vista
Do you still have an older operating system such as windows XP or vista and want to burn
the operating system to prepare a USB stick? Or did method 1 not work? We show you how
to do it here. The “windows USB download tool” mentioned above is less suitable for this,
since some. NET components are installed here, which may no longer work. Therefore, the
use recommended.

1) Go to [Link] .
2) Find the “download” area and be sure to download version 2.18 – this is last one that
still supports windows XP and Vista. If a newer version is offered, go to “other
versions” to download this version.

3) Install and open the program.


4) Now select the USB stick to which the windows operating system should be copied
1), and select “ISO image” 2) and click on the file search icon next to it 3). Select the
ISO file that you want to put on the stick and confirms the entry. Rufus automatically
makes the correct settings.
Please note that the USB stick must be larger than the ISO file! You must also know
that all data on the stick will be deleted. So make sure to backup the data if there is
any on it!

5) Click on “start” and wait until the files have been copied onto the stick properly.
You now have a bootable windows USB stick.

Step 3: Install the operating system on your device

Have you now followed the instructions are created a bootable USB stick? Now you
have to get your PC to boot from it and start the windows 7 installation process.

Method 1: Set boot order in BIOS

Regardless of whether you want to start from a bootable USB stick, you must first
tell the computer that it should boot from your medium, otherwise it will simply boot
the system that is already installed.
The correct setting is determined via the so called “boot order” in the BIOS. Here you
set which device (DVD, hard drive, USB stick) should be booted first.
Insert the USB stick into a free USB slot (we recommend the USB slots on the back
of the device, as these often have a faster port) and restart the device.
Now it is important that you get into the so called BIOS. The possibility to get into
this only appears briefly during the startup process. This is usually done by clicking
the F2, F8, F12 or ESC key. The request can e.g. “boot menu” or “BIOS Setup” are
called.
Select the start order “USB Flash Device”, confirm the selection and restart your
computer.
Note: If USB booting is not available for selection in the BIOS, it may be that your
computer is too old and unfortunately does not support booting from a USB stick.

Windows 10 installation step by step

After you have successfully followed the above steps, your system will now boot and
is in the process of installing the system. Here is a series of options that we will now
go through together.
Select the desired language and region.

Now click on “install now”.


Now you can enter your windows 10 product key.

Now accept the license terms and click on “next”.


Now you can choose whether you want to upgrade an existing system (“upgrade
windows….”) or whether you want a so called “clean install” (“custom :…”). The
latter will delete all data if you install it on an existing partition. Please note that the
upgrade only works if the same bit version is selected as for the original system. So it
is possible to upgrade from a 32bit system to a windows 10 system, but not from e.g.
from 64bit to 32bit.
In any case, make sure to backup your data, as there is always a risk of data loss!
In this guide, we opted for a clean reinstallation, i.e. “user-defined”.
Now select the partition on which windows 10 is to be installed. If necessary, delete
or format them beforehand (“delete” or “format” command), you can also create a
new partition (“new”).

Now windows are installed. This can take some time.


PRACTICAL: 2

IMPLEMENTATION OF CPU SCHEDULING


ALGORITHMS

a) FIRST COME FIRST SERVE (FCFS)

#include<iostream.h>
#include<conio.h>
void main ()
{
int n, bt[20], wt[20], tat[20], avwt=0, avtat=0, i, j;
cout<<”enter total number of processes(maximum 20): “;
cin>>n;
cout<<”\nenter process burst time:\n”;
for(i=0;i<n;i++)
{
cout<<”p[“<<i+1<<”]:”;
cin>>bt[i];
}
wt[0]=0;
for(i=1;i<n;i++)
wt[i]=0;
for(j=0;j<i;j++)
wt[i]+=bt[j];
}
cout<<”\nprocess\t\tburst time\twaiting time\tturnaround time”;
for(i=0;i<n;i++)
{
tat[i]=bt[i]+wt[[i];
avwt+=wt[i];
avtat+=tat[i];
cout<<”\np[“<<i+1<<”]”<<”\t\t”<<bt[i]<<”\t\t”<<wt[i]<<”\t\t”<<tat[i];
}
avwt/=i;
avtat/=i;
cout<<”\n\naverage waiting time:”<<avwt;
cout<<”\naverage turnaround time:”<<avtat;
getch();
}

To find the turnaround time and waiting time:


Gantt chart:

P1 P2 P3

0 24 27 30

b) SHORTEST JOB FIRST (SJF)


#include<iostream.h>

#include<conio.h>

void main()

int n, bt[20], wt[20], tat[20], avwt=0, avtat=0, i, j, index[20], itemp, temp;

cout<<”enter number of processes: “;

cin>>n;

cout<<”enter process burst time: “<<endl;

for(i=0;i<n;i++)

cout<<”p[“<<i+1<<”]:”;

cin>>bt[i];

index[i]=i;

}
for(i=0;i<n;i++)

for(j=i;j<n;j++)

if(bt[j]<bt[i])

swap(bt[i],bt[j]);

swap(index[i],index[j]);

wt[0]=0;

cout<<endl<<”process\t\tburst time\twaiting time\tturnaround time”<<endl;

for(i=0;i<n;i++)

wt[i+1]=wt[i]+bt[i];

tat[i]=wt[i]+bt[i];

avwt=avwt+wt[i];

avtat=avtat+tat[i];

cout<<”p[“index[i]+1<<”]\t\t”<<bt[i]<<”\t\t”<<wt[i]<<”\t\t”<<tat[i]<<endl;

Cout<<endl<<”average waiting time: “<<avwt/i<<endl;

Cout<<”average turnaround time: “<<avtat/n<<endl;

getch();

}
To find the average waiting time and average turnaround time

Gantt chart:

P10 P3 P7 P1 P2 P4 P6 P8 P5 P9

0 1 4 8 13 20 28 36 45 57 77

c) ROUND ROBIN (PRE-EMPTIVE)

#include<iostream.h>
#include<conio.h>
void findwaiting time(int processes[], int n, int bt[], int wt[], int quantum)
{
int rem_bt[n];
for(int i=0;i<n;i++)
rem_bt[i]=bt[i];
int t=0;
while(1)
{
bool done=true;
for(int i=0;i<n;i++)
{
if(rem_bt[i]>0)
{
done=false;
if(rem_bt[i]>quantum)
{
t+=quantum;
rem_bt[i]-=quantum;
}
else
{
t=t+rem_bt[i];
wt[i]=t-bt[i];
rem_bt[i]=0;
}
}
}
if(done==true)
break;
}
}
void findturnaround time(int processes[], int n, int bt[], int wt[], int tat[])
{
for(int i=0;i<n;i++)
{
tat[i]=bt[i]+wt[i];
}
void findavgtime(int processes[], int n, int bt[], int quantum)
{
int wt[n], tat[n], total_wt=0, total_tat=0;
f indwaiting time(processes, n, bt, wt, quantum);
findturnaround time(processes, n, bt, wt, tat);
cout<<”time quantum=”<<quantum<<endl;
cout<<”processes”<<”burst time”<<”waiting time”<<”turn time\n”;
for(int i=0;i<n;i++)
{
total_wt=total_wt+wt[i];
total_tat=total_tat+tat[i];
cout<<” “<<i+1<<”\t\t”<<bt[i]<<”\t”<<wt[i]<<”\t\t”<<tat[i]<<endl;
}
cout<<”average waiting time=”<<(float)total_wt/(float)n;
cout<<”\n average turnaround time=”<<(float)total_tat/(float)n;
}
int main()
{
int processes[]={1,2,3,4};
int n=sizeof processes/sizeof processes[0];
int burst_time[]={8,4,3,9};
int quantum=3;
findavgtime(processes, n, burst time, quantum);
getch();
}

Then the average waiting time and turnaround time:

Gantt chart:

P1 P2 P3 P1 P2 P1 P4 P4 P4
0 3 6 9 12 13 15 18 21 24

d) PRIORITY

#include<iostream.h>

#include<conio.h>

void main()

int bt[20], p[20], wt[20], tat[20], pr[20], i, j, n, total=0, pos, temp, avg_wt, avg_tat;

cout<<”enter total number of process: “;


cin>>n;

cout<<”\nenter burst time and priority\n”;

for(i=0; i<n;i++)

cout<<”\np[“<<i+1<<”]\n”;

cout<<”burst time: “;

cin>>bt[i];

cout<<”priority: “;

cin>>pr[i];

p[i]=i+1;

for(i=0;i<n;i++)

pos=i;

for(j=i+1;j<n;j++)

if(pr[j]<pr[pos])

pos=j;

temp=pr[i];

pr[i]=pr[pos];

pr[pos]=temp;

temp=bt[i];

bt[i]=bt[pos];

p[pos]=temp;

wt[0]=0;
for(i=1;i<n;i++)

wt[i]=0;

for(j=0;j<I;j++)

wt[i]+=bt[j];

total+=wt[i];

avg_wt=total/n;

total=0;

cout<<”\nprocess\t burst time \twaiting time\tturnaround time”;

for(i=0;i<n;i++)

tat[i]=bt[i]+wt[i];

total+=tat[i];

cout<<”\np[“<<p[i]<<”]\t\t “<<bt[i]<<”\t\t “<<wt[i]<<”\t\t\t”<<tat[i];

avg_tat=total/n;

cout<<”\n\naverage waiting time=”<<avg_wt;

cout<<”\naverage turnaround time=”<<avg_tat;

getch();

Then the average waiting time and turnaround time


Gantt chart

P2 P5 P1 P3 P4

0 1 6 16 18 19

You might also like