Lets talk about fibers
Russel Winder via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jan 8 13:28:35 PST 2017
On Sun, 2017-01-08 at 09:18 +0000, 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 is execution context primitive,
> > latter is scheduling abstraction. In fact, heavy load systems
> > are likely to have many more tasks than fibers at certain spike
> > points.
>
> Could you explain difference between fibers and tasks. I read a
> lot, but still can't understand the difference.
A fibre is what a thread used to be before kernels supported threads
directly. Having provided that historical backdrop, that seems sadly
missing from the entire Web, the current status is roughly described
by:
https://en.wikipedia.org/wiki/Fiber_(computer_science)
http://stackoverflow.com/questions/796217/what-is-the-difference-betwee
n-a-thread-and-a-fiber
Tasks are things that can be scheduled using threads or fibres. It's
all down to thread pools and kernel processes. Which probably doesn't
help per se, but:
http://docs.paralleluniverse.co/quasar/
Quasar, GPars, std.parallelism, Java Fork/Join all harness all these
ideas.
In the end as a programmer you should be using actors, agents,
dataflow, data parallelism or some similar high level model. Anything
lower level and, to be honest, you are doing it wrong.
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder at ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: russel at winder.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20170108/7653be87/attachment.sig>
More information about the Digitalmars-d
mailing list