fiber

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

[亡魂溺海] 提交于 2019-12-03 03:15:27
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]" http://en.wikipedia.org/wiki/Green_threads . My question is, is Boost.Fiber ready for production, are there now c++ alternatives that have better documentation and examples? Someone mentioned lightweight threads, but I can't seem to find a reference to it. One final question is, why doesn't the C++ standard include Fibers? The reason I am interested in this is because I have realtime

Coroutines in C#

独自空忆成欢 提交于 2019-12-03 02:22:10
问题 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 coroutines in c#? I have thought of implementing this using threads that acquire a single execution mutex + 1 on scheduler thread which releases this mutex for each coroutine. But this seems very costly (it forces a context switch between each coroutine)

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

别等时光非礼了梦想. 提交于 2019-12-03 01:34:23
问题 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 distinctions rest on (1) whether truly parallel or multiplexed; (2) whether managed at the CPU, at the OS, or in the program; and (3..5) a few other things I can't identify. Is there a succinct and unambiguous guide to the differences between these

Lightweight, portable C++ fibers, MIT license

戏子无情 提交于 2019-12-02 22:19:55
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? :) Libtask : MIT License Libconcurrency : LGPL (a little tighter than MIT, but it's a functional library!) Both are written for C. I actually blogged about this in the past. Have a look! I hope it answers your questions. In it, I cover a number of libraries, and I was particularly interested in ones that were useful for systems programming (asynchronous

Coroutines in C#

牧云@^-^@ 提交于 2019-12-02 17:16:26
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 coroutines in c#? I have thought of implementing this using threads that acquire a single execution mutex + 1 on scheduler thread which releases this mutex for each coroutine. But this seems very costly (it forces a context switch between each coroutine) I have also seen the yield iterator functionality, but as I understand you can't yield within an

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

妖精的绣舞 提交于 2019-12-02 13:53:19
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 distinctions rest on (1) whether truly parallel or multiplexed; (2) whether managed at the CPU, at the OS, or in the program; and (3..5) a few other things I can't identify. Is there a succinct and unambiguous guide to the differences between these approaches to parallelism? OK, I'm going to do my best. There are caveats everywhere, but I'm going to do

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

允我心安 提交于 2019-11-30 02:27:39
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 syntax that appeared in .NET 2.0. It definitely looks, at first glance, that the implementation here is potentially faster and could scale across multiple CPUs rather well. Has anyone used it? I haven't used it, but I have an interest in the subject. Here's one nice implementation of coroutines in C# with a round-robin scheduler: http://www

Making multiple HTTP requests asynchronously

谁说我不能喝 提交于 2019-11-28 18:56:38
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 works in synchronous style. First request, second, third. I would like to send all requests asynchronously and print urls after all of them is done. What the best way to do it? Is Fiber suited for that? Here's an example using threads. require 'net/http' urls = [ {'link' => 'http://www.google.com/'}, {'link' => 'http://www.yandex.ru/'}, {'link' => 'http://www

What is the difference between a thread and a fiber?

别说谁变了你拦得住时间么 提交于 2019-11-28 02:41:08
What is the difference between a thread and a fiber? I've heard of fibers from ruby and I've read heard they're available in other languages, could somebody explain to me in simple terms what is the difference between a thread and a fiber. In the most simple terms, threads are generally considered to be preemptive (although this may not always be true, depending on the operating system) while fibers are considered to be light-weight, cooperative threads. Both are separate execution paths for your application. With threads: the current execution path may be interrupted or preempted at any time

Is there a fiber api in .net?

北战南征 提交于 2019-11-27 14:43:29
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? LBushkin Have you seen this: Title "Implementing Coroutines for .NET by Wrapping the Unmanaged Fiber API" in the September 2003 issue of MSDN Magazine http://msdn.microsoft.com/en-us/magazine/cc164086.aspx No. There isn't a Fiber API in the Framework. I suspect this is because there is little advantage to using them - even the fiber API page (native) mentions: In general, fibers do not provide