------------------------------------------------------ Lecture 05 - February 12, 2003 ------------------------------------------------------ AGENDA: 0 Admin 0.5 Mr. Greg Beeley presents Cardia/NFS project 1 P2 questions? 2 Ch 2.1: introduction to processes 3 Ch 2.2: interprocess communication ------------------------------------------------------ 0 - ADMIN ------------------------------------------------------ Startout Q: What is a process? Today: * RI #2 * email to cos421gr@css.tayloru.edu - NOTE: not using the submission system for RIs * Give you the grade/feedback on P1 Friday: * HM #2 * Quiz #2 Return quiz #1 Discuss shell #1 * only serious problem noted was not checking system calls for possible failure. ------------------------------------------------------ 1 - P2 QUESTIONS ------------------------------------------------------ Questions? ------------------------------------------------------ 2 - CH 2.1 - INTRODUCTION TO PROCESSES ------------------------------------------------------ process: an abstraction of a running program * an executing program * also all relevant supporting data - program counter, registers, variables pseudoparallelism: faking multiprocessor behavior process vs. program process hierarchies (incl. init) process states * running, blocked, ready Implementing processes * process table fig 2-4 p, 53 * interrupt vector & interrupt service routine fig 2-5 p. 54 threads * single vs. multiple threads of control and program counter * also called lightweight processes * do they share the same address space? * user-space vs. kernel control * issue of what all is blocked when a thread blocks Considerations in thread management ------------------------------------------------------ 3 - CH 2.2 - INTERPROCESS COMMUNICATION ------------------------------------------------------ aka IPC can use interrupts, but very primitive Interprocess communication 3 issues * how can processes pass information to each other * ensuring that processes do not get in each other's way during critical activities * ensuring proper sequencing when have dependencies RACE CONDITIONS * Spooler directory example fig 2-7 p. 58. * Two processes end up both trying to write a file to same slot. * All sorts of similar problems occur. Only one time in 1000 (or greater) might there be a problem, but that will drive you crazy. CRITICAL SECTIONS * Times when need guarantee that nobody else will get in to the same data structure and mess around at the same time. * Need mutual exclusion. * Aka critical region. Four conditions for good solution 1) no two processes may be simultaneously inside their critical regions 2) no assumptions may be made about speeds or the number of CPUs 3) no process running outside its critical region may block other processes 4) no process should have to wait forever to enter its critical region COS 421 - Lecture Notes #5 SPRING 2003 COS421-lect-2003-02-12.doc Page 1 Printed 12.02.03