Re: Lets talk about fibers

2017-01-23 Thread Ola Fosheim Grøstad via Digitalmars-d
On Sunday, 8 January 2017 at 09:18:19 UTC, Suliman wrote: Simply picking a worker thread + worker fiber when task is assigned and sticking to it until finished should work good enough. It is also important to note though that "fiber" is not the same as "task". Former is execution context

Re: Lets talk about fibers

2017-01-08 Thread Russel Winder via Digitalmars-d
On Sun, 2017-01-08 at 09:18 +, Suliman via Digitalmars-d wrote: > > Simply picking a worker thread + worker fiber when task is  > > assigned and sticking to it until finished should work good  > > enough. It is also important to note though that "fiber" is not  > > the same as "task". Former

Re: Lets talk about fibers

2017-01-08 Thread Dicebot via Digitalmars-d
On Sunday, 8 January 2017 at 09:18:19 UTC, Suliman wrote: Simply picking a worker thread + worker fiber when task is assigned and sticking to it until finished should work good enough. It is also important to note though that "fiber" is not the same as "task". Former is execution context

Re: Lets talk about fibers

2017-01-08 Thread Chris Wright via Digitalmars-d
On Sun, 08 Jan 2017 09:18:19 +, Suliman wrote: >> Simply picking a worker thread + worker fiber when task is assigned and >> sticking to it until finished should work good enough. It is also >> important to note though that "fiber" is not the same as "task". Former >> is execution context

Re: Lets talk about fibers

2017-01-08 Thread Suliman via Digitalmars-d
"The type of concurrency used when logical threads are created is determined by the Scheduler selected at initialization time. The default behavior is currently to create a new kernel thread per call to spawn, but other schedulers are available that multiplex fibers across the main thread or

Re: Lets talk about fibers

2017-01-08 Thread Suliman via Digitalmars-d
Simply picking a worker thread + worker fiber when task is assigned and sticking to it until finished should work good enough. It is also important to note though that "fiber" is not the same as "task". Former is execution context primitive, latter is scheduling abstraction. In fact, heavy

Re: Lets talk about fibers

2016-04-16 Thread Dicebot via Digitalmars-d
On 04/16/2016 03:45 PM, maik klein wrote: > Here is an interesting talk from Naughty Dog > > http://www.gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine > > They move Fibers between threads. > > A rough overview: > > You create task A that depends on task B. The task is submitted

Re: Lets talk about fibers

2016-04-16 Thread maik klein via Digitalmars-d
Here is an interesting talk from Naughty Dog http://www.gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine They move Fibers between threads. A rough overview: You create task A that depends on task B. The task is submitted as a fiber and executed by a thread. Now task A has to

Re: Lets talk about fibers

