Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. thread/application priority

thread/application priority

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
10 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tonyro
    wrote on last edited by
    #1

    I'm trying to write a very time sensitive program so I need to make sure that the entire application receives the highest of priorities and that no background tasks are running. I tried using 'SetThreadPriority(hWnd,31);', but other tasks, processes, applications, etc still seem to run and interfere with the timing of my program. Is it possible to make my program such that it is the only task that is running on the computer? Thanks in advance for any help.

    K A M S 4 Replies Last reply
    0
    • T tonyro

      I'm trying to write a very time sensitive program so I need to make sure that the entire application receives the highest of priorities and that no background tasks are running. I tried using 'SetThreadPriority(hWnd,31);', but other tasks, processes, applications, etc still seem to run and interfere with the timing of my program. Is it possible to make my program such that it is the only task that is running on the computer? Thanks in advance for any help.

      K Offline
      K Offline
      khan
      wrote on last edited by
      #2

      I think you could also try: BOOL SetPriorityClass(HANDLE hProcess,DWORD dwPriorityClass); But in my opinion, there is no way you could stop operating system processes from executing. But boosting the priority to very high could easily hang the system...Oh I see that is exactly what you are trying to do, right? this is this.

      1 Reply Last reply
      0
      • T tonyro

        I'm trying to write a very time sensitive program so I need to make sure that the entire application receives the highest of priorities and that no background tasks are running. I tried using 'SetThreadPriority(hWnd,31);', but other tasks, processes, applications, etc still seem to run and interfere with the timing of my program. Is it possible to make my program such that it is the only task that is running on the computer? Thanks in advance for any help.

        A Offline
        A Offline
        Ali Mojtabaee
        wrote on last edited by
        #3

        tonyro wrote:

        Is it possible to make my program such that it is the only task that is running on the computer?

        I don't think so.there are many OS tasks that manage your system and you can not stop them , if you try to stop them (if you can!) the system may crash or go to an unstable condition.can you tell me the smallest unit of time you use in your program?

        T 1 Reply Last reply
        0
        • A Ali Mojtabaee

          tonyro wrote:

          Is it possible to make my program such that it is the only task that is running on the computer?

          I don't think so.there are many OS tasks that manage your system and you can not stop them , if you try to stop them (if you can!) the system may crash or go to an unstable condition.can you tell me the smallest unit of time you use in your program?

          T Offline
          T Offline
          tonyro
          wrote on last edited by
          #4

          Thanks for your response. I'm trying to get all events in the program to be accurate down to the one millisecond scale.

          B A 2 Replies Last reply
          0
          • T tonyro

            Thanks for your response. I'm trying to get all events in the program to be accurate down to the one millisecond scale.

            B Offline
            B Offline
            basementman
            wrote on last edited by
            #5

            Windows is NOT a real-time OS. So, the best you could hope for is around a 10-20 ms scale.  onwards and upwards...

            1 Reply Last reply
            0
            • T tonyro

              I'm trying to write a very time sensitive program so I need to make sure that the entire application receives the highest of priorities and that no background tasks are running. I tried using 'SetThreadPriority(hWnd,31);', but other tasks, processes, applications, etc still seem to run and interfere with the timing of my program. Is it possible to make my program such that it is the only task that is running on the computer? Thanks in advance for any help.

              M Offline
              M Offline
              Michael Dunn
              wrote on last edited by
              #6

              tonyro wrote:

              Is it possible to make my program such that it is the only task that is running on the computer?

              Imagine if this were possible: * How would the screen get drawn? * How would the system read keyboard/mouse input? * How would the system access the hard drive? * How would the system manage the swap file? Windows is the wrong OS for your task. --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Strange things are afoot at the U+004B U+20DD

              T 1 Reply Last reply
              0
              • M Michael Dunn

                tonyro wrote:

                Is it possible to make my program such that it is the only task that is running on the computer?

                Imagine if this were possible: * How would the screen get drawn? * How would the system read keyboard/mouse input? * How would the system access the hard drive? * How would the system manage the swap file? Windows is the wrong OS for your task. --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Strange things are afoot at the U+004B U+20DD

                T Offline
                T Offline
                tonyro
                wrote on last edited by
                #7

                This is why I continue to use Windows 98 on some systems and Exit to DOS, where I can control all of these functions. However, it is getting more and more difficult to maintain those machines. What modern OS would you recommend?

                M 1 Reply Last reply
                0
                • T tonyro

                  Thanks for your response. I'm trying to get all events in the program to be accurate down to the one millisecond scale.

                  A Offline
                  A Offline
                  Ali Mojtabaee
                  wrote on last edited by
                  #8

                  Windows is not a real-time OS, It’s true! But there are techniques to satisfy timing constraints of a windows real-time application with 1 millisecond accuracy. Some of them may be complex and hard to implement but they are possible. see this on MSDN: http://msdn.microsoft.com/library/en-us/dnxpembed/html/hardrealtime.asp[^] -- modified at 0:47 Thursday 5th January, 2006

                  1 Reply Last reply
                  0
                  • T tonyro

                    This is why I continue to use Windows 98 on some systems and Exit to DOS, where I can control all of these functions. However, it is getting more and more difficult to maintain those machines. What modern OS would you recommend?

                    M Offline
                    M Offline
                    Michael Dunn
                    wrote on last edited by
                    #9

                    You can still run 98 on computers you can buy today. If 98 and DOS work for you, why change? --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Magnae clunes mihi placent, nec possum de hac re mentiri.

                    1 Reply Last reply
                    0
                    • T tonyro

                      I'm trying to write a very time sensitive program so I need to make sure that the entire application receives the highest of priorities and that no background tasks are running. I tried using 'SetThreadPriority(hWnd,31);', but other tasks, processes, applications, etc still seem to run and interfere with the timing of my program. Is it possible to make my program such that it is the only task that is running on the computer? Thanks in advance for any help.

                      S Offline
                      S Offline
                      Stephen Hewitt
                      wrote on last edited by
                      #10

                      http://www.sysinternals.com/Information/TipsAndTrivia.html Look for "Never-ending Quantum?". NOTE: I only add this for interests sake. The users of you program will not thank you for disabling multitasking on his machine. Basically here's how to do it but by the way, don't do it. I haven't actually tried it myself, just came across it in my travels. Steve

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups