Native vs Green threads

Native vs Green threads 

Understanding a multi-threaded program have always been a wild goose chase for many programmers. There are always many aspects to consider when writing a multi-threaded program.

Green threads vs Native Threads

The difference between green threads vs native threads is something that programmers may be unaware of. Both are mechanisms are ways of achieving a ‘multi-threaded program’. It is the compiler / interpreter variants that usually implements green or native threads.

Native threads uses the operating systems threading capability to execute multi-threaded programs on the other hand, the green threads emulates the multi-threading without using the underlying capabilities of the OS. Green threads are also known as ‘Cooperative Threading’ where each processes co-operate with each other to emulate a multi-threaded environment.

Execution in a multi-core machines

Another advantage of native threads is that multiple processes would execute in parallel in a multi-core machine. On the other hand, green threads are executed on a single core the entire time and it is the VM that gives a multi-threading notion. So actually there is only singe executing in case of green threads.

Process Scheduling

Native threads uses OS scheduling algorithm. Modern day OSes support pre-emptive scheduling. Green threads can use any kind of scheduling algorithm. Synchronization and Resource sharing

Native threads usually have complicated synchronization and resource sharing. Multiple processes would require kernel level locks for synchronization. Synchronizations are pretty easier in case of green threads.

Reference: Native vs Green threads from our JCG partner George Janeve at the Janeve.Me blog.

Related Whitepaper:

Software Architecture

This guide will introduce you to the world of Software Architecture!

This 162 page guide will cover topics within the field of software architecture including: software architecture as a solution balancing the concerns of different stakeholders, quality assurance, methods to describe and evaluate architectures, the influence of architecture on reuse, and the life cycle of a system and its architecture. This guide concludes with a comparison between the professions of software architect and software engineer.

Get it Now!  

One Response to "Native vs Green threads"

  1. Just few minor grammar or style mistakes:
    * “Both are mechanisms are ways of”
    * “singe”
    * “Native threads uses”
    * “Another advantage” – there is no previous advantage

Leave a Reply


four − = 0



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.

Sign up for our Newsletter

20,709 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books