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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:20:49+00:00 2026-05-28T00:20:49+00:00

I am trying to change the priority of a thread but I can’t get

  • 0

I am trying to change the priority of a thread but I can’t get it to work. I have made a button which toggles the priority between low and high and when I am checking this in the joblist the priority is changed. But the CPU usage isn’t changed. I wonder if this is just because I don’t use the full CPU power or how this can be.

I am not asking if it is a good idea. I am asking how to do it.

Here is how I change the priority. This is the code behind class:

    private Thread tr;

    public MainWindow()
    {
        InitializeComponent();

        tr = new Thread(new ThreadStart(infiniteLoop));
        tr.Start();
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        if (Process.GetCurrentProcess().PriorityClass == ProcessPriorityClass.High)
        {
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Idle;
            tr.Priority = ThreadPriority.Lowest;
            description.Text = "Idle";
        }

        else
        {
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
            tr.Priority = ThreadPriority.Highest;
            description.Text = "High";
        }
    }

    private void infiniteLoop()
    {
        while (true)
        {
        }
    }
  • 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-28T00:20:49+00:00Added an answer on May 28, 2026 at 12:20 am

    It doesn’t work how I think you expect it to – i.e. that a process with low priority is somehow throttled to x% CPU time.

    A single-threaded process with any priority can consume 100% of CPU time on one core.

    When you have two processes, one with higher priority than the other, that would both consume 100% CPU time on their own, executing simultaneously, the one with higher priority will get all of the CPU time (assuming a single core) and the one with lower priority will not progress at all.

    The priority of a process is simply used to determine the order in which the scheduler will “hand out” CPU time slices to processes.

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

Sidebar

Related Questions

I'm trying to change priority of main thread using android.os.Process.setThreadPriority() . I have log
Im trying to change the thread priority in boost but im having no luck.
Am trying to change the button frame according to the orientation change but button
I am trying use cursor for pagination. Forwarding pagination work fine, but I can
I've been trying to write this query but can't seem to get it right
I'm trying change text before I get feeds. But the text changes after I
I have a C# app which runs with priority RealTime. It was all fine
Trying to change a button pic, wait a second, then change back. Not having
Trying to change the attr of something, I've got everything working but it adds
Im trying to change the title from the activities inside the Tab. but the

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.