114 synchronizing threads with semaphores thread 2

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: g errors. Bugs in threaded programs are especially scary because they are usually not easily repeatable. In this chapter, we will show you the basics of threaded programs, discuss some of the tricky ways that they can fail if you are not careful, and give you tips for avoiding these errors. 11.1 Basic Thread Concepts To this point, we have worked with the traditional view of a process shown in Figure 11.1. In this view, a process consists of the code and data in the user’s virtual memory, along with some state maintained by the kernel known as the process context. The code and data includes the program’s text, data, runtime heap, shared libraries, and the stack. The process context can be partitioned into two different kinds of state: program context and kernel context. The program context resides in the processor, and includes the contents of the general-purpose registers, various condition codes registers, the stack pointer, and the program counter. The kernel context resides in kernel data structures, and consists of items such as the 563 564 CHAPTER 11. CONCURRENT PROGRAMMING WITH THREADS process ID, the data structures that characterize the organization of the virt...
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