Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2006-04

thread priority (win32)

6 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Пётр Косаревский

Does anyone know, what priority property means?
I created two threads (both incremented/decremented the same Int64, it's not recommended behavior, is it the cause?), the first had "highest" priority, the second "lowest" (I didn't try "realtime" or "idle"). The results didn't differ from both "normal": sometimes the first was slightly ahead, sometimes the second, no visible advantage of the favored one... (I can provide source if wanted.)

Reply by email

Paul Davidson
to Пётр Косаревский

IIRC thread priority is not implemented on Darwin, and possibly other FPC platforms

Пётр Косаревский wrote 12 lines
Does anyone know, what priority property means? I created two threads (both incremented/decremented the same Int64, it's not recommended behavior, is it the cause?), the first had "highest" priority, the second "lowest" (I didn't try "realtime" or "idle"). The results didn't differ from both "normal": sometimes the first was slightly ahead, sometimes the second, no visible advantage of the favored one... (I can provide source if wanted.) _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

P Davidson
Corax Networks Inc.
http://CoraxNetworks.com

Reply by email

ik
to Пётр Косаревский: Does anyone know, what priority property means? I created two threads (both…

The Windows Kernel works in a priority level of program execution (main process) and sub processes (child process).
Each priority tells Windows what queue to place the processes. If your parent process is "Norma" then the child process does not have effect except that it's priority on executing will be higher when executing the parent process.

If I understand your question, I hope that will answer it.

Ido

Пётр Косаревский wrote 6 lines
Does anyone know, what priority property means? I created two threads (both incremented/decremented the same Int64, it's not recommended behavior, is it the cause?), the first had "highest" priority, the second "lowest" (I didn't try "realtime" or "idle"). The results didn't differ from both "normal": sometimes the first was slightly ahead, sometimes the second, no visible advantage of the favored one... (I can provide source if wanted.) _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Пётр Косаревский
to ik
Show quoted text 8 lines
The Windows Kernel works in a priority level of program execution (main process) and sub processes (child process). Each priority tells Windows what queue to place the processes. If your parent process is "Norma" then the child process does not have effect except that it's priority on executing will be higher when executing the parent process. If I understand your question, I hope that will answer it. Ido

Thank you.

Do you know, what can I do

either start thread (through some hack?) with other priority

or change the priority of the main application (by FPC? or should I use WinAPI "directly"?)

Reply by email

ik
to Пётр Косаревский

It's been a while since I developed for Windows, so I do not know if the following function is deprecated or not, or even will work on all Windows versions:
SetPriorityClass

You can set the process priority at runtime as far as I remember (please take a look at MSDN for better information :)).

Ido

Пётр Косаревский wrote 20 lines
> The Windows Kernel works in a priority level of program execution > (main process) and sub processes (child process). > Each priority tells Windows what queue to place the processes. > If your parent process is "Norma" then the child process does not have > effect except that it's priority on executing will be higher when > executing the parent process. > If I understand your question, I hope that will answer it. > Ido Thank you. Do you know, what can I do either start thread (through some hack?) with other priority or change the priority of the main application (by FPC? or should I use WinAPI "directly"?) _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Пётр Косаревский
to ik
Show quoted text 9 lines
It's been a while since I developed for Windows, so I do not know if the following function is deprecated or not, or even will work on all Windows versions: SetPriorityClass You can set the process priority at runtime as far as I remember (please take a look at MSDN for better information :)). Ido

Thank you, the function is not deprecated (I have looked up MSDN).

However, it seems that property I asked about is not very useful: with such functions (and receiving handle of main process and so on) it would not be MORE difficult to change threads priorities in alike way.

Reply by email