Questions tagged [green-threads]

Green threads are threads that are scheduled by a virtual machine (VM) instead of natively by the underlying operating system. They emulate multithreaded environments in user space without relying on any native OS capabilities.

In computer programming, green threads are threads that are scheduled by a virtual machine (VM) instead of natively by the underlying operating system. Green threads emulate multithreaded 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.

See also the Wikipedia article.

Related tags

59 questions
57
votes
2 answers

Green-threads and thread in Python

As Wikipedia states: 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…
Rahul Gautam
  • 4,749
  • 2
  • 21
  • 30
31
votes
1 answer

Why did Rust remove the green-threading model; what's the disadvantage?

Runtime freedom: Rust’s runtime system and green-threading model has been entirely removed, which cut the static binary size of “hello world” in half and has opened the door to lower-level hooks into the standard library. Implemented by Aaron…
acmerfight
  • 745
  • 1
  • 7
  • 10
27
votes
3 answers

Green threads in .NET

Green threads were introduced in Erlang and probably all languages based on it know them, also in go (gorutines). Then afaik they were removed from rust. My questions: How would one implement green threads in .NET? Are there some caveats that…
stej
  • 28,745
  • 11
  • 71
  • 104
25
votes
3 answers

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

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…
Cetin Sert
  • 4,497
  • 5
  • 38
  • 76
14
votes
4 answers

How long does it take to create 1 million threads in Haskell?

What I understand, Haskell have green threads. But how light weight are they. Is it possible to create 1 million threads? Or How long would it take for 100 000 threads?
Flinkman
  • 17,732
  • 8
  • 32
  • 53
12
votes
2 answers

Stack allocation for C++ green threads

I'm doing some research in C++ green threads, mostly boost::coroutine2 and similar POSIX functions like makecontext()/swapcontext(), and planning to implement a C++ green thread library on top of boost::coroutine2. Both require the user code to…
user416983
  • 974
  • 3
  • 18
  • 28
12
votes
9 answers

Which scripting languages support multi-core programming?

I have written a little python application and here you can see how Task Manager looks during a typical run. (source: weinzierl.name) While the application is perfectly multithreaded, unsurprisingly it uses only one CPU core. Regardless of the…
Ludwig Weinzierl
  • 15,980
  • 10
  • 45
  • 49
11
votes
3 answers

What's the difference between "green threads" and Erlang's processes?

After reading about Erlang's lighweight processes I was pretty much sure that they were "green threads". Until I read that there are differences between green threads and Erlang's processes. But I don't get it. What are the actual differences?
Daniel Rikowski
  • 71,375
  • 57
  • 251
  • 329
10
votes
1 answer

Tkinter locks Python when an icon is loaded and tk.mainloop is in a thread

Here's the test case... import Tkinter as tk import thread from time import sleep if __name__ == '__main__': t = tk.Tk() thread.start_new_thread(t.mainloop, ()) # t.iconbitmap('icon.ico') b = tk.Button(text='test', command=exit) …
burito
  • 813
  • 1
  • 7
  • 22
9
votes
6 answers

can c/c++ do preemeptive multitasking in a single thread?

Preemptive multitasking in C/C++: can a running thread be interrupted by some timer and switch between tasks? Many VMs and other language runtimes using green-threading and such are implemented in these terms; can C/C++ apps do the same? If so,…
Will
  • 73,905
  • 40
  • 169
  • 246
8
votes
2 answers

How to use eventlet library for async gunicorn workers

One of my django projects is deployed using ansible (gunicorn & nginx). Below is gunicorn configuration : bind = '127.0.0.1:8001' backlog = 2048 workers = 8 worker_class = 'sync' worker_connections = 1000 timeout = 300 keepalive = 2 spew =…
the_unknown_spirit
  • 2,518
  • 7
  • 34
  • 56
8
votes
2 answers

Does LLVM provide any facilities for implementing "green threads"/lightweight processes?

I am looking into designing a concurrent language with support for lightweight processes ("green threads") in the vein of Erlang using LLVM as a native code generator. Lightweight processes are allocated to native OS threads in an M:N fashion, and…
7
votes
3 answers

Confusion regarding the Blocking of "peer threads" when a user-level thread blocks

I was reading about differences between threads and processes, and literally everywhere online, one difference is commonly written without much explanation: If a process gets blocked, remaining processes can continue execution. If a user level…
6
votes
3 answers

Why are user-level threads in Java called "green"?

Possible Duplicate: Green Threads vs Non Green Threads Why are Java threads implemented at the user level in the JVM called "green threads"? Is it by analogy to environmentalism, meaning to suggest that they are less wasteful than OS threads, or…
Ellen Spertus
  • 6,576
  • 9
  • 50
  • 101
6
votes
2 answers

why green threads do not work on multiple cores

On wikipedia: Green_threads is described as normally cannot run on multi-cores without explaining why. On a multi-core processor, native thread implementations can automatically assign work to multiple processors, whereas green thread …
Shengjie
  • 12,336
  • 29
  • 98
  • 139
1
2 3 4