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 9154921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:30:28+00:00 2026-06-17T12:30:28+00:00

In my program (basic task manager) I monitor a list of processes, and allow

  • 0

In my program (basic task manager) I monitor a list of processes, and allow to make changes to process (e.g. kill a process or raise its priority).

To implement it I design it as follows: one thread is the worker thread that does all the work, one thread is updating the status in the GUI. There is a processes list, and I use lock to make it thread-safe. The thing is I’m scanning all the processes on a regular interval (say 1 second) and in the meanwhile I cannot make changes to the list, as another thread is working on it. Therefore my program lag sometimes to display the operation

Is this a good design? What can I do to improve it? I think to lower the interval value.

  • 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-06-17T12:30:29+00:00Added an answer on June 17, 2026 at 12:30 pm

    Rather than having a shared list, consider having a list that your worker thread maintains which is the master list. Once it has done its scan it then passes a copy of the master list to the GUI thread. The GUI thread is then able to update the GUI with the new information contained in the copy whilst the worker thread can be performing another scan.

    This removes the need for a lock, because the worker thread is only ever writing to one list and then taking creating a copy (in the same thread).

    One problem with this approach is what happens if the background worker is able to gather a new process list faster than the GUI can update. You need to be able to deal with receiving a new process list while it is still processing the previous update.

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

Sidebar

Related Questions

I am trying to program a basic task manager however at this point you
The following program is a basic linked list divided in 3 classes. In the
After following a tutorial online to make a basic program which uses Get and
I'm trying to make a basic multiprocessing task and this is what I have.
I have a basic program that compares two strings : #include <string> #include <iostream>
I am writing a basic program in Python that prompts the user to enter
I have a very basic program in C++ compiled in VS 11 Beta on
I am working on a basic encryption program for a school project, and I
i have a really basic java program just one .java/.class file (.java uncompiled .class
I currently have a basic chat program in c++ that uses WinSock2.h with UDP.

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.