On Saturday, 28 March 2015 at 14:33:14 UTC, Russel Winder wrote:
On Sat, 2015-03-28 at 12:52 +0100, Sönke Ludwig via Digitalmars-d-announce wrote:

You can access TLS from an event callback just as easy as from a fiber.

TLS is the evil here. Anyone working with TLS is either writing an
operating system or doing it wrong.

I don't think it is that simple. From the purist academical parallelism POV - most likely. In practice it often can be quite the contrary, TLS is your best friend (depending on how efficient platfrom implementation is).

To get best high-load performance best strategy is to actually design applications with specific hardware traits in mind, including pre-defined amount of CPU cores and their task affinity. Computation parallelism is relatively easy, it is memory parallelism that remains a challenging task as long as you try to get rid of locking overhead, costly synchronizations and optimize cache loads. Something like moving fibers between threads is absolute disaster in this sense even if it looks like a tempting abstraction on paper. But if you prohibit that by design and maintain strict affinity between fibers and threads, using TLS allows for very nice optimizations (as it is effectively limited sharing without locking / atomics). It can be complicated to design (which is why Go choice makes sense for their target audience) but benefits are also very good.

Reply via email to