Reception of INTERRUPT solution

$19.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (1 vote)

Assignment 3
Problem for the Lab
Write a C program to handle the reception of INTERRUPT FROM THE
KEYBOARD signal by executing a particular (user) function, which function is
responsible for creating a child process by using fork() system call. Also, the child
process will take an input N (N is the no. of terms to generate the Fibonacci series)
from the user and generate the Fibonacci series up to N terms. Then the child
process will send the Fibonacci series terms one by one to the parent process by
using pipe() system call and the parent process will read the Fibonacci series terms
one by one and will display it.
(N.B. – Before sending the Fibonacci terms one by one from the child
process, first you send the Process ID of the child process to the parent process and
read and display it in the parent process. Again after sending the terms one by one
from the child process to the parent process, from the child process you send the
Signal ID for which handler function has been generated and read and display it in
the parent process.)
Hints:-
• Learn about signal () system call, pipe () system call, fork () system call, write
() system call, read () system call.
• To keep synchronize the child process execution with parent process
execution and vice versa, you may need to use the sleep () system call.
• For the above mentioned system call, follow the man pages.
• Try to understand the following diagram (Diagram1).
Main Program
Signal Handler using signal() system call
Figure1:- Diagram1
Handler Function
1. Take input N.
2. Create Pipe using pipe() system call
3. Create Child Process using fork() system call.
Child Process
1. Send its PID to the parent through the pipe
using write() system call.
2. Generate the Fibonacci series up to N terms
and send the terms one by one to the parent
through the pipe using write system call.
3. Send the signal ID for which the handler
function is generated to the parent through the
pipe using write system call.
Parent process
Parent process will read and display the PID,
Fibonacci terms and signal ID respectively from the
pipe using the read() system call.
When Keyboard Interrupt signal will be generated
Return to the main()