RealTime Priority?
-
I wanna set real time priority to my application. At first a loader program runs myapp. Then I want to get the process id using exe name. With exe name i must be able to set its priority to REALTIME. My concept may sound correct but i dont know how to program it. Anybody can help me;P
-
I wanna set real time priority to my application. At first a loader program runs myapp. Then I want to get the process id using exe name. With exe name i must be able to set its priority to REALTIME. My concept may sound correct but i dont know how to program it. Anybody can help me;P
SetThreadPriority(...)[^]:) ARSALAN MALIK
-
I wanna set real time priority to my application. At first a loader program runs myapp. Then I want to get the process id using exe name. With exe name i must be able to set its priority to REALTIME. My concept may sound correct but i dont know how to program it. Anybody can help me;P
If you have control over the loader program you can use
CreateProcess()
to launch your application and useREALTIME_PRIORITY_CLASS
in the creation flag. Otherwise useSetPriorityClass()
within your application toREALTIME_PRIORITY_CLASS
- this will ensure that your application runs at Realtime priority always. I would be carefull when creating programs that run at realtime as they *will* hog the processor and you can easily prevent other applications from responding. Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fruity and sweet.
I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain) -
If you have control over the loader program you can use
CreateProcess()
to launch your application and useREALTIME_PRIORITY_CLASS
in the creation flag. Otherwise useSetPriorityClass()
within your application toREALTIME_PRIORITY_CLASS
- this will ensure that your application runs at Realtime priority always. I would be carefull when creating programs that run at realtime as they *will* hog the processor and you can easily prevent other applications from responding. Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fruity and sweet.
I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)I tried...but it doesn't work. I am in VC6. Does this stuffs work under VC6? In the loader program i am using the below code, STARTUPINFO suInfo; PROCESS_INFORMATION procInfo; CString m_Process; m_Process.Format(_T("%s\\my.exe"),curDir); memset (&suInfo, 0, sizeof(suInfo)); suInfo.cb = sizeof(suInfo); ::CreateProcess(m_Process, NULL, // can also be NULL NULL, NULL, FALSE, REALTIME_PRIORITY_CLASS, NULL, NULL, &suInfo, &procInfo); if (procInfo.dwThreadId == NULL) { AfxMessageBox("nope"); } else { ::SetThreadPriority(&procInfo.dwThreadId,THREAD_PRIORITY_HIGHEST); } When I check in process viewer the class priority is "Very High", the thread priority remain "normal". Also when a thread runs in "my.exe" it's not given the highest priorities, i am free to access other programs.
-
I tried...but it doesn't work. I am in VC6. Does this stuffs work under VC6? In the loader program i am using the below code, STARTUPINFO suInfo; PROCESS_INFORMATION procInfo; CString m_Process; m_Process.Format(_T("%s\\my.exe"),curDir); memset (&suInfo, 0, sizeof(suInfo)); suInfo.cb = sizeof(suInfo); ::CreateProcess(m_Process, NULL, // can also be NULL NULL, NULL, FALSE, REALTIME_PRIORITY_CLASS, NULL, NULL, &suInfo, &procInfo); if (procInfo.dwThreadId == NULL) { AfxMessageBox("nope"); } else { ::SetThreadPriority(&procInfo.dwThreadId,THREAD_PRIORITY_HIGHEST); } When I check in process viewer the class priority is "Very High", the thread priority remain "normal". Also when a thread runs in "my.exe" it's not given the highest priorities, i am free to access other programs.
Manikandan wrote: i am free to access other programs You will always be able to access other programs even with Realtime priority set. NOTE: Running under windows you can not set the application to have exclusive use of the processor. I am puzzled, why would you want to do this? Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fruity and sweet.
I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain) -
Manikandan wrote: i am free to access other programs You will always be able to access other programs even with Realtime priority set. NOTE: Running under windows you can not set the application to have exclusive use of the processor. I am puzzled, why would you want to do this? Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fruity and sweet.
I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)Hi Ant, my application is time sensitive. even mouse move will affect its normal operation. This is why i have to suspend other programs when my exe run a thread. Actually i found a standalone program in the net that list out all the running programs (I give you the link asap). When i set the priority to real time (24). I found my program running fine while i cant even access the mouse. But i want to do this programmatically.
-
Hi Ant, my application is time sensitive. even mouse move will affect its normal operation. This is why i have to suspend other programs when my exe run a thread. Actually i found a standalone program in the net that list out all the running programs (I give you the link asap). When i set the priority to real time (24). I found my program running fine while i cant even access the mouse. But i want to do this programmatically.
Manikandan wrote: But i want to do this programmatically I would have thought that my suggested launching would have worked. If I think of anything else you could try I will let you know. Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fruity and sweet.
I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain) -
I wanna set real time priority to my application. At first a loader program runs myapp. Then I want to get the process id using exe name. With exe name i must be able to set its priority to REALTIME. My concept may sound correct but i dont know how to program it. Anybody can help me;P
Well, just a notice - Windows are not realtime OS, if you really need the RT features (for RT controlling a device or something like that) you better to go by some specialized RT OS or get some RT plugin for NT that replaces the standard scheduler. Even if you set the process realtime priority and thread realtime priority the time scheduler can interrupt your process and will do it usually in the worsest possible time.
-
Well, just a notice - Windows are not realtime OS, if you really need the RT features (for RT controlling a device or something like that) you better to go by some specialized RT OS or get some RT plugin for NT that replaces the standard scheduler. Even if you set the process realtime priority and thread realtime priority the time scheduler can interrupt your process and will do it usually in the worsest possible time.
hi thanks for you idea, i did a google search with the string "Real Time plug in for NT" but i couldn't come across any windows compatible plug in's. would you please refer me one :rolleyes:
-
hi thanks for you idea, i did a google search with the string "Real Time plug in for NT" but i couldn't come across any windows compatible plug in's. would you please refer me one :rolleyes: