Question 3 -- 10 points
Behold the following monitor/condition variable calls:
- Mon_t *mon_create() -- create and return a monitor.
- void mon_enter(Mon_t *) -- enter a monitor.
- void mon_exit(Mon_t *) -- exit a monitor.
- Cv_t *cv_create() -- create and return a condition variable.
- void cv_wait(Cv_t *, Mon_t *) -- wait on a condition variable.
- void cv_signal(Cv_t *) -- signal on a condition variable.
Implement the following general semaphore calls:
- Gsem_t *gsem_create(int) -- create and a semaphore with a
given value.
- void gsem_P(Gsem_t *) -- Call P() on the semaphore.
- void gsem_V(Gsem_t *) -- Call V() on the semaphore.
Don't worry about your #includes.
To make your life easier, use the answer sheet for Q3.