Answers

Question and Answer:

  Home  Linux Debugging

⟩ Which one of the following string will print first by this program? #include<stdio.h> #include<pthread.h> void *fun_t(void *arg); void *fun_t(void *arg) { printf("Googlen"); pthread_exit("Bye"); } int main() { pthread_t pt; void *res_t; if(pthread_create(&pt,NULL,fun_t,NULL) != 0) perror("pthread_create"); printf("Linuxn"); if(pthread_join(pt,&res_t) != 0) perror("pthread_join"); return 0; } a) Linux b) Google c) it can not be predicted d) none of the mentioned

b) Google

Explanation:It depends upon the scheduler.

Output:

[root@localhost Google]# gcc -o san san.c -lpthread

[root@localhost Google]# ./san

Google

Linux

[root@localhost threads]#

 170 views

More Questions for you: