
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A project for ecs 150 operating systems students in the fall quarter 2008. The goal is to implement user-level semaphores in minix by using the provided system calls: semup, semdown, seminit, semdestroy, and semstatus. Students are required to create a producer-consumer problem using these semaphores to synchronize access to a bounded buffer and necessary counters. The project includes initializing files, semaphores, and forking a specified number of producer and consumer processes. Hints are provided to implement these in the memory manager. Extra credit involves implementing errno codes and perror strings for more detailed error descriptions.
Typology: Assignments
1 / 1
This page cannot be seen from the preview
Don't miss anything!

ECS 150, Operating Systems Fall Quarter 2008
Due Date: December 2, 2008 Points: 100
#include <minix/semaphore.h> int semup(int semaphorenumber); int semdown(int semaphorenumber); int seminit(int semaphorenumber, int value); int semdestroy(int semaphorenumber); int semstatus(int semaphorenumber, int *value, int *numblocked);
In all the above system calls, semaphorenumber is the number of the semaphore (0 through 9). In seminit, the initial value of the semaphore is set to value. In semstatus, the current value of the semaphore is returned in value, and the number of processes blocked on that semaphore is returned in numblocked. The system call seminit creates the semaphore and returns 0 if the semaphore does not exist. The initial value is set to value. It returns โ1 if the semaphore exists. The system call semdestroy deletes the given semaphore and returns 0. If any processes are blocked on it, though, it returns โ1 and does not delete the semaphore. All other calls return 0 on success and โ1 on failure. Please implement the producer-consumer problem to verify your semaphores work correctly. Your program must use the semaphores to synchronize accesses to the bounded buffer (to be implemented as a file) and the necessary counters (also kept in a file). The program will open and initialize the files, initialize the semaphores, and then fork a specified number of producer and consumer processes which produce or consume a specified number of items. Hint: Implement these in the memory manager (MM), where tasks can be easily blocked and restarted. Note that you do not need a synchronization mechanism within the kernel to protect the semaphore structures because while the memory manager is running, no other process will run..
Version of November 17, 2008 at 8:27pm Page 1 of 1