Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which green threads libraries are available for C that can match the performance and ease of use of Haskell's green threads? [closed]

Tags:

People also ask

What is green thread with which kind of programming language we can implement this kind of threading?

Green threads refers to the name of the original thread library for the programming language Java (that was released in version 1.1 and then Green threads were abandoned in version 1.3 to native threads). It was designed by The Green Team at Sun Microsystems.

What are green threads in programming?

In computer programming, a green thread or virtual thread is a thread that is scheduled by a runtime library or virtual machine (VM) instead of natively by the underlying operating system (OS).

Does rust have green threads?

Rust, in fact, has a history with green threads. A green threads runtime used to be the default paradigm for Rust code.

What are green threads in python?

Green threads emulate multi-threaded environments without relying on any native OS capabilities, and they are managed in user space instead of kernel space, enabling them to work in environments that do not have native thread support.


I am well used to relying on GHC's forkIO for portable lightweight threads when programming in Haskell.

What are equivalent libraries for C that can provide the same scalibility and ease of use?

Specifically I need C-equivalents of at least the following two functions.

forkIO     :: IO () -> IO ThreadId killThread ::             ThreadId -> IO () 

I assume for my application, it would be enough if threads only switched on blocking operations rather than being forcefully suspended because all threads block highly frequently for network IO and I only use the splice system call to ask the Linux kernel to push data around between sockets.


Update

This paper has figures and tables comparing

  • GNU Pth
  • Protothreads
  • PM2 Parcel

with results favoring Protothreads. As I have not used any and there may also be other libraries, I would love to hear from anyone who has used / developed such libraries.