Anda di halaman 1dari 3

C:\Users\Shivam>notepad bankers.

c
C:\Users\Shivam>path=c:\windows;c:\windows\system32;c;\mingw32\bin
C:\Users\Shivam>gcc bankers.c -o bankers.exe
C:\Users\Shivam>bankers
Following is the SAFE Sequence
P1 -> P3 -> P4 -> P0 -> P2
C:\Users\Shivam>
C:\Users\Shivam>notepad consumer.c
C:\Users\Shivam>path=c:\windows;c:\windows\system32;c:\mingw32\bin
C:\Users\Shivam>gcc consumer.c -o consumer.exe
C:\Users\Shivam>consumer
1.Producer
2.Consumer
3.Exit
Enter your choice:1
Producer produces the item 1
Enter your choice:2
Consumer consumes item 1
Enter your choice:1
Producer produces the item 1
Enter your choice:1
Producer produces the item 2
Enter your choice:1
Producer produces the item 3
Enter your choice:1
Buffer is full!!
Enter your choice:3
C:\Users\Shivam>
C:\Users\Shivam>notepad priority.c
C:\Users\Shivam>priority
enter the number of processes=5
enter the burst time for each process
p1=4
priority of p1=2
p2=3
priority of p2=7
p3=8
priority of p3=0
p4=11
priority of p4=1
p5=9
priority of p5=6
waiting time for p[3]=0 turn around time for p[3]=8
waiting time for p[4]=8 turn around time for p[4]=19
waiting time for p[1]=19 turn around time for p[1]=23
waiting time for p[5]=23 turn around time for p[5]=32
waiting time for p[2]=32 turn around time for p[2]=35
average turn around=23
C:\Users\Shivam>
C:\Users\Shivam>notepad sjf.c
C:\Users\Shivam>sjf
Enter number of process:4
Enter Burst Time:
p1:4
p2:12
p3:3
p4:6
Process Burst Time Waiting Time Turnaround Time
p3 3 0 3
p1 4 3 7
p4 6 7 13
p2 12 13 25
Average Waiting Time=5.750000
Average Turnaround Time=12.000000
C:\Users\Shivam>
C:\Users\Shivam>notepad dinphilo.c
C:\Users\Shivam>gcc dinphilo.c -o dinphilo.exe
C:\Users\Shivam>dinphilo
Fork 1 taken by Philosopher 1
Fork 2 taken by Philosopher 2
Fork 3 taken by Philosopher 3
Philosopher 4 is waiting for fork 3
Till now num of philosophers completed dinner are 0
Fork 4 taken by Philosopher 1
Philosopher 2 is waiting for Fork 1
Philosopher 3 is waiting for Fork 2
Philosopher 4 is waiting for fork 3
Till now num of philosophers completed dinner are 0
Philosopher 1 completed his dinner
Philosopher 1 released fork 1 and fork 4
Fork 1 taken by Philosopher 2
Philosopher 3 is waiting for Fork 2
Philosopher 4 is waiting for fork 3
Till now num of philosophers completed dinner are 1
Philosopher 1 completed his dinner
Philosopher 2 completed his dinner
Philosopher 2 released fork 2 and fork 1
Fork 2 taken by Philosopher 3
Philosopher 4 is waiting for fork 3

Anda mungkin juga menyukai