2015-06-08 Thread Paulo Pinto via Digitalmars-d
On Friday, 5 June 2015 at 18:25:26 UTC, Chris wrote: On Friday, 5 June 2015 at 17:28:39 UTC, Ola Fosheim Grøstad wrote: On Friday, 5 June 2015 at 14:51:05 UTC, Chris wrote: I agree, but I dare doubt that a slight performance edge will make the difference. There are load of factors (knowledge

Re: Lets talk about fibers

2015-06-07 Thread via Digitalmars-d
On Saturday, 6 June 2015 at 18:49:30 UTC, Shachar Shemesh wrote: Since we are talking about several tens of thousands of threads, each random fluctuation in the load resulted in the Using an unlikely workload that the kernel has not been designed and optimized for is in general a bad idea.

Re: Lets talk about fibers

2015-06-06 Thread Shachar Shemesh via Digitalmars-d
On 05/06/15 16:44, Dmitry Olshansky wrote: * You seem to assume the same. Fine assumption given that OS usually tries to keep the same cores working on the same threads, for the similar reasons I believe. I see that people already raised the point that the OS does allow you to pin a thread

Re: Lets talk about fibers

2015-06-06 Thread via Digitalmars-d
On Friday, 5 June 2015 at 19:21:32 UTC, Steven Schveighoffer wrote: I didn't, actually. Your arguments seem well crafted and persuasive, but I've seen so many arguments based on theory that don't always pan out. I like to see hard data. That's what Liran's experience provides. Perhaps you have

Re: Lets talk about fibers

2015-06-05 Thread Dicebot via Digitalmars-d
For the record : I am fully with Liran on this case.

Re: Lets talk about fibers

2015-06-05 Thread Paolo Invernizzi via Digitalmars-d
On Friday, 5 June 2015 at 06:03:13 UTC, Dicebot wrote: For the record : I am fully with Liran on this case. +1 also for me. At work we are using fibers when appropriate, and I see no advantages in moving them. /P

Re: Lets talk about fibers

2015-06-05 Thread Dmitry Olshansky via Digitalmars-d
On 05-Jun-2015 14:29, Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= ola.fosheim.grostad+dl...@gmail.com wrote: On Thursday, 4 June 2015 at 22:28:52 UTC, Jonathan M Davis wrote: anyone give a reason why we need to. deadalnix talked about load balancing that way, but you gave good reasons as to why that

Re: Lets talk about fibers

2015-06-05 Thread Steven Schveighoffer via Digitalmars-d
On 6/5/15 7:29 AM, Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= ola.fosheim.grostad+dl...@gmail.com wrote: On Thursday, 4 June 2015 at 22:28:52 UTC, Jonathan M Davis wrote: anyone give a reason why we need to. deadalnix talked about load balancing that way, but you gave good reasons as to why that

Re: Lets talk about fibers

2015-06-05 Thread via Digitalmars-d
On Friday, 5 June 2015 at 13:44:16 UTC, Dmitry Olshansky wrote: If there is affinity and we assume that OS schedules threads on the same cores* then each core has it's cache loaded with (some of) stacks of its fibers. If we assume sharing fibers across all cores, then each core will have to

Re: Lets talk about fibers

2015-06-05 Thread via Digitalmars-d
On Friday, 5 June 2015 at 13:20:27 UTC, Steven Schveighoffer wrote: I think I'll go with Liran's experience over your hypothetical anecdotes. You seem to have a lot of academic knowledge, but I'd rather see what actually happens. If you have that data, please share. There is absolutely no

Re: Lets talk about fibers

2015-06-05 Thread via Digitalmars-d
On Friday, 5 June 2015 at 14:51:05 UTC, Chris wrote: I agree, but I dare doubt that a slight performance edge will make the difference. There are load of factors (knowledge base, infrastructure, complacency, C++-Guruism, marketing etc.) why D is an underdog. But everybody loves the underdog

Re: Lets talk about fibers

2015-06-05 Thread via Digitalmars-d
On Friday, 5 June 2015 at 15:18:59 UTC, Dan Olson wrote: On TLS and migrating Fibers - these were posted elsewhere, and want to make sure that when you read TLS Fiber problem here, it is understood to be something that could be solved by compiler solution. What I meant is that I don't have a

Re: Lets talk about fibers

2015-06-05 Thread via Digitalmars-d
On Friday, 5 June 2015 at 15:06:04 UTC, Dmitry Olshansky wrote: You choose to ignore the point about duplicating the same memory in each core's cache. To me it seems like throwing Not sure what you mean by this. 3rd level cache is shared. Die-level cache is shared. Primary caches are small

Re: Lets talk about fibers

2015-06-05 Thread Chris via Digitalmars-d
On Friday, 5 June 2015 at 17:28:39 UTC, Ola Fosheim Grøstad wrote: On Friday, 5 June 2015 at 14:51:05 UTC, Chris wrote: I agree, but I dare doubt that a slight performance edge will make the difference. There are load of factors (knowledge base, infrastructure, complacency, C++-Guruism,

Re: Lets talk about fibers

2015-06-05 Thread via Digitalmars-d
On Thursday, 4 June 2015 at 22:28:52 UTC, Jonathan M Davis wrote: anyone give a reason why we need to. deadalnix talked about load balancing that way, but you gave good reasons as to why that didn't make sense, What good reasons? By the time you get response from your shared memcache or

Re: Lets talk about fibers

2015-06-05 Thread Dmitry Olshansky via Digitalmars-d
On 05-Jun-2015 17:04, Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= ola.fosheim.grostad+dl...@gmail.com wrote: On Friday, 5 June 2015 at 13:44:16 UTC, Dmitry Olshansky wrote: If there is affinity and we assume that OS schedules threads on the same cores* then each core has it's cache loaded with (some

Re: Lets talk about fibers

2015-06-05 Thread Dan Olson via Digitalmars-d
Ola Fosheim Grøstad\ ola.fosheim.grostad+dl...@gmail.com writes: No, there were no performance related reasons, only TLS (which is a questionable feature to begin with). On TLS and migrating Fibers - these were posted elsewhere, and want to make sure that when you read TLS Fiber problem here,

Re: Lets talk about fibers

2015-06-05 Thread Steven Schveighoffer via Digitalmars-d
On 6/5/15 10:17 AM, Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= ola.fosheim.grostad+dl...@gmail.com wrote: On Friday, 5 June 2015 at 13:20:27 UTC, Steven Schveighoffer wrote: I think I'll go with Liran's experience over your hypothetical anecdotes. You seem to have a lot of academic knowledge, but I'd

Re: Lets talk about fibers

2015-06-05 Thread Chris via Digitalmars-d
On Friday, 5 June 2015 at 14:17:35 UTC, Ola Fosheim Grøstad wrote: On Friday, 5 June 2015 at 13:20:27 UTC, Steven Schveighoffer wrote: I think I'll go with Liran's experience over your hypothetical anecdotes. You seem to have a lot of academic knowledge, but I'd rather see what actually

Re: Lets talk about fibers

2015-06-04 Thread Jonathan M Davis via Digitalmars-d
On Thursday, 4 June 2015 at 13:16:48 UTC, Steven Schveighoffer wrote: On 6/3/15 9:51 PM, Joakim wrote: Your entire argument seems based on fibers moving between threads breaking your reactor IO model. If there was an option to disable fibers moving or if you had to explicitly ask for a

Re: Lets talk about fibers

2015-06-04 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, 3 June 2015 at 18:34:34 UTC, Liran Zvibel wrote: As we see, there is nothing to gain and lots to lose by moving fibers between threads. Given that it sounds like LLVM _can't_ implement moving fibers (or if it can, it'll really hurt performance), I think that we need a really

Re: Lets talk about fibers

2015-06-04 Thread Dan Olson via Digitalmars-d
Dmitry Olshansky dmitry.o...@gmail.com writes: On 03-Jun-2015 21:34, Liran Zvibel wrote: Hi, [snip] There are two main reasons why it does not make sense to move fibers between threads: For me language being TLS by default is enough to not even try this madness. If we allow moves a

Re: Lets talk about fibers

2015-06-04 Thread via Digitalmars-d
On Thursday, 4 June 2015 at 13:42:41 UTC, Liran Zvibel wrote: If you assume that new jobs always come in (and then you schedule new jobs to the more-empty fibers), there is no need to balance old jobs (That will finish very soon anyway). That assumes that the tasks don't do much work but just

Re: Lets talk about fibers

2015-06-04 Thread Liran Zvibel via Digitalmars-d
On Thursday, 4 June 2015 at 01:51:25 UTC, Joakim wrote: Your entire argument seems based on fibers moving between threads breaking your reactor IO model. If there was an option to disable fibers moving or if you had to explicitly ask for a fiber to move, your argument is moot. I have no dog

Re: Lets talk about fibers

2015-06-04 Thread via Digitalmars-d
On Thursday, 4 June 2015 at 07:24:48 UTC, Liran Zvibel wrote: Since I think you won't come up with a very good case to moving them between threads on that other popular programming model, INCOMING WORKLOAD (__ denotes yield+delay): aaaa bbb c

Re: Lets talk about fibers

2015-06-04 Thread Ivan Timokhin via Digitalmars-d
On Thu, Jun 04, 2015 at 07:24:47AM +, Liran Zvibel wrote: If you can come up with another programming model that leverages fibers (and is popular), and moving fibers between threads makes sense in that model, then I think the discussion should be how stronger that other model is with

Re: Lets talk about fibers

2015-06-04 Thread via Digitalmars-d
I mostly agree with what you wrote, but I'd like to point out that it's probably safe to move some kinds of fibers across threads: If the fiber's main function is pure and its parameters have no mutable indirection (i.e. if the function is strongly pure), there should be no way to get data

Re: Lets talk about fibers

2015-06-04 Thread Dmitry Olshansky via Digitalmars-d
On 03-Jun-2015 21:34, Liran Zvibel wrote: Hi, [snip] There are two main reasons why it does not make sense to move fibers between threads: For me language being TLS by default is enough to not even try this madness. If we allow moves a typical fiber will see different globals depending

Re: Lets talk about fibers

2015-06-04 Thread Steven Schveighoffer via Digitalmars-d
On 6/3/15 9:51 PM, Joakim wrote: Your entire argument seems based on fibers moving between threads breaking your reactor IO model. If there was an option to disable fibers moving or if you had to explicitly ask for a fiber to move, your argument is moot. I have no dog in this fight, just

Re: Lets talk about fibers

2015-06-04 Thread Liran Zvibel via Digitalmars-d
On Thursday, 4 June 2015 at 08:43:31 UTC, Ola Fosheim Grøstad wrote: On Thursday, 4 June 2015 at 07:24:48 UTC, Liran Zvibel wrote: Since I think you won't come up with a very good case to moving them between threads on that other popular programming model, INCOMING WORKLOAD (__ denotes

Lets talk about fibers

2015-06-03 Thread Liran Zvibel via Digitalmars-d
Hi, We discussed (not) moving fibers between threads on DConf last week, and later it was discussed in the announce group, I think this matter is important enough to get a thread of it's own. Software fibers/coroutines were created to make asynchronous programming using a Reactor (or

Re: Lets talk about fibers

2015-06-03 Thread Joakim via Digitalmars-d
On Wednesday, 3 June 2015 at 18:34:34 UTC, Liran Zvibel wrote: There are two main reasons why it does not make sense to move fibers between threads: 1. You'll start having concurrency issues. Lets assume we have a main fiber that received some request, and it spawns 3 fibers looking into