Description
OBJECTIVE:
PROGRAM 1: Write a C program to implement the solution to Dining-Philosophers problem.
PROGRAM 2: Write a C program to implement FCFS disk scheduling.
EXPECTED OUTPUT: [You can use fork or chopstick variable name]
Your output can slightly vary depending upon your implementation and the manner in which you are taking input and how the threads are scheduled on your system.
Philosopher 1 is thinking
Philosopher 2 is thinking
Philosopher 3 is thinking
Philosopher 4 is thinking
Philosopher 5 is thinking
Philosopher 1 is Hungry
Philosopher 1 takes fork 5 and 1
Philosopher 1 is Eating
Philosopher 2 is Hungry
Philosopher 4 is Hungry
Philosopher 4 takes fork 3 and 4
Philosopher 4 is Eating
Philosopher 3 is Hungry
Philosopher 5 is Hungry
Philosopher 1 putting fork 5 and 1 down
Philosopher 1 is thinking
Philosopher 2 takes fork 1 and 2
Philosopher 2 is Eating
Philosopher 4 putting fork 3 and 4 down
Philosopher 4 is thinking
Philosopher 5 takes fork 4 and 5
Philosopher 5 is Eating
Philosopher 2 putting fork 1 and 2 down
……..
….…
PROGRAM 2: Write a C program to implement FCFS disk scheduling and calculate Total Seek time and Average seek time as shown in the output below.
Your output can slightly vary depending upon your implementation and the manner in which you take input values