Thread 2 1 1 0 0 0 0 1 1 t2 1 1 0 0 0 0 1 1 vs 0 0

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: 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 0 565 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

Ask a homework question - tutors are online