

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Information about program set 3 for cis 390, which focuses on kernel timers and signals. Students are required to complete two tasks: running a signal handling program and completing the kernel timer program. The tasks involve creating, compiling, and running programs, as well as setting up timers using setittimer instruction. Sample outputs for different input values.
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!
#include <signal.h>
void sig_handler(int);
int main(void) { int i, parent_pid, child_pid, status;
signal(SIGUSR1, sig_handler); signal(SIGUSR2, sig_handler);
parent_pid = getpid();
if ((child_pid = fork()) == 0) { printf("Child signaling parent\n"); kill(parent_pid, SIGUSR1); for(;;) pause(); } else { printf("Parent signaling child\n"); kill(child_pid, SIGUSR2); sleep(4); printf("Parent terminating child\n"); kill(child_pid, SIGTERM); wait(&status); printf("Done\n"); } }
void sig_handler(int signo) { switch(signo) { case SIGUSR1: printf("Parent recieved SIGUSR1\n"); break; case SIGUSR2: printf("Child recieved SIGUSR2\n"); break; } return; }
/*
Child signaling parent Parent recieved SIGUSR Parent signaling child Child recieved SIGUSR Parent terminating child Done
*/