Code Monkey home page Code Monkey logo

Comments (6)

olk avatar olk commented on August 29, 2024

One of the tasks of the dispatcher-fiber is to release terminated worker-fibers (== fibers created by the user-code). The dispatcher-fiber is the first fiber in the ready-queue when the application/thread starts. It always enqueues itself before it hands-over to another worker-fiber (dequeued from the ready-queue).
So the dispatcher-fiber should be executed multiple times in your app.

from fiber.

danichcr72 avatar danichcr72 commented on August 29, 2024

Thanks for the quick reply. I can see that the dispatcher fiber is scheduled to run, however in the shared_work scheduler at least, it does not run unless there are no worker fibers pending:

if ( ! rqueue_.empty() ) { /*<
        pop an item from the ready queue
    >*/
    ctx = rqueue_.front();
    rqueue_.pop_front();
    lk.unlock();
    BOOST_ASSERT( nullptr != ctx);
    context::active()->attach( ctx); /*<
        attach context to current scheduler via the active fiber
        of this thread
    >*/
} else {
    lk.unlock();
    if ( ! lqueue_.empty() ) { /*<
            nothing in the ready queue, return main or dispatcher fiber
        >*/

from fiber.

olk avatar olk commented on August 29, 2024

right - shared_work was previously in the examples , so I missed the implementation details

from fiber.

olk avatar olk commented on August 29, 2024

releated to #112

from fiber.

olk avatar olk commented on August 29, 2024

The problem is that the dispatcher-fiber is not correctly scheduled in the shared_work algo.
If you take a look at work_stealgin algo (branch develop) you see that the dipatcher-fiber is scheduled like in round_robin.
I suggest to switch to work_stealing because it is faster (locality of data) than shared_work.
Otherwise shared_work needs some counters that manage teh scheduling of main-/dispatcher-fiber ...

from fiber.

olk avatar olk commented on August 29, 2024

use work-stealing scheduler instead

from fiber.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.