Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribedimage text in transcribed

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 3 Lnai 9286

Authors: Albert Bifet ,Michael May ,Bianca Zadrozny ,Ricard Gavalda ,Dino Pedreschi ,Francesco Bonchi ,Jaime Cardoso ,Myra Spiliopoulou

1st Edition

3319234609, 978-3319234601

More Books

Students also viewed these Databases questions

Question

i need 2 4 7 .

Answered: 1 week ago

Question

What is self-confidence? How is it related to expectations?

Answered: 1 week ago