hw7.c
#include <stdio.h>#include <stdlib.h>#include <pthread.h>#include <sys/time.h>#include <semaphore.h>typedef struct{ int ID;} param_structure;#define THREAD_NUM 5#define MAX_ITERATION 9000sem_t chopsticks[THREAD_NUM];// Need to use the following functions in the right place with the right parameters// sem_init() // sem_wait()// sem_post()void *philosopher(void *param){ int phID=((param_structure *)param)->ID;
OR
OR