operating system

Topics: Scheduling, Process states, Programming language Pages: 3 (464 words) Published: September 29, 2013
1. AIM: To write a C program to simulate the shortest job first algorithm with preemption. DESCRIPTION:
For implementing SJF algorithm with preemption, we consider the arrival times of each process, the burst times of all the previously arrived processes. After the arrival of all the processes into the ready queue, the average waiting time and turn around time can be calculated by using the above algorithm.

1) start
2) read the no of processes to n
3) initialize i to 0
4) if ia[j] then
a) swap a[i] and a[j]
b) swap at[i] and at[j]
c) swap b[i] and b[j]
8) from i=0 to n do
a) w[i]=s-b[i]-at[i]
b) s=s+a[i]
c) avg=avg+w[i]
10) tt=tt/n
11) avg=avg/n
12)write the turn around time and average waiting time
13) stop

2) AIM: To write a program on Shortest Job First algorithm with Non-Preemption Description:
Initially, In the shortest job first algorithm with non-preemption, the sorting of the process can be done based on their burst time in ascending order. The above algorithm calculates the averaging waiting time and turn around time of each process . ALGORITHM:

1) start
2) read the number of process into n
3) for i=0 to n step1 do
a) read the burst time of process into b[i]
b) check if b[i] is less than 0
i. write invalid input
ii. goto step 11
c) tt = tt+b[i]
4) for i=0 to n do step1
i. for j=1 to n step1 do
if b[i]>b[j]
5) assign 0 to w[0]
6) for i=1 to n do
7) tt=tt+avg
8) avg=avg/n
9) tt=tt/n
10) Print the average waiting time and turn around time
11) Stop
3) Aim: To write a c program to simulate First Come First Served(FCFS)algorithm using CPU Scheduling.
In FCFS algorithm, which ever the process that enters first in the ready queue will be allocated CPU first. Initially, the waiting time of the first process is kept zero. In this algorithm, the waiting time of the second process is the burst time of the first process and the...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Computer Operating System Essay
  • Operating System (Assignment) Essay
  • Operating System Concept Essay
  • Intro to Pc Operating System Chapter1 Essay
  • Operating System and Windows Essay
  • Types Of Operating System Essay
  • Scheduling System Essay

Become a StudyMode Member

Sign Up - It's Free