Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Download
Standard view
Full view
of .
Add note
Save to My Library
Sync to mobile
Look up keyword or section
Like this
6Activity
×
P. 1
Lab Manual Os

Lab Manual Os

Ratings: (0)|Views: 4,648|Likes:
Published by Harshali Singh

More info:

Published by: Harshali Singh on Dec 24, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See More
See less

05/23/2013

pdf

text

original

 
Ramrao Adik Institute Of Technology, Nerul, Navi Mumbai2008-2009
Subject: Operating SystemsSemester: VIPractical Lists
 
1) Study and implement scheduling algorithms (FCFS, SJF, RR, Priority)2) Study and implement page replacement algorithms (FIFO, LRU).3) Study and implement memory management algorithm (Best fit and First Fit)4) Study and implement Dekker’s and Peterson’s Algorithm5) Study and implement Readers/ Writers Problem6) Study and implement Dinning Philosophers Problem7) Study and implement Banker’s Algorithm (Deadlock Avoidance)8) Study basics of shell commands in Unix / Linux9) Study and implement basics of shell programming in Linux / Unix
 
SCHEDULING ALGORITHMSAIM OF THE EXPERIMENT:-
 To study and implement scheduling algorithms (FCFS, SJF, Round Robin andPriority)
THEORY:-
FIRST COME FIRST SERVED(FCFS):-
 
The process that requested the CPU first is allocated the CPU first.
 
FCFS policy is easily implemented with a FIFO queue.
 
When a process enters into the ready queue, its PCB is linked onto the tail of thequeue.
 
The average waiting time under the FCFS policy is often quite long.
 
The FCFS scheduling algorithm is NON-PREEMPTIVE.
 
Once the CPU has been allocated to a process, that process keep the CPU until itreleases the CPU, either by terminating or requesting I/O.
 
The FCFS algorithm is particularly troublesome for time sharing systems.
 
There is a convoy affect as all the other process wait for one big process to get off the CPU.
EXAMPLE:-PROCESS BURST TIME
P1 24P2 03P3 03
GANTT CHART:-
P1 P2 P30 24 27 30
PROCESS WAITING TIME TURN AROUND TIME
P1 00 24P2 24 27P3 27 30Avg. waiting time =(0+24+27)/3=17 time unit.Avg.turn around time =(24+27+30)/3=27 time unit.
SHORTEST JOB FIRST SHEDULING ALGORITHM (SJF):-
 
When CPU is available it is assigned to the process that has the smallest nextCPU burst.
 
 
FCFS scheduling is used to break tie.
 
 
 
SJF scheduling algorithm is optimal since it gives minimum average waiting timefor a given set of process.
 
 
Difficulty with SJF is knowing the length of the next CPU request.
 
 
SJF algorithm may be either PREEMPTIVE or NON-PREEMPTIVE.
 
 
When a new process arrive at the ready queue while a previous process isexecuting the new process may have shorter next CPU burst than what is left of the currently executing process to finish its CPU burst.
 
 
PREEMPTIVE SJF scheduling is also called as shortest remaining time firstscheduling
 
 
Although the SJF algorithm is optimal it can not be implemented at the level of short term CPU scheduling.
 
 
SJF scheduling is used frequently in long term scheduling where time limit of theprocess can be used as length of he process that the user specifies whilesubstituting the job.
 
 
Since there is no way to know the length of next CPU burst we try to predict itsvalue.
 
 
We expect that the next CPU burst will be similar in length to the previous ones.
 
 
We compute an appropriate length of next CPU burst and pick the process withthe shortest predicted CPU burst is generally predicted as an exponential averageof the measured length of previous CPU burst
 
Tn+1 =
α
tn + (1-
α
) Tn where 0
 
α≤
1 exponential average.tn = length of the CPU burst (most recent information).Tn = the past history of all CPU bursts.Tn+1 = our predictor value for the next CPU burst
 
the parameter
α
control the relative weight of recent and past history in ourprediction .if 
α
=0,then Tn+1=Tn and only the most recent CPU burst matters.if 
α
=1/2,recent history and past history are equally weighted.
 EXAMPLE:-PROCESS BURST TIME
P1 06P2 08P3 07P4 03
GANTT CHART:-
P4 P2 P3 P20 3 9 16 24
PROCESS Waiting Time Turn Around Time
P1 03 09P2 16 24P3 09 16

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->