Lecture7 - CSCE 313: Introduction to Computer Systems...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCE 313: Introduction to Computer Systems Spring 2011 Dr. Ronnie Ward
Background image of page 1

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

View Full DocumentRight Arrow Icon
Asynchronous Events: Signals Chapters 8 and 13.5 in textbook Slides adopted and modified from Dr. Bettati.
Background image of page 2
Asynchronous Events: Signals Signals Concepts Generating Signals Catching Signals Waiting for Signals Loose end: Program start-up Loose end: Signal Handling and Threads 3 2/14/12
Background image of page 3

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

View Full DocumentRight Arrow Icon
Signals: Concepts Asynchronous Events: Occur at random time. Email message arrives on my machine – mailing agent (user) process should retrieve Invalid memory access happens – OS should inform scheduler to remove process from the processor Alarm clock goes off – process which sets the alarm should catch it Polling for asynchronous events? Ask kernel: “Did Event X happen since I last checked?” 4 2/14/12
Background image of page 4
Conditions that Generate Signals Command Line-generated signals: when user presses certain key. (e.g. SIGINT and ^C) Hardware-exception generated signals: Hardware detects condition and notifies kernel. (e.g. SIGFPE divide by 0, SIGSEGV invalid memory reference) kill(2) function : Sends any signal to another process. kill(1) command : The command-line interface to kill(2). 5 2/14/12
Background image of page 5

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

View Full DocumentRight Arrow Icon
“Disposition” of the Signal Tell the kernel what to do with a signal: Ignore the signal . Works for most signals. Does not work for SIGKILL and SIGSTOP . Unwise to ignore hardware exception signals. Catch the signal . Tell the kernel to invoke a given function whenever signal occurs. Example: Write signal handler for SIGTERM to clean up after 6 2/14/12
Background image of page 6
Examples of Signals (Mac OS X) 7 2/14/12 No Name Default Action Description 1 SIGHUP terminate process terminal line hangup 2 SIGINT terminate process interrupt program 3 SIGQUIT create core image quit program 4 SIGILL create core image illegal instruction 5 SIGTRAP create core image trace trap 6 SIGABRT create core image abort program (formerly SIGIOT) 7 SIGEMT create core image emulate instruction executed 8 SIGFPE create core image floating-point exception 9 SIGKILL terminate process kill program 10 SIGBUS create core image bus error 11 SIGSEGV create core image segmentation violation 12 SIGSYS create core image non-existent system call invoked 13 SIGPIPE terminate process write on a pipe with no reader 14 SIGALRM terminate process real-time timer expired 15 SIGTERM terminate process software termination signal 16 SIGURG discard signal urgent condition present on socket No Name Default Action Description 17 SIGSTOP stop process stop (cannot be caught or ignored) 18 SIGTSTP stop process stop signal generated from keyboard 19 SIGCONT discard signal continue after stop 20 SIGCHLD discard signal child status has changed 21 SIGTTIN stop process background read attempted from control terminal 22 SIGTTOU stop process background write attempted to control terminal 23 SIGIO discard signal I/O is possible on a descriptor (see fcntl(2)) 24 SIGXCPU terminate process cpu time limit exceeded (see setrlimit(2))
Background image of page 7

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

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/14/2012 for the course CSCE 313 taught by Professor Gu during the Spring '11 term at Texas A&M.

Page1 / 37

Lecture7 - CSCE 313: Introduction to Computer Systems...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online