Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve priority_queue to prevent starvation #93

Open
qinzuoyan opened this issue Jun 20, 2018 · 0 comments
Open

improve priority_queue to prevent starvation #93

qinzuoyan opened this issue Jun 20, 2018 · 0 comments
Assignees
Labels
type/enhancement Indicates new feature requests

Comments

@qinzuoyan
Copy link
Contributor

now the priority queue's dequeue() is:

    T dequeue_impl(/*out*/ long &ct, bool pop = true)
    {
        if (_count == 0) {
            ct = 0;
            return nullptr;
        }

        ct = --_count;

        int index = priority_count - 1;
        for (; index >= 0; index--) {
            if (_items[index].size() > 0) {
                break;
            }
        }

        assert(index >= 0); // "must find something");
        auto c = _items[index].front();
        _items[index].pop();
        return c;
    }

if the HIGH priority queue is always not empty, the task in COMMON/LOW queue may be starved.

we can refer to the implementation of nfs_client_impl.

@qinzuoyan qinzuoyan added the type/enhancement Indicates new feature requests label Jun 20, 2018
@qinzuoyan qinzuoyan self-assigned this Jun 20, 2018
cauchy1988 pushed a commit to cauchy1988/incubator-pegasus that referenced this issue May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Indicates new feature requests
Projects
None yet
Development

No branches or pull requests

1 participant