71. What is the output of this program?
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/sem.h>
static int sem_p(void);
static int sem_v(void);
union semun{
int val;
struct semid_ds *buf;
unsigned short array;
};
int sem_id;
struct semid_ds myds;
struct sembuf mybuf;
union semun myun;
static int sem_p(void)
{
mybuf.sem_num = 0;
mybuf.sem_op = -1;
mybuf.sem_flg = SEM_UNDO;
semop(sem_id,&mybuf,1);
}
static int sem_v(void)
{
mybuf.sem_num = 0;
mybuf.sem_op = 1;
mybuf.sem_flg = SEM_UNDO;
semop(sem_id,&mybuf,1);
}
int main()
{
int wfd, rfd;
sem_id = semget((key_t)911,1,0666 | IPC_CREAT);
myun.val = 0;
semctl(sem_id,0,IPC_RMID,myun);
semctl(sem_id,0,SETVAL,myun);
sem_p();
printf("Example\n");
sem_v();
return 0;
}
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/sem.h>
static int sem_p(void);
static int sem_v(void);
union semun{
int val;
struct semid_ds *buf;
unsigned short array;
};
int sem_id;
struct semid_ds myds;
struct sembuf mybuf;
union semun myun;
static int sem_p(void)
{
mybuf.sem_num = 0;
mybuf.sem_op = -1;
mybuf.sem_flg = SEM_UNDO;
semop(sem_id,&mybuf,1);
}
static int sem_v(void)
{
mybuf.sem_num = 0;
mybuf.sem_op = 1;
mybuf.sem_flg = SEM_UNDO;
semop(sem_id,&mybuf,1);
}
int main()
{
int wfd, rfd;
sem_id = semget((key_t)911,1,0666 | IPC_CREAT);
myun.val = 0;
semctl(sem_id,0,IPC_RMID,myun);
semctl(sem_id,0,SETVAL,myun);
sem_p();
printf("Example\n");
sem_v();
return 0;
}
72. In sysfs every subsystem has
73. In the shell, by default, all variables are considered and stored as
74. In GDB, a tracepoint can be set by the command
75. The permission -rwxr-sr– represented in octal expression will be
76. Switch table is used by
77. Which daemon manages the physical memory by moving process from physical memory to swap space when more physical memory is needed.
78. Which gcc option includes debugging info in the generated object code?
79. Which option of gcc makes the compiler print out each function name as it is compiled, and print some statistics about each pass when it finishes?
80. If a file is removed in Unix using 'rm' then
Read More Section(Linux)
Each Section contains maximum 100 MCQs question on Linux. To get more questions visit other sections.