Question
In this question youll be taking a look at how signal handlers behave and are implemented at the kernel level. The questions you need to
In this question youll be taking a look at how signal handlers behave and are implemented at the kernel level. The questions you need to answer are: 1. What happens if a signal handler gets invoked when its already handling a signal for that same signal/handler? For example, what happens when a process receives a signal for SIGUSR1 when its already handling SIGUSR1? 2. What happens if a signal handler gets invoked if the process is already handling a different signal? For example, what happens when a process receives a signal for SIGUSR2 when its busy handling SIGUSR1? You should write a small program that intentionally creates a situation where these things happen. The program that you write will use the fork system call to create a child process. The child process will register 2 different signal handlers for 2 different signals (SIGUSR1 and SIGUSR2). The parent process will send signals to the child process in a way that forces the above situations to happen. The program that you write must use sleep (see man 3 sleep) to make sure that: The child process is able to register the signal handlers before the parent process sends signals, The child process is busy handling a signal when the parent process tries to send it more signals. You will also write a Markdown-formatted report that explains the behaviours using information from the Linux manual pages for the signal system call (man 2 signal).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started