Yes cycleTimer.h is part of the pseudocode and is not provided by the professor. I am assuming she wants us to implement this header file.
PART 2 (15 points Here you are provided the following PSEUDO-CODE. Render this code to actual LINUX/C runnable code and execute it on your machines. Solve all questions asked below, report your results, and also fully justify them by searching on your online resources, manuals, textbooks, and figuring out how signals behave for the multi-thread situation. Your results are not going to be accepted as correct unless fully justified. #include
#include #include #include include include "CycleTimer.h typedef struct data t char name[1]; double age; data; void sigfunc (int sig) write(1, "Caught signal no din", sig); signal(sig,sig func); void sige func2(int sig) write(1, "Caught signal no-dn", sig); alrmflag-1; void func (data *p) int x; snprintf (p->name, 1e,, (int)pthread_selfo); could also do itoa) p->age-CycleTimer::currentseconds ); x(int) (((int)pthread_self) getpid)/((getpid) (int)test and _set(&lock))); sleep(5e); 1Sleep to catch the signals int main) pthread t tidi, tid2, tid3; pthread attr t attr; data d; data 'ptr &d int pid, lock-e; signal (SIGINT,SIG IGN); pthread create(&tidi,&attr, (void*)func,ptr) signal(SIGSEGV, sig_func); signal(SIGSTOP,sig_func); pthread create(&tid2,&attr, (void)func,ptr); signal (SIGFPE,sig func) signal (SIGALRM, sig func2); signal (SIGINT, sig func2); pthread create(&tid3,&attr, (void)func,ptr); pid getpid); sleep(1e); // Leave time for initializations and executing func for all threads pthread_kill (tid1,SIGSEGV) II Line A sleep(5) pthread kill(tid2,SIGSTOP) /Line B alarm(3); while(lalrmflag) pauseo; pthread_ kill(tid1,SIGINT) pthread_ kill(tid3,SIGINT) sleep(4e); pthread join(tid1, NULL) pthread_join(tid2, NULL): pthread_join(tid3, NULL): // Line C (1) // Line C (2) /I Line D // Line E PART 2 (15 points Here you are provided the following PSEUDO-CODE. Render this code to actual LINUX/C runnable code and execute it on your machines. Solve all questions asked below, report your results, and also fully justify them by searching on your online resources, manuals, textbooks, and figuring out how signals behave for the multi-thread situation. Your results are not going to be accepted as correct unless fully justified. #include #include #include #include include include "CycleTimer.h typedef struct data t char name[1]; double age; data; void sigfunc (int sig) write(1, "Caught signal no din", sig); signal(sig,sig func); void sige func2(int sig) write(1, "Caught signal no-dn", sig); alrmflag-1; void func (data *p) int x; snprintf (p->name, 1e,, (int)pthread_selfo); could also do itoa) p->age-CycleTimer::currentseconds ); x(int) (((int)pthread_self) getpid)/((getpid) (int)test and _set(&lock))); sleep(5e); 1Sleep to catch the signals int main) pthread t tidi, tid2, tid3; pthread attr t attr; data d; data 'ptr &d int pid, lock-e; signal (SIGINT,SIG IGN); pthread create(&tidi,&attr, (void*)func,ptr) signal(SIGSEGV, sig_func); signal(SIGSTOP,sig_func); pthread create(&tid2,&attr, (void)func,ptr); signal (SIGFPE,sig func) signal (SIGALRM, sig func2); signal (SIGINT, sig func2); pthread create(&tid3,&attr, (void)func,ptr); pid getpid); sleep(1e); // Leave time for initializations and executing func for all threads pthread_kill (tid1,SIGSEGV) II Line A sleep(5) pthread kill(tid2,SIGSTOP) /Line B alarm(3); while(lalrmflag) pauseo; pthread_ kill(tid1,SIGINT) pthread_ kill(tid3,SIGINT) sleep(4e); pthread join(tid1, NULL) pthread_join(tid2, NULL): pthread_join(tid3, NULL): // Line C (1) // Line C (2) /I Line D // Line E