• Create a directory named ``pup7'' under your home directory.
    This directory must contain
    • Makefile
    • README
    • other files ...
  • Due day, 4/29 00:01am
  • Description:
      Try to monitor the actions of producer-consumer algorithm
    • The parent creates two processes. One of them is the producer and the other is the consumer. These three processes share some memory to complete this job. ( example of creating shared memory This example only allocate enough memory for an integer. You can change the second parameter of mmap() to create a bigger shared memory.)
    • Either producer or consumer will perform their operations with random delay between them. In order to control the access to the buffer, producer and consumer must cooperate well. The control is enforced by parent. Each child will send request to parent just like system call. The pseudo code for producer is
                          for(;;){
                            sleep for a while
                            producing an item 
                            REQUEST
                              put into buffer
                            RELEASE
                          }
                     
      The REQUEST and RELEASE are implemented with sending signal to parent. But REQUEST should be a block function call. So after sending to parent, some code like pause() must be used.