Go to the first, previous, next, last section, table of contents.

Scheduling policy for concurrent/parallel threads

Runnable threads are scheduled in round-robin fashion. Context switches are signalled by the generation of new sparks or by the expiry of a virtual timer (the timer interval is configurable with the `-C[<num>]' RTS option). However, a context switch doesn't really happen until the next heap allocation. If you want extremely short time slices, the `-C' RTS option can be used to force a context switch at each and every heap allocation.

When a context switch occurs, pending sparks which have not already been reduced to weak head normal form are turned into new threads. However, there is a limit to the number of active threads (runnable or blocked) which are allowed at any given time. This limit can be adjusted with the `-t<num>' RTS option (the default is 32). Once the thread limit is reached, any remaining sparks are deferred until some of the currently active threads are completed.


Go to the first, previous, next, last section, table of contents.