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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Process vs. Thread priority.

Process vs. Thread priority.

Scheduled Pinned Locked Moved C / C++ / MFC
visual-studioquestion
3 Posts 3 Posters 1 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.
  • S Offline
    S Offline
    Simon Steele
    wrote on last edited by
    #1

    If I have two processes with normal priority, and each has a thread running with different priorities like this: Process 1 |- Thread 1 (High Priority) Process 2 |- Thread 2 (Normal Priority) I'm trying to work out whether the high priority on the thread affects only the thread's chances of getting a slice within the context of slices available for the process, or whether it affects the allocation of slices at the same level as process priority. That's not hugely clear, I know. Given this scenario, will Thread 1 get more time on the processor than Thread 2 (even though the processes have equal priority)? Any ideas? Thanks. -- Simon Steele Programmers Notepad - http://www.pnotepad.org/

    V P 2 Replies Last reply
    0
    • S Simon Steele

      If I have two processes with normal priority, and each has a thread running with different priorities like this: Process 1 |- Thread 1 (High Priority) Process 2 |- Thread 2 (Normal Priority) I'm trying to work out whether the high priority on the thread affects only the thread's chances of getting a slice within the context of slices available for the process, or whether it affects the allocation of slices at the same level as process priority. That's not hugely clear, I know. Given this scenario, will Thread 1 get more time on the processor than Thread 2 (even though the processes have equal priority)? Any ideas? Thanks. -- Simon Steele Programmers Notepad - http://www.pnotepad.org/

      V Offline
      V Offline
      valikac
      wrote on last edited by
      #2

      I believe a thread priority is relative to the priority of the process it resides in. Kuphryn

      1 Reply Last reply
      0
      • S Simon Steele

        If I have two processes with normal priority, and each has a thread running with different priorities like this: Process 1 |- Thread 1 (High Priority) Process 2 |- Thread 2 (Normal Priority) I'm trying to work out whether the high priority on the thread affects only the thread's chances of getting a slice within the context of slices available for the process, or whether it affects the allocation of slices at the same level as process priority. That's not hugely clear, I know. Given this scenario, will Thread 1 get more time on the processor than Thread 2 (even though the processes have equal priority)? Any ideas? Thanks. -- Simon Steele Programmers Notepad - http://www.pnotepad.org/

        P Offline
        P Offline
        peterchen
        wrote on last edited by
        #3

        The Base Priority of a thread is determined by both the process priority class, and the thread priority. It's just two different mechanisms (one to weight processes in the system, one to weight threads inside one process) Thread 1 will (almost) always get scheduled first when both are waiting for an event or similar. The scheduler always schedules the thread of the highest priority that is ready to run. So Thread 1 will starve thread 2, if it doesn't give up processor time or a second CPU is available. The one exception is: Input goes to Thread 2. When input waits in the queue for a thread, it's priority is temporarily boosted.


        "Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
        sighist | Agile Programming | doxygen

        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