Scheduling methods

The scheduling method determines when control is transferred from one running thread to another. An Open Server application uses one of two scheduling methods: non-preemptive or preemptive. Non-preemptive is the default method and the only method available on most platforms.


Non-preemptive scheduling

With non-preemptive scheduling, context switches are predictable. They can occur only in these situations:


Preemptive scheduling

With preemptive scheduling, a context switch can occur when any of the above events occurs, or when the system interrupts the running thread. Preemptive scheduling depends upon the thread management facilities of the operating system, so system-initiated context switches are not predictable. Operating systems often employ sophisticated algorithms to ensure optimal time distribution among threads.

You can choose preemptive scheduling using the srv_props routine with property set to SRV_S_PREEMPT. Preemptive scheduling is not available on every platform. Call srv_capability to determine whether it is available on your application’s platform.