Instruction manuals

SRM University Btech Cse C Record

Description
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING SRM UNIVERSITY SRM NAGAR, KATTANKULATHUR - 603203. SUBJECT SUBJECT CODE SEMESTER : OPRATING SYSTEM LAB : CS0212 : II CLASS: I year CSE EX. NO NAME OF THE EXPERIMENTS PAGE NO SIGN 1 2 3 4 5 6 7 8 CPU Scheduling – FCFS CPU Scheduling – SJF CPU Scheduling – SJF Priority CPU Scheduling – Round Robin Page Replacements – FIFO Page Replacements – LRU Page Replacements - Optimal Dead Lock - Detection 1 3 5 8 11 14 17 20 Ex. No: 1 CPU SCHEDULING -
Published
of 23
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
  DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING   SRM UNIVERSITY SRM NAGAR, KATTANKULATHUR - 603203. SUBJECT : OPRATING SYSTEM LAB SUBJECT   CODE : CS0212 SEMESTER : II CLASS: I year CSE EX. NO NAME OF THE EXPERIMENTS PAGE NOSIGN  1 CPU Scheduling – FCFS 12 CPU Scheduling – SJF 33 CPU Scheduling – SJF Priority 54 CPU Scheduling – Round Robin 85 Page Replacements – FIFO 116 Page Replacements – LRU 147 Page Replacements - Optimal 178 Dead Lock - Detection 20  Ex. No: 1 CPU SCHEDULING - FCFSAim: To write a new programs CPU Scheduling using First Come First Servealgorithm in ‘c’ program. Algorithm: Step 1 : Start the programStep 2 : Define maximum array valueStep 3 : To give the total number of Job’s valueStep 4 : To give the job’s time one by one up to total number of job’sStep 5 : To calculate service timeStep 6 : To calculate individual job waiting timeStep 7 : To calculate total waiting timeStep 8 : To calculate average waiting timeStep 9 : To write each job in waiting timeStep 10 : To write continue total service time, separate job waiting time, totalwaiting time and average waiting timeStep 11 : End Program: #include<stdio.h>void main(){int i,n,a[20],wt[20],st=0,twt=0;float awt;clrscr();printf( CPU Scheduling - FCFS );printf( \n-------------------------- );printf( \nEnter the number of JOBS: );scanf( %d ,&n);for(i=1;i<=n;i++){printf( Enter the JOB%d: ,i);scanf( %d ,&a[i}for(i=1;i<=n;i++){wt[i]=st;twt=twt+wt[i];st=st+a[i];}awt=twt/n;for(i=1;i<=n;i++){printf( \nWaiting Time JOB%d: %d ,i,wt[i}  printf( \n-------------------------- );printf( \n%d-JOBS Service time\t: %d ,n,st);printf( \nTotal Waiting Time\t: %d ,twt);printf( \nAverage Waiting Time\t: %.2f\n ,awt);getch();} OUTPUT: CPU Scheduling - FCFS--------------------------Enter the number of JOBS: 5Enter the JOB1:12Enter the JOB2:25Enter the JOB3:35Enter the JOB4:48Enter the JOB5:56Waiting Time JOB1: 0Waiting Time JOB2: 12Waiting Time JOB3: 37Waiting Time JOB4: 72Waiting Time JOB5: 120--------------------------5-JOBS Service time : 176Total Waiting Time : 241Average Waiting Time : 48.00 Result: Thus the above CPU Scheduling using First Come First Serve algorithmProgram to compile and run the output was successfully completed.  Ex. No: 2 CPU SCHEDULING - SJFAim: To write a new program CPU Scheduling using Sort Job First algorithm in ‘c’program. Algorithm: Step 1 : Start the programStep 2 : Define maximum array valueStep 3 : To give the total number of Job’s valueStep 4 : To give the job’s time one by one up to total number of job’sStep 5 : To sort the all job’s in ascending orderStep 6 : To write a sorted job’s in ascending orderStep 7 : To calculate service timeStep 8 : To calculate individual job waiting timeStep 9 : To calculate total waiting timeStep 10 : To calculate average waiting timeStep 11 : To write each job in waiting timeStep 12 : To write continue total service time, separate job waiting time, totalwaiting time and average waiting timeStep 13 : End Program: #include<stdio.h>void main(){int i,j,n,temp=0,a[20],b[20],wt[20],st=0,twt=0;float awt;clrscr();printf( CPU Scheduling - SJF );printf( \n-------------------------- );printf( \nEnter the number of JOBS: );scanf( %d ,&n);for(i=0;i<n;i++){printf( Enter the JOB%d: ,i);scanf( %d ,&a[i}for(i=1;i<n;i++){temp=a[i];for(j=i-1;j>=0&&temp<a[j];j--){a[j+1]=a[j];a[j]=temp;}}

12090010

Dec 31, 2017

Rupture Erito

Dec 31, 2017
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks