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

  • SEARCH
  • Home
  • 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 244233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:59:15+00:00 2026-05-11T20:59:15+00:00

I have a GUI C# application that has a single button Start/Stop. Originally this

  • 0

I have a GUI C# application that has a single button Start/Stop.

Originally this GUI was creating a single instance of a class that queries a database and performs some actions if there are results and gets a single “task” at a time from the database.

I was then asked to try to utilize all the computing power on some of the 8 core systems. Using the number of processors I figure I can create that number of instances of my class and run them all and come pretty close to using a fair ammount of the computing power.

Environment.ProccessorCount;

Using this value, in the GUI form, I have been trying to go through a loop ProccessorCount number of times and start a new thread that calls a “doWork” type method in the class. Then Sleep for 1 second (to ensure the initial query gets through) and then proceed to the next part of the loop.

I kept on having issues with this however because it seemed to wait until the loop was completed to start the queries leading to a collision of some sort (getting the same value from the MySQL database).

In the main form, once it starts the “workers” it then changes the button text to STOP and if the button is hit again, it should execute on each “worker” a “stopWork” method.

Does what I am trying to accomplish make sense? Is there a better way to do this (that doesn’t involve restructuring the worker class)?

  • 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-11T20:59:16+00:00Added an answer on May 11, 2026 at 8:59 pm

    Restructure your design so you have one thread running in the background checking your database for work to do.

    When it finds work to do, spawn a new thread for each work item.

    Don’t forget to use synchronization tools, such as semaphores and mutexes, for the key limited resources. Fine tuning the synchronization is worth your time.

    You could also experiment with the maximum number of worker threads – my guess is that it would be a few over your current number of processors.

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

Sidebar

Ask A Question

Stats

  • Questions 289k
  • Answers 289k
  • 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 Two approaches: When you login: you can to create a… May 13, 2026 at 5:33 pm
  • Editorial Team
    Editorial Team added an answer With Spring 2.5+ annotated controllers, the difference between having one… May 13, 2026 at 5:33 pm
  • Editorial Team
    Editorial Team added an answer C++, for two reasons. 1) a lot of games are… May 13, 2026 at 5:33 pm

Related Questions

What are some good end to end CPU profilers that exist for Java? Quick
I'm currently on a 4-person team tasked with the development and maintenance of a
I have a Server application with a GUI. Written in c#. Now I want
I'm trying to modify a C# WinForms application that uses multiple forms. At startup,

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.