Subject Re: [IB-Architect] New feature request (thread priority)
Author Toni Martir
> This is the bane of operating system scheduling algorithms. The problem
> is this: A high priority threads get stuck behind a low priority thread
> in a busy system never gets scheduled, and is effectively blocked. Unless
> a thread can inherit the priority of a thread it is blocking, you are
> likely to be very disappointed in the results.

I understand this, for example with one computer with NT File Server and
Interbase installed, when I set high priority for Interbase Server, the file
server service blocks, until Interbase is idle.

So is a responsibility to the programer to set high priority only in threads
that takes very little time and are not very frequent to block other threads
(querys) for a long time. Think about a system executing 5% CPU time in high
priority threads and 60% other priority threads. The problem is when a long
proces has high priority, but for example Win32 has two priority levels to
try avoid this problem (SetPriorityclass and Setthreadpriority).
As you say if always exits high priority thread, the low priority threads
are never executed, but this is what we want (now background garbage
collection does this?). I want the time critical query to be executed before
a analitic query, the analitic query will be blocked little time because the
high priority threads are short and not very frequent.

Take care that bloquing of low priority thread is not 100% effective because
if the high priority thread does I/O, a quantum time is donated to other
thread, if there is no CPU demand of high priority threads, the low priority
thread takes the CPU while high priority threads waits for I/O result.