1 / 9

Nutt Exercise III

continued. Nutt Exercise III. Signal handlers. The complete program on p. 91 illustrates how a signal handler is registered with the signal() system call (see man page on cs01) Also illustrates how the whole signaling system operates Also illustrates the form of a signal handler

corbin
Télécharger la présentation

Nutt Exercise III

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. continued Nutt Exercise III

  2. Signal handlers • The complete program on p. 91 illustrates how a signal handler is registered with the signal() system call (see man page on cs01) • Also illustrates how the whole signaling system operates • Also illustrates the form of a signal handler • See code on cs01, modified

  3. Problem statement (Part A) • A: use ITIMER_REAL to implement your version of gettimeofday(). • Set it so it raises a signal once a second • Use signal facility to determine when ITIMER_REAL has been decremented to 0 and to count the number of seconds elapsed

  4. Problem statement (Part B) • B: Design & implement facilities that use ITIMER_VIRTUAL and ITIMER_PROF interval timers to profile a process. • Profiler provides actual time of execution using timer from Part A • CPU time • User-space time • Kernel-space time

  5. More on Part B • Use your gettimeofday() to compute program’s “wall clock” runtime • All times should have millisecond accuracy, even though you might not get this level of accuracy in reality • Use signal facility to create signal handlers to keep track of the number of seconds of virtual and profile time • Raise signal once a second

  6. Problem statement (Part C) • Write a subject program to spawn 2 children, with each child recursively computing a Fibonacci sequence (the dumb way using f(n) = f(n-1)+f(n-2) directly) • Run it for n=20, 30, and 36 • Take note and report on the timer printouts

More Related