| | | | MCQ Tutorial - Linux->Process | | | | 121.) Semaphore P() operation usually does the following: | | Options are: | | A.) Descrements the semaphore count and the process sleeps if needed
| | B.) None of the mentioned options
| | C.) Increments the semaphore count
| | D.) Wakes up a sleeping process
| | Correct Option: A | | | | | | | 122.) What is the output of the below code?
void sig_handler ( int signum) { printf("Handled the signal\n"); }
int main() { int pid; signal (SIGKILL, sig_handler); pid = fork(); if (pid==0) { kill(getppid(), SIGKILL); exit(0); } else { sleep(20); } return 0; } | | Options are: | | A.) Parent goes to the signal handler, prints handled the signal and goes back to sleep
| | B.) Error child cannot send a SIGKILL signal to parent.
| | C.) Parent exits without going to the signal handler
| | D.) Parent goes to the signal handler, prints handled the signal and exits
| | Correct Option: C | | | | | | | 123.) If a signal is received by a process, when will it be processed? | | Options are: | | A.) None of the mentioned options
| | B.) It is processed when process is switching to kernel mode
| | C.) It is processed immediately
| | D.) It is processsed in the next timeslice given to the process
| | Correct Option: B | | | | | | | | | | | |