I am confused about the statement from the book Threading in C# about thread priority,
the confusing statement is, "The ideal solution is to have the real-time work and user interface in separate processes". Why the solution works and ideal?
The whole paragraph is,
If the real-time application has a user interface, it can be undesirable to elevate the process priority because screen updates will be given excessive CPU time – slowing the entire computer, particularly if the UI is complex. (Although at the time of writing, the Internet telephony program Skype gets away with doing just this, perhaps because its UI is fairly simple). Lowering the main thread’s priority – in conjunction with raising the process’s priority – ensures the real-time thread doesn’t get preempted by screen redraws, but doesn’t prevent the computer from slowing, because the operating system will still allocate excessive CPU to the process as a whole. The ideal solution is to have the real-time work and user interface in separate processes (with different priorities), communicating via Remoting or shared memory. Shared memory requires P/Invoking
the Win32 API (web-search CreateFileMapping and MapViewOfFile).
thanks in advance,
it just means that for RT task you want to set process and thread priority to maximum
if you have a UI thread in the same application - you can lower the thread priority, but process priority will still be high, giving unneded CPU cycles to the UI thread
So best solution will be extract UI to another process that can have independent process and thread priorities so no additional CPU cycles will be wasted on UI tasks
You know so many things -- C++ and C#. Question answered. Cool!
Originally Posted by vart