OUTPUT AT SERVER TERMINAL
[root@VIPIN scp_shm_usingsemp]# ./server
semget: Success
process 8390 create the semaphore
semctl: Success
process 8390 control the semaphore
address of val in server0x804914c
shmget: Success
process 8390 create the shared mem
process 8390 control the shared mem
shmctl: Success
process 8390 attach the shared mem
shmat: Success
signal is recieved by 8390
16
5
*
shmget: Success
process 8420 create the shared mem
process 8420 control the shared mem
shmctl: Success
process 8420 attach the shared mem
shmat: Success
signal is recieved by 8390
4
1
+
shmget: Success
process 8421 create the shared mem
process 8421 control the shared mem
shmctl: Success
process 8421 attach the shared mem
shmat: Success
signal is recieved by 8390
42
32
-
shmget: Success
process 8422 create the shared mem
process 8422 control the shared mem
shmctl: Success
process 8422 attach the shared mem
shmat: Success
OUTPUT AT REQUESTING CLIENT TERMINAL
[root@VIPIN scp_shm_usingsemp]# ./runclient
address of val in rc10x8049ff8
shmget: Success
process 8525 create the shared mem
process 8525 control the shared mem
shmctl: Success
semget: Success
process 8525 create the semaphore
address of val in rc20x8049ff8
process 8525 get the semaphore
semop value at waiting:-1
process 8525 attach the shared mem
shmat: Success
shmget: Success
process 8526 create the shared mem
process 8526 control the shared mem
shmctl: Success
semget: Success
process 8526 create the semaphore
process 8526 get the semaphore
semop value at waiting:-1
shmget: Success
process 8527 create the shared mem
process 8527 control the shared mem
shmctl: Success
semget: Success
process 8527 create the semaphore
process 8527 get the semaphore
semop value at waiting:-1
signal is recieved by 8525
result read by rc1: 4 + 1 = 5
process 8525 release the semaphore
semop value at releasing:1
process 8526 attach the shared mem
shmat: Success
signal is recieved by 8526
result read by rc2: 42 – 32 = 10
process 8526 release the semaphore
semop value at releasing:1
process 8527 attach the shared mem
shmat: Success
signal is recieved by 8527
result read by rc1: 16 * 5 = 80
process 8527 release the semaphore
semop value at releasing:1
[root@VIPIN scp_shm_usingsemp]#