Vidyalelo
Computer Science · Q234

Linux

Engineering and GATE · Computer Science · question 234

Q234

In this program the semaphore #include #include #include sem_t st; void *fun_t(void *arg); void *fun_t(void *arg) pthread_exit("Bye"); int main() pthread_t pt; void *res_t; if(pthread_create(&pt,NULL,fun_t,NULL) == -1) perror("pthread_create"); if(sem_init(&st,1,2) != 0) perror("sem_init"); if(pthread_join(pt,&res_t) == -1) perror("pthread_join"); if(sem_destroy(&st) != 0) perror("sem_destroy"); return 0;

A.
can be used only for this process
B.
can be used for any other process also
Answer
C.
can be used
D.
none of the mentioned

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board