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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:54:32+00:00 2026-06-03T02:54:32+00:00

In .NET processor affinity and priority class for all threads and child processes can

  • 0

In .NET processor affinity and priority class for all threads and child processes can be set using Process.ProcessorAffinity and Process.PriorityClass properties. Using a job object it seems that the same can be set using JOB_OBJECT_LIMIT_AFFINITY and JOB_OBJECT_LIMIT_PRIORITY_CLASS flags.

So, what’s the difference between setting certain limitations like the above on a job object vs a process?

EDIT: Once I set the limits on the job object to something lower, a low-priveleged process can still overwrite them. Does it mean the job object limits are not reinforced? How can I restrict the low-priveleged account/process from overwriting them?

What is set:


JOBOBJECT_BASIC_LIMIT_INFORMATION jobBasicInfo = {0};
jobBasicInfo.LimitFlags = JOB_OBJECT_LIMIT_AFFINITY;
jobBasicInfo.Affinity = (ULONG_PTR) (1);  // affinitize to processor 1
jobBasicInfo.LimitFlags = JOB_OBJECT_LIMIT_SCHEDULING_CLASS;
jobBasicInfo.SchedulingClass = 4;         // below normal priority class
SetInformationJobObject( hJob,
      JobObjectBasicLimitInformation,
      &jobBasicInfo,
      sizeof(jobBasicInfo));

How it is overriden by a low-priveleged process:


Process process = Process.GetCurrentProcess();
process.PriorityClass = ProcessPriorityClass.High;
// all processors mask
process.ProcessorAffinity = new IntPtr((int)Math.Pow(2, Environment.ProcessorCount) - 1);
  • 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-03T02:54:33+00:00Added an answer on June 3, 2026 at 2:54 am

    There is one big difference and some special cases. The big difference is that limits on the job object are just that: limits, while setting e.g. process priority always has an immediate effect. It’s not the same to limit the process priority to high (job object) and to set it to high (PriorityClass). The special cases arise when a process trying to give itself greater leeway than the job object allows; in which case the related API calls return success but actually do nothing, which is not the normal behavior.

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

Sidebar

Related Questions

I'm using the .Net framework's XslCompiledTransform class as the XSLT processor (in other words
How to control process affinity in .NET 2.0 ? I am newbie in .Net.
I'm using VB.NET to process a long fixed-length record. The simplest option seems to
I want to customize a .NET build process so that I can run an
My knowledge of how processes are handled by the ASP.Net worker process is woefully
When you compile windows application in .NET you can set Platform Target to be
I have many forms on an solution in .Net compact framework using all the
How can I get the CPU and Memory usage of a particular process using
I'd like people's opinion on the best XSLT processor for .NET, but what are
How to fetch processor CPU flags in C# .net ? I am particularly looking

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.