This preview shows page 1. Sign up to view the full content.
Unformatted text preview: tack 1 Thread 1 context: Data registers Condition codes SP1 PC1 TID1 Shared code and data shared libraries run-time heap read/write data read-only code/data
Thread 2 stack 2 Thread 2 context: Data registers Condition codes SP2 PC2 TID2 Kernel context: VM structures Open files Signal handlers brk pointer PID Figure 11.3: Associating multiple threads with a process. context switch, because the main thread executes a slow system call such as read or sleep, or because it is interrupted by the system’s interval timer. The peer thread executes for awhile before control passes back to the main thread, and so on.
Thread 1 (main thread) Thread 2 (peer thread)
Thread context switch Time
Thread context switch Thread context switch Figure 11.4: Concurrent thread execution. Thread execution differs from processes in some important ways. Because a thread context is much smaller than a process context, a thread context switch is faster than a process context switch. Another difference is that threads, unlike processes, are not org...
View Full Document
- Spring '10
- The American