What is the Difference Between Fine Grained and Coarse Grained Multithreading

The main difference between fine grained and coarse grained multithreading is that, in fine grained multithreading, the threads issue instructions in round-robin manner while in coarse grained multithreading, the threads issue instructions until a stall occurs.

Multithreading refers to executing multiple threads within a process independently. These threads can share their process resources. Two types of multithreading are fine grained and coarse grained multithreading.

Key Areas Covered

1. What is Fine Grained Multithreading
      – Definition, Functionality
2. What is Coarse Grained Multithreading
      – Definition, Functionality
3. What is the Difference Between Fine Grained and Coarse Grained Multithreading
      – Comparison of Key Differences

Key Terms

Fine Grained Multithreading, Coarse Grained Multithreading

Difference Between Fine Grained and Coarse Grained Multithreading - Comparison Summary

What is Fine Grained Multithreading

In fine grained multithreading, the threads are executed in a round-robin fashion in consecutive cycles. For example, assume a computer can issue one instruction per clock cycle. A, B, C are three threads. The first 12 cycles of those threads are as follows.

Difference Between Fine Grained and Coarse Grained Multithreading

Figure 1: Example

The way of these threads issuing instructions according to fine grained multithreading is as follows.

Main Difference - Fine Grained vs Coarse Grained Multithreading

Figure 2: Fine Grained Multithreading

Each thread issues their first instruction. Thread A issues its second instruction. There should be 2 clock cycles between B1 and B2. As 2 clock cycles have already passed, it is possible to issue second instruction of Thread B. After that, thread C issues its second instruction. And, this process continues.

What is Coarse Grained Multithreading

In coarse grained multithreading, a thread issues instructions until thread issuing stops. The process is also called stalling. When a stall occurs, the next thread starts issuing instructions. At this point, a cycle is lost due to this thread switching.

Consider the same example used in fine grained multithreading.

What is the Difference Between Fine Grained and Coarse Grained Multithreading

Figure 3: Coarse Grained Multithreading

Thread A issues first and second instructions. As it stops issuing instructions, the control passes to thread B, and there is one clock cycle loss. Thread B executes the first instructions, and it stops. Then the control passes to C, and there is one clock cycle loss. Thread C issues four instructions before it stops issuing instructions. Then the control passes back to A. There is a clock cycle loss and thread A issues third and fourth instructions. And, this process continues. 

Difference Between Fine Grained and Coarse Grained Multithreading

Definition

Fine grained multithreading is a multithreading mechanism in which switching among threads happens despite the cache miss caused by the thread instruction. Coarse grained multithreading, on the other hand, is a multithreading mechanism in which the switch only happens when the thread in execution causes a stall, thus wasting a clock cycle. Thus, this is the main difference between fine grained and coarse grained multithreading.

Efficiency

Efficiency is another difference between fine grained and coarse grained multithreading. Coarse grained multithreading is less efficient than fine grained multithreading because it causes a cycle gap/loss when switching between threads.

Required Threads

Moreover, coarse grained requires fewer threads to keep the CPU busy when compared to fine grained multithreading.

Conclusion

Fine grained and coarse grained multithreading are two multithreading methods. The main difference between fine grained and coarse grained multithreading is that, in fine grained multithreading, the threads issue instructions in round-robin manner while in coarse grained multithreading, the threads issue instructions until a stall occurs.

Reference

1.“What Is Multithreading? – Definition from Techopedia.” Techopedia.com, Available here
2.“Multithreading (Computer Architecture).” Wikipedia, Wikimedia Foundation, 2 Dec. 2018, Available here

About the Author: Lithmee

Lithmee holds a Bachelor of Science degree in Computer Systems Engineering and is reading for her Master’s degree in Computer Science. She is passionate about sharing her knowldge in the areas of programming, data science, and computer systems.

Leave a Reply