title: synchronization between processes using unnamed semaphores
body: <p>In <code>process-1</code> I am trying to write the data into shared memory. At the same time in <code>process-2</code> I am reading the data from the same shared memory. in this case I need to provide synchronization between these two processes. if I will go through unnamed semaphores (using <code>shm_init(),mmap()</code>),will it work or not? </p>
  
  <p>I have written code like this will it work or not?</p>
  
  <pre><code>fd = shm_open("shm_name", O_CREAT| O_RDWR, S_IRUSR | S_IWUSR);
  
  sema = mmap(NULL, sizeof(sem_t), PROT_READ | PROT_WRITE,MAP_SHARED , fd, 0);
  
  sem_init(sema, 1, 1);
  </code></pre>