posted by Roger Finger on Tue 4th Mar 2003 18:51 UTC
"Section 2"


Section 2: Multitasking Software in a Hyperthreaded Environment


Figure 6: Video Encoding while Multitasking


Hyper Threading technology is enabled by the multi-processing support in the Windows® XP and Windows® 2000 operating systems.  Figure 6 shows that HT technology improved the execution times of some common digital media activities - even while the system was under heavy load during a video encoding session. 


Hyper Threading does not guarantee that your application will run faster.  To benefit from hyperthreading, programs need to have executable sections that can run in parallel. Threading improves the granularity of an application so that operations can be broken up into smaller units whose execution is scheduled and controlled by the operating system. Now two threads can run independently of each other without requiring task switches to get at the resources of the processor.


Figure 7 shows a comparison of code executing on a CPU with HT On versus HT Off.  When HT is off, a process can stall while waiting for I/O to complete or another task to provide information it needs.  The CPU is blocked from further execution.  When HT is on, other threads continue running so the system does not hang or stall.


Figure 7 - Separate data paths enable the CPU to continue working
on other threads, even when one becomes blocked

How the Windows® Operating System handles Multi-threading and Multitasking


Multitasking occurs at the user interface level every time a user is runs multiple programs at once.  Some applications also perform multitasking internally by creating multiple processes.  Each process is given a time-slice during which time it executes. Creation of a process involves the creation of an address space, the applications image in memory, which includes a code section, a data section and a stack. Parallel programming using processes requires the creation of two or more processes and an inter-process communication mechanism to coordinate the parallel work.


Threads are tasks that run independently of one another within the context of a process. A thread

shares code and data with the parent process but has its own unique stack and architectural state

that includes an instruction pointer. Threads require fewer system resources than processes. Intra-process communication is significantly cheaper in CPU cycles than inter-process communication.


The life cycle of a thread begins when the application assigns a thread pool and creates a thread from the pool.  When invoked, the thread gets scheduled by the Windows® XP operating system according to a round-robin mechanism.  The next available thread with the highest priority gets to run.


When the thread is scheduled the Operating System checks to see which logical processors are available, then allocates the necessary resources to execute the thread. Each time a thread is dispatched, resources are replicated, divided, or shared to execute the additional threads. When a thread finishes, the operating system idles the unused processor, freeing the resources associated with that thread.

Table of contents
  1. "Overview and Section 1"
  2. "Section 2"
  3. "Section 3"
  4. "Summary and Conclusion"
e p (0)    32 Comment(s)

Related Articles

posted by Thom Holwerda on Wed 26th Nov 2008 09:28 submitted by caffeine deprived
posted by Thom Holwerda on Thu 13th Nov 2008 13:32
posted by Thom Holwerda on Mon 3rd Nov 2008 11:14 submitted by Dan Warne