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
2
votes
2 answers

ruby thread block?

I read somewhere that ruby threads/fibre block the IO even with 1.9. Is this true and what does it truly mean? If I do some net/http stuff on multiple threads, is only 1 thread running at a given time for that request? thanks
0xSina
  • 20,973
  • 34
  • 136
  • 253
2
votes
2 answers

Sinatra session not preserved with Rack::FiberPool

The session is not preserved between requests, though I can't see what I'm doing wrong. Code! require 'sinatra' require 'rack/fiber_pool' class SessionTest < Sinatra::Base use Rack::FiberPool enable :sessions set :session_secret, "foobar" …
B_.
  • 2,164
  • 2
  • 17
  • 20
2
votes
1 answer

Deploy Meteor app to Synology armv7: There is an issue with `node-fibers`

I've spent a couple of days trying to run a build app from Meteor on my Synology ds213j (Armv7, 512MB ram). I keep encountering the following error ## There is an issue with `node-fibers`…
Patch
  • 53
  • 1
  • 1
  • 6
2
votes
1 answer

Minimal possible stack size on Windows when using C++ exceptions (using boost context fibers)

I'm using boost context 1.67 to create a fiber (fcontext API) with a minimal as possible stack size on Windows 10. Probably this issue isn't only specific to boost context and applies to any scenario where we use a Windows thread with a minimal…
Naios
  • 1,513
  • 1
  • 12
  • 26
2
votes
1 answer

Multiple Shared Work Pools With Boost::Fiber

I have been looking into boost::fibers as a method for dealing with some of my problems with data processing and IO. The shared_work scheduler in particular looks promising because it would let me spin up one data processing task for every data…
James Matta
  • 1,562
  • 16
  • 37
2
votes
1 answer

How to use the work_stealing scheduler in boost.fibers

I am trying to build a generic task system where I can post tasks that get executed on whatever thread is free. With previous attempt I often ran out of threads because they would block at some point. So I am trying boost fibers; when one fiber…
Dix
  • 106
  • 4
2
votes
1 answer

Can fibers migrate between threads?

Can a fiber created in thread A switch to another fiber created in thread B? To make the question more specific, some operating systems have fibers natively implemented (windows fibers), other need to implement it themselves (using setjump longjump…
DontCareBear
  • 825
  • 2
  • 11
  • 25
2
votes
4 answers

Quasar Fiber equivalent of Java's ThreadPoolExecutor?

I've been curious about Quasar and its light weight Fibers as a replacement for Threads. After consulting their API docs, I have not been able to figure out how to go about converting a typical ThreadPoolExecutor into a pool of Fibers. int…
2
votes
1 answer

Quasar Parallel Universe examples

I am new to Quasar and want to know if there are any examples like below. Or even if someone could point me into the right direction on how to do this. So what I need to do is read a json file. For each index create a new Fiber and pass some value…
NoName2
  • 113
  • 1
  • 8
2
votes
1 answer

How to pass a fiber to a thread?

I am wondering how I do I pass a fiber to a thread? The only way that I managed to do it was by casting to and from shared. auto fiber = new Fiber((){ }); auto t = spawn((){ auto fib = cast(Fiber)receiveOnly!(shared(Fiber)); writeln("fib"); …
Maik Klein
  • 15,548
  • 27
  • 101
  • 197
2
votes
2 answers

Unblocking Meteor.logout and login

I have two methods on the server side that look like this: var Future = require("fibers/future"); Meteor.methods({ foo: function () { this.unblock(); var f = new Future(); setTimeout(function () { f.return(42); },…
Nuvi Pannu
  • 142
  • 9
2
votes
1 answer

Meteor/Fibers - How to use Meteor.call callback?

I have this code, where I call a Meteor method from the client and expect a result in the callback. the results object is a well formed object that I can stringify and print from the server's console. When I run this code, with a valid results and…
znat
  • 13,144
  • 17
  • 71
  • 106
2
votes
1 answer

Exclusive lock versus thread fiber

I am currently working an c# application that will work as the server-side of a multiplayer game and I am slightly unsure as to how I should be handling multi-threading issues. Before I continue, it is probably worth mentioning that I am quite new…
Donny Sutherland
  • 346
  • 2
  • 3
  • 14
2
votes
0 answers

Save/restore thread local storage

I'm trying to use w32 fiber API in FreePascal to implement coroutine class. So far I could allocate worker context (CreateFiber) and switch between contexts (SwitchToFiber). However I couldn't get exceptions working reliably. There should be…
Andrey Paramonov
  • 409
  • 4
  • 11
2
votes
1 answer

Does D fiber has stack size limitation?

In C/C++, coroutines are implemented with stack-exchange hack, so stack-size is usually limited, doesn't grow automatically. Does D Fiber has these limitations? Or does it grow automatically?
eonil
  • 83,476
  • 81
  • 317
  • 516