The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-27-2006
lilo lilo is offline
Registered User
  
 

Join Date: May 2006
Posts: 1
semaphore program

Hello,
can you help me to write this program?

Write a program that create 2 processes and 1 named pipe,where 1st child calculate 1st prime number, send it to pipe. 2nd process reads it from pipe and calculates next prime number and send it back to pipe.Controle synchronization with a semaphore.
Example of execution
Process 1527 prime number is 1
Process 1528 prime number is 3
Process 1527 prime number is 5
Etc…

N.B:while 1st process calculates ,2nd process should be blocked by semaphore
thanks