11. What is the output of this program?
#include<stdio.h>
#include<pthread.h>
#include<semaphore.h>
sem_t st;
void *fun_t(void *arg);
void *fun_t(void *arg)
{
printf("Linux\n");
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,0,2) != 0)
perror("sem_init");
if(sem_wait(&st) != 0)
perror("sem_wait");
printf("Example\n");
if(sem_wait(&st) != 0)
perror("sem_wait");
if(pthread_join(pt,&res_t) == -1)
perror("pthread_join");
if(sem_destroy(&st) != 0)
perror("sem_destroy");
return 0;
}
#include<stdio.h>
#include<pthread.h>
#include<semaphore.h>
sem_t st;
void *fun_t(void *arg);
void *fun_t(void *arg)
{
printf("Linux\n");
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,0,2) != 0)
perror("sem_init");
if(sem_wait(&st) != 0)
perror("sem_wait");
printf("Example\n");
if(sem_wait(&st) != 0)
perror("sem_wait");
if(pthread_join(pt,&res_t) == -1)
perror("pthread_join");
if(sem_destroy(&st) != 0)
perror("sem_destroy");
return 0;
}
12. What is the output of this program
#include<stdio.h>
#include<pthread.h>
void *fun_t(void *arg);
void *fun_t(void *arg)
{
pthread_exit("Bye");
}
int main()
{
pthread_t pt;
void *res_t;
int ret;
ret = pthread_join(pt,&res_t);
printf("%d\n",ret);
return 0;
}
#include<stdio.h>
#include<pthread.h>
void *fun_t(void *arg);
void *fun_t(void *arg)
{
pthread_exit("Bye");
}
int main()
{
pthread_t pt;
void *res_t;
int ret;
ret = pthread_join(pt,&res_t);
printf("%d\n",ret);
return 0;
}
13. The files of /proc directory are
14. Host specific configuration files are installed in
15. What is the output of this program?
#include<stdio.h>
#include<sys/time.h>
#include<sys/resource.h>
int main()
{
struct rlimit limit;
if(getrlimit(RLIMIT_DATA,&limit) != 0)
perror("getrlimit");
printf("%lu\n",limit.rlim_max);
return 0;
}
#include<stdio.h>
#include<sys/time.h>
#include<sys/resource.h>
int main()
{
struct rlimit limit;
if(getrlimit(RLIMIT_DATA,&limit) != 0)
perror("getrlimit");
printf("%lu\n",limit.rlim_max);
return 0;
}
16. SVR4 was developed by
17. Which sytem call can be used by a user process to lock a memory so that it cannot be swapped out?
18. The 'logout' built in command is used to
19. The compiler converts
20. The contents of root filesystem is responsible to
Read More Section(Linux)
Each Section contains maximum 100 MCQs question on Linux. To get more questions visit other sections.