Questions tagged [fiber]

Fibers are particularly lightweight threads of execution which use co-operative multitasking.

In computer science, a fiber is a particularly lightweight thread of execution..

Like threads, fibers share address space. However, fibers use co-operative multitasking while threads use pre-emptive multitasking. Threads often depend on the kernel's thread scheduler to preempt a busy thread and resume another thread; fibers yield themselves to run another fiber while executing. The article on threads contains more on the distinction between threads and fibers.

Fibers can be considered as implementation of coroutines so you might like to check also [coroutine] tag.

98 questions
65
votes
4 answers

Processes, threads, green threads, protothreads, fibers, coroutines: what's the difference?

I'm reading up on concurrency. I've got a bit over my head with terms that have confusingly similar definitions. Namely: Processes Threads "Green threads" Protothreads Fibers Coroutines "Goroutines" in the Go language My impression is that the…
jameshfisher
  • 34,029
  • 31
  • 121
  • 167
53
votes
6 answers

Coroutines in C#

I am looking at ways to implement co-routines (user scheduled threads) in c#. When using c++ I was using fibers. I see on the internet fibers do not exist in C#. I would like to get similar functionality. Is there any "right" way to implement…
eyal
  • 551
  • 1
  • 4
  • 3
24
votes
1 answer

Coroutine vs Fiber difference clarification

In the book Linux System Programming, 2nd Edition, the difference between coroutines and fiber is explained as follows: Coroutines and fibers provide a unit of execution even lighter in weight than the thread (with the former being their name when…
kasyauqi
  • 635
  • 1
  • 6
  • 17
16
votes
1 answer

With Boost.Fiber does c++ come one step closer to Erlang style process/threads?

I am reading http://olk.github.io/libs/fiber/doc/html/ It seems to me that with Boost.Fiber C++ is coming closer to Erlang's ability to have thousands of "processes", also known as "green processes[threads]"…
Ivan
  • 7,448
  • 14
  • 69
  • 134
14
votes
3 answers

Is there a fiber api in .net?

Out of more curiosity than anything I've been looking for a set of C#/.net classes to support fibers/co-routines (the win32 version) and haven't had any luck. Does anybody know of such a beast?
dkackman
  • 15,179
  • 13
  • 69
  • 123
12
votes
1 answer

How do segmented stacks work

How do segmented stacks work? This question also applies to Boost.Coroutine so I am using the C++ tag as well here. The main doubt comes from this article It looks like what they do is keep some space at the bottom of the stack and check if it has…
Curious
  • 20,870
  • 8
  • 61
  • 146
12
votes
8 answers

Making multiple HTTP requests asynchronously

require 'net/http' urls = [ {'link' => 'http://www.google.com/'}, {'link' => 'http://www.yandex.ru/'}, {'link' => 'http://www.baidu.com/'} ] urls.each do |u| u['content'] = Net::HTTP.get( URI.parse(u['link']) ) end print urls This code…
NVI
  • 14,907
  • 16
  • 65
  • 104
11
votes
1 answer

FiberError - Fiber called across threads

I'm trying to write a small feature in a Rails app that uses the random-word gem to generate a random noun, then pluralize it. I've been able to get it working the first time I visit the page in development, but I want the script to run again on…
Alec Wilson
  • 566
  • 1
  • 7
  • 18
11
votes
4 answers

How do Enumerators work in Ruby 1.9.1?

This question is not about how to use Enumerators in Ruby 1.9.1 but rather I am curious how they work. Here is some code: class Bunk def initialize @h = [*1..100] end def each if !block_given? enum_for(:each) else …
horseyguy
  • 29,455
  • 20
  • 103
  • 145
10
votes
2 answers

Fibers use cases

I am reading a lot about Fibers, or green threads, or whatever other name we can give to userland threads. I started reading documentations and tutorials (these are C++ links, but I don't need a specific language): Distinguishing coroutines and…
senseiwa
  • 2,369
  • 3
  • 24
  • 47
10
votes
6 answers

Lightweight, portable C++ fibers, MIT license

I would like to get ahold of a lightweight, portable fiber lib with MIT license (or looser). Boost.Coroutine does not qualify (not lightweight), neither do Portable Coroutine Library nor Kent C++CSP (both GPL). Edit: could you help me find one? :)
Jonas Byström
  • 25,316
  • 23
  • 100
  • 147
9
votes
4 answers

What are Erlang processes behind the scenes?

I've got very limited knowledge about Erlang, but as far as I understand, it can spawn "processes" with a very low cost. So I wonder, what are those "processes" behind the scenes? Are they Fibers? Threads? Continuations?
Roger Johansson
  • 22,764
  • 18
  • 97
  • 193
8
votes
5 answers

Scripting languages that support fibers/coroutines?

I'd like to start a new network server project in a language that supports concurrency through fibers aka coroutines aka user-mode threads. Determining what exactly are my options has been exceedingly difficult as the term "coroutine" seems to be…
Logan Bowers
  • 447
  • 4
  • 13
8
votes
3 answers

Fibers in C#: are they faster than iterators, and have people used them?

So I was chatting with a colleague about fibers and turned up this paper from 2003 that describes a implementation of coroutines in C# using the Fiber API. The implementation of Yield in this paper was for .NET 1.1, so it predates the yield return…
Jeremy McGee
  • 24,842
  • 10
  • 63
  • 95
7
votes
1 answer

Least mean square to equalize optical fiber channel

I used a Matlab code of LMS (least mean square algorithm) to equalize the effect of the channel, it is working for a tapped delay channel generated in MATLAB but for optical fiber channel using optisystem program, it doesn’t work well, i think the…
1
2 3 4 5 6 7