{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lec16 - CS240 Programming in C Lecture 16 Signals Tuesday...

Info icon This preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
CS240: Programming in C Lecture 16: Signals Tuesday, April 12, 2011
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Synchronous vs. Asynchronous Synchronous action: A procedure call: the caller calls the callee and waits until the callee returns with a result A phone call: both parties must be available for the call to go through. An asynchronous action: A response from the environment: user types Ctrl-C while the program runs Email or text messages can be sent without the other party ready to receive 2 Tuesday, April 12, 2011
Image of page 2
Dealing with an Asynchronous Action 3 1. Poll: ask the kernel or the OS: did event E take place since the last time I checked? 2. Handle: inform the kernel that when event E takes place, do the following ... Tuesday, April 12, 2011
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Kinds of Signals 4 Interrupts . Environment-triggered (SIGINT, Ctrl-C) Hardware . (SIGSEGV); divide by 0, invalid memory reference Software . (SIGPIPE, SIGALRM). Timeout on network connection, a broken pipe, ... Tuesday, April 12, 2011
Image of page 4
Handling a Signal Ignore it. Doesn’t always work though (e.g., not a good idea to ignore a hardware exception...) Catch the signal setup a signal handler that gets invoked whenever the signal occurs.
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern