Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 643919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:20:06+00:00 2026-05-13T21:20:06+00:00

In a system with multiple concurrent tasks operating on data, I want to order

  • 0

In a system with multiple concurrent tasks operating on data, I want to order the tasks such that there is a minimum amount of waiting time involved.
Each task in the system uses a certain set of resources, tasks are issued in a certain order (this order is what I want to calculate), a task will not start until it can get a lock on all required resources. Tasks are issued sequentially, so the 3rd task will not start until the second one has acquired all locks, and so on.

Task 1, Resources [A, B]
Task 2, Resources [B, C]
Task 3, Resources [C, D]
Task 4, Resources [E]

Best Solution
Task 1, [A, B]
Task 3, [C, D] //No waiting is possibly required
Task 4, [E] //Put this before task 3, to maximise the distance between uses of the same resource (minimise chances of lock contention)
Task 2, [B, C] //Some waiting *might* be required here

What algorithm could be used to calculate the optimal ordering such that there is the maximum gap between a resource being used, and then used again?

Nb. This is language agnostic, but bonus points for implementations in C#

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:20:07+00:00Added an answer on May 13, 2026 at 9:20 pm

    I think that if I had a box that solved arbitrary instances of your problem I could feed it disguised graph colouring problems (http://en.wikipedia.org/wiki/Graph_coloring) and have it solve them. I would translate each link into a resource shared by the nodes on either side of the link. All the nodes that are scheduled at the same time can then be coloured the same. So if your problem is easy then Graph Colouring is easy, but Graph Colouring is NP-complete so you’re stuffed – well, almost.

    OTOH problems like register allocation are reduced to Graph Colouring and approximately solved in practice, so one of the schemes used for Graph Colouring may work for you too. See e.g. http://en.wikipedia.org/wiki/Register_allocation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 334k
  • Answers 334k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer default_scope is available in Rails 3.0, see the following Lighthouse… May 14, 2026 at 3:25 am
  • Editorial Team
    Editorial Team added an answer I've had exactly the same issue with using UIView animations… May 14, 2026 at 3:25 am
  • Editorial Team
    Editorial Team added an answer When it doesn't work the way I expect or I… May 14, 2026 at 3:25 am

Related Questions

I need to setup a simple IVR system for a friend's company that will
In socket programming, you create a listening socket and then for each client that
I have two classes (A and B) which depend on each other in following
we are designing the search architecture for a corporate web application. We'll be using
I'm working on a database design for groups hierarchy used as the foundation of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.