Senserely Yours, we are an ad revenue community: you too can rely on AdSense!
Senserely.com is not sponsored by or directly affiliated with Google.

16. Regarding process base-priorities (28.08.2006)

computing | general | operating-systems | priorities | processes
She Told Me

Referral Link: http://www.senserely.com/referral/7777778a

And today’s “blog-entry” is yet another copied & pasted article from my home-site’s “articles.html” page: http://users.volja.net/tayiper/articles.html (similar to yesterday’s entry); once more it’s the a modified and a bit shorter version of the article/entry titled “PROCESSES AND THEIR BASE-PRIORITIES”. I am posting this one too, because there is a lot of confusion in regards to purpose of process-priorities, and a lots of wrong information around the Internet posted about them …

You see, as we all know, the Windows operating-system is a multitasking operating one, which means that there are various applications that run simultaneously at any give time. The process priority class is therefore a parameter that tells the system which task has priority over the other task(s); for instance, if there are two programs that are running at the same time and with the same priority, they will have equal shares of the processor’s time. But in case if you would set a higher priority for one of them, the programs that has a higher priority would use all the free processor time while the one with a lower priority would use only the rest of it. And as opposed to what you may have been led to believe; a higher process priority doesn’t make things run faster (i.e. making a process or more processes run faster); remember that it is always a particular process and its priority compare to other processes’ priorities and the main question: is there a spare CPU time. Also a higher priority has nothing to do with how fast something “comes into action”, again as long as there is a spare CPU time. If you’re using a programs that is not being responsive because another is hogging the CPU, you would be better off lowering the priority of the one that you aren’t using. And also note that there are many things that can really bog down your system that have nothing to do with CPU utilization. If you system is busy processing disk I/O there will be little CPU activity, since disk doesn’t need much CPU attention, but the system will be very sluggish to user input.

So for example if your CD/DVD burner programs consumes let’s say 80 % of CPU when burning a CD, setting it to “Above Normal” (10) or even to “High” (13) priority will not speed it up (the process of burning), if there is no other programs consuming those other 20 % of CPU. It would only make it a bit more “stable” compare to other processes; but once more, only in cases if those other processes (or yet better, a single process) would start consuming enormeous amount of CPU; in this particular case of CD/DVD burner programs consuming 80 % CPU that would mean that the one single hogging process would consume (start consuing) more that 20 % of CPU. I highly recommend you to read through this thread on Ars Technica forum. The title of the thread is “A generic rule on process prioritizing (about process-priorities)”, and here is a link pointing to the first one out of five posts: http://episteme.arstechnica.com/groupee/forums?a=tpc&s=5…. But also note that the foreground task, i.e. the one that currently has a keyboard focus, has a bit higher priorities of threads anyways (this is because of the “threads queueing”), see the last paragraph in this entry below.

For instance, start Regedit and go to main menu Edit - Find… (Ctrl+F), and start searching for some possibly non-existant string (such as “ab_ab” for instance, optionally also check the “Match whole string only” check-box), or alternatively launch your adware programs or on-demand antivirus scanner and let either of these scan your hard-disk. Since the default process priority is Normal, and the process is using 90-100 % of CPU, the system becomes sluggish. Now change the priority in Task Manager to Below Normal, and what you’ll notice ?? The process is still using 90-100 % of CPU, however, the system is suddenly NOT sluggish anymore. I hope you get it by now, i.e. the principle of priorities. So high priorities should be reserved only for things (i.e. programs/processes) that need to respond quickly to requests to run, but which don’t need much CPU time when they do run. Low priorities are meant for the compute-bound operations; in other words for “CPU hogging” processes and have no affect on I/O-bound ones. Raising the priority of a process should be done only when you know that you need that particular process to run higher than all of the others at the current priority or when you are sure that it won’t hog the CPU unnecessarily itself. In fact in some cases it may even help lowering the priority to make/keep things work right (i.e. an application running as it should), see the “HELP: I can’t normally play most of the games anymore” thread: http://episteme.arstechnica.com/groupee/forums/a/tpc/f/99609… that I opened on Ars Technica forum when I had problems with the mouse being “delayed” or as I call it, the mouse “moving in steps” when trying to play a Star Wars - Knights of the old Republic game from LucasArts.

/IMPORTANT: But note that it is a bit different regarding “threads priorities” and their queueing. You see, if a newly ready thread is at the same priority as what’s currently running, it has to sit on the “ready queue” for that priority until what’s currently running has used up its timeslice (and everything else that was already on the ready queue); so if the newly ready thread is of higher priority than the currently running thread, it preempts the current thread immediately, regardless of the timeslice usage of the current thread. And note that threads have also “dynamic” priorities beside the “base” ones. Finally regarding the “spare CPU time”; the CPU being less than 100% busy does not necessarily mean that a thread that wants to run can run right away. On an instantaneous basis the CPU is never anything but 0% or 100% in use — it is either running a real thread or an idle thread. The “% busy” stat we see in places such as Task Manager and Perfmon is an average over the display interval, which is normally at least one second. A low “% busy” state may be hiding busy periods that last significant fractions of a second.

Ivan Tadej (user: “tayiper”)

Referral Link: http://www.senserely.com/referral/7777778a

eXTReMe Tracker