Subject:-system programing
develop program in c language and modifiy in this twoprogram producer.c consumer.c
Two students team up to develop two programs, one for each. Thetwo programs
share a critical resource, a Printer (Let’s simulate it by using afile.). This
file only allows one process to access it at a time. Therefore asemaphore is
used to control the access to the file. The two programs firstlygain access
to the file through the semaphore. Once gaining the access, theprograms open
the file with appending mode and write something that is fromcommand line.
Afterwards write your name to the file. Then release the resourceand exit.
Producer.c
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include