Are Fibers just broken in D?

Steven Schveighoffer schveiguy at yahoo.com
Tue Apr 24 16:22:04 UTC 2018


On 4/24/18 10:31 AM, Byron Heads wrote:
> On Tuesday, 24 April 2018 at 13:36:48 UTC, Steven Schveighoffer wrote:
>> This is not the case of executing 100,000 concurrent fibers, but 
>> executing 100,000 *sequential* fibers. It should work just fine.
>>
> 
> Correct, in a normal run of my system there maybe 10-20 fibers max 
> alive. I was using threads only before, but found the system to execute 
> jobs in a balanced way. But using a few threads to process Fibers keep 
> in a queue balances out the work evenly. It is also easier to track down 
> bugs by just using 1 thread to process the fiber pool.
> 
> I would love to use dip1000, Allocators, and shared. But none of that 
> stuff really works beyond trivial examples. (Allocators probably works 
> fine, but there are forum post about it changing and I dont want to 
> refactor it twice..)

stdx.allocator (https://github.com/dlang-community/stdx-allocator and 
http://code.dlang.org/packages/stdx-allocator) is "stable", you can use 
that instead of the one inside phobos. This way, even if phobos 
introduces breaking changes, you can depend on a specific version of the 
allocators. DIP1000 is very much a work in progress, I'm unsure if/when 
it will become usable. Shared likely isn't going to get any better until 
the main players start focusing on it. Right now, I think they are more 
interested in memory safety.

> I will start ignoring win32 when win64 doesn't require dealing with 
> visual studio installs.
> Also I have a feeling a client will ask for it.

Unfortunately I don't think the VS license will ever allow us to avoid 
installing VS as well.

My recommendation is just to ignore Win32. I wouldn't trust it at all. 
There are serious threading issues there, and the GC is prone to run out 
of memory if you aren't careful.

But I can understand if you can't go that route.

Another thing to try is -m32mscoff, which creates 32-bit binaries, but 
links against Microsoft's runtime instead of DMD. While this is a stated 
problem from you, it may help to determine if it's really the digital 
mars library or something more inherent in the way Fibers or the GC is 
working.

-Steve


More information about the Digitalmars-d-learn mailing list