int sema_init(struct sema * sem,int val);
This functions is used to initialize the semaphore. The first arguement sema, is a pointer to the semaphore variable to be initialzed. The count associated with the semaphore is set initially to val.