Green threads Will function on systems that don't support OS level threads.
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.
Native threads uses OS scheduling algorithm. Modern day OSes support pre-emptive scheduling.
Green threads can use any kind of scheduling algorithm
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.
For purely sequential code, green threads are slightly faster than native threads.
For multithreaded code that involves frequent synchronization, green threads are likely to be faster than native threads.
Methods such as Object.notify() are much faster for green threads as compared to native threads.
Green threads Cannot support multi-processor machines
Green threads are generally a bit more "lightweight" than native threads
Green threads are scales to large numbers of threads than native threads.
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.
Native threads uses OS scheduling algorithm. Modern day OSes support pre-emptive scheduling.
Green threads can use any kind of scheduling algorithm
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.
For purely sequential code, green threads are slightly faster than native threads.
For multithreaded code that involves frequent synchronization, green threads are likely to be faster than native threads.
Methods such as Object.notify() are much faster for green threads as compared to native threads.
Green threads Cannot support multi-processor machines
Green threads are generally a bit more "lightweight" than native threads
Green threads are scales to large numbers of threads than native threads.
No comments:
Post a Comment