Write a c-program to create a semaphore.

c-program to create a semaphore.
#include&alt;stdio.h>
#include&alt;sys/types.h>
#include&alt;sys/ipc.h>
#include&alt;sys/sem.h>
main()
{
int semid, key,nsems;
key = (key_t)0x20;
nsems = 1;
semid = semget(key,nsems,IPC_CREAT | 0666);
printf("created semaphore id %d\n,semid");
}
c-program to create a semaphore.

Post a Comment

0 Comments