Solved

Allocate a core for a strictly timed process

Posted on 2010-08-14
7
640 Views
Last Modified: 2013-12-16
I need to set a strictly timed periodic process in Win XP (May be Win7 if XP cant do it). I can have a double or quad core computer. I want to allocate a full core entirely, or almost entirely, to the process, so it will not be disturbed by other threads, or media accesses. How can it be done?
I use Visual Studio for development.
0
Comment
Question by:yahali
  • 4
  • 3
7 Comments
 
LVL 32

Expert Comment

by:phoffric
ID: 33442129
What is the resolution and accuracy of your timed periodic process? You may need a real-time clock if the tick count is not sufficient.

In my limited XP account, I tried to set the priority of firefox to "realtime", but it only went to "high". Maybe in admin, I can bump it up higher.

There is also in the task manager a "set affinity" option. Depending upon your needs, you may be able to allocate one of the cores to just your timed periodic process, and all the other processes are allocated to the other cores.
0
 

Author Comment

by:yahali
ID: 33442852
The "Set Affinity" option only restricts said process from running other cores; it doesnt ban other processes from using the allocated core. Thus setting process affinity will protect other threads from CPU clogging, but will not protect the said process from  sharing its core with other programs.
Thanks
Yahali
0
 
LVL 32

Expert Comment

by:phoffric
ID: 33442866
>> it doesnt ban other processes from using the allocated core.
Then is it possible to set affinity for these other processes to cores other than the allocated core?
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:yahali
ID: 33443987
That may be practical if you expect your user to go over the application manager every run. A program can easily set its own affinity (if I remember correctly, "SetAffinityMask") but I dont know if it can control the arbitration of other processes by the operating system.
Thx
Yahali
0
 
LVL 32

Accepted Solution

by:
phoffric earned 500 total points
ID: 33444646
Depending upon your needs w.r.t. resolution and accuracy, you may not be able to achieve your goal in a general purpose computer. You should post your requirements. You may have to add a real-time clock if the tick count is insufficient for your needs.

Usually for very stringent timing requirements the user is on a special purpose embedded system where the developer has more control over all the processes. I got the impression that you need to set up this time critical process in a general purpose PC where the user may run any program at any time (and even download new applications that you may unaware of).

Setting the priority high of this one task will help (at the expense of other processes).

You will also have to figure out how to pin your real-time process in memory so that is not swapped out. (In disk-less embedded systems that is not an issue.)

I haven't dealt with affinity so I just did a search to see what is available for automated affinity settings. Here are two discussions with different recommendations:
     http://w.e-e.com/ylzPgX
     http://w.e-e.com/COlIpk

There were several references to Tom's Hardware, so see if you can get this approach to work. There were mixed reviews:

 "how to set processor affinity automatically"
  http://www.tomshardware.com/forum/179198-28-processor-affinity-automatically

Here's an link to older OS. The problem may be that it refers only to non-OS processes:
http://www.windowsitpro.com/article/tips/jsi-tip-3542-how-can-i-permanently-set-the-processor-affinity-for-an-application-.aspx

If you need further assistance, please hit the Request Attention link and request experts in the Windows OS real-time in XP and 7.
0
 

Author Closing Comment

by:yahali
ID: 33445517
Thanks for the patience
0
 
LVL 32

Expert Comment

by:phoffric
ID: 33445649
I wish you the best of luck :)
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In the modern office, employees tend to move around the workplace a lot more freely. Conferences, collaborative groups, flexible seating and working from home require a new level of mobility. Technology has not only changed the behavior and the expe…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now