class17 - Exceptional Control Flow Part II Oct 22 2002...

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: Exceptional Control Flow Part II Oct. 22, 2002 Topics Topics Process Hierarchy Shells Signals Nonlocal jumps class17.ppt 15-213 “The course that gives CMU its Zip!” – 2 – 15-213, F’02 ECF Exists at All Levels of a System Exceptions Exceptions Hardware and operating system kernel software Concurrent processes Concurrent processes Hardware timer and kernel software Signals Signals Kernel software Non-local jumps Non-local jumps Application code Previous Lecture This Lecture – 3 – 15-213, F’02 The World of Multitasking System Runs Many Processes Concurrently System Runs Many Processes Concurrently Process: executing program State consists of memory image + register values + program counter Continually switches from one process to another Suspend process when it needs I/O resource or timer event occurs Resume process when I/O available or given scheduling priority Appears to user(s) as if all processes executing simultaneously Even though most systems can only execute one process at a time Except possibly with lower performance than if running alone – 4 – 15-213, F’02 Programmer’s Model of Multitasking Basic Functions Basic Functions fork() spawns new process Called once, returns twice exit() terminates own process Called once, never returns Puts it into “zombie” status wait() and waitpid() wait for and reap terminated children execl() and execve() run a new program in an existing process Called once, (normally) never returns Programming Challenge Programming Challenge Understanding the nonstandard semantics of the functions Avoiding improper use of system resources E.g. “Fork bombs” can disable a system. – 5 – 15-213, F’02 Unix Process Hierarchy Login shell Child Child Child Grandchild Grandchild [0] Daemon e.g. httpd init [1] – 6 – 15-213, F’02 Unix Startup: Step 1 init [1] [0] Process 0: handcrafted kernel process Child process 1 execs /sbin/init 1. Pushing reset button loads the PC with the address of a small bootstrap program. 2. Bootstrap program loads the boot block (disk block 0). 3. Boot block program loads kernel binary (e.g., /boot/vmlinux ) 4. Boot block program passes control to kernel. 5. Kernel handcrafts the data structures for process 0. Process 0 forks child process 1 – 7 – 15-213, F’02 Unix Startup: Step 2 init [1] [0] getty Daemons e.g. ftpd, httpd /etc/inittab init forks and execs daemons per /etc/inittab , and forks and execs a getty program for the console – 8 – 15-213, F’02 Unix Startup: Step 3 init [1] [0] The getty process execs a login program login – 9 – 15-213, F’02 Unix Startup: Step 4 init [1] [0] login reads login and passwd....
View Full Document

{[ snackBarMessage ]}

Page1 / 37

class17 - Exceptional Control Flow Part II Oct 22 2002...

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

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