116 thread safe and reentrant functions 593 3

Info iconThis preview shows page 1. Sign up to view the full content.

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: The origin of the graph corresponds to the initial state where none of the threads has yet completed an instruction. Figure 11.11 shows the 2-dimensional progress graph for the first loop iteration of the badcnt.c program. The horizontal axis corresponds to thread 1, the vertical axis to thread 2. Point ´Ä½ ˾ µ corresponds to the state where thread 1 has completed Ľ and thread 2 has completed ˾ . A progress graph models instruction execution as a transition from one state to another. A transition is represented as a directed edge from one point to an adjacent point. Figure 11.12 shows the legal transitions 11.4. SYNCHRONIZING THREADS WITH SEMAPHORES Thread 2 577 T2 S2 U2 L2 H2 H1 (L1, S2) L1 U1 S1 T1 Thread 1 Figure 11.11: Progress graph for the first loop iteration of badcnt.c. in a 2-dimensional progress graph. For the single-processor systems that we are concerned about, where instructions complete one at a time in sequentially-consistent order, legal transitions move to the right (an instruction in thread 1 completes) or up (an instruction in thread 2 completes). P...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online