Skip to content

Scheduler internals

Jérémie Magnette edited this page Dec 21, 2015 · 1 revision

The function pico_stack_tick represents the core of the currently implemented scheduler. Its role is to assign CPU time slices to all the modules previously registered. The friendliness of the scheduler strictly depends on the implementation of the processing functions for both protocols and drivers.
A typical processing function (e.g. protocols process_in / process_out or driver’s poll) receives an integer value loop_score as one of the arguments. This value indicates the maximum number of frames that can be processed during this invocation. The processing function must decrease the loop_score value by one for each frame that has been processed during the invocation, and return the remaining value. If the loop_score reaches zero, the function should stop and return zero immediately. This ensures that the central scheduler has the control over the number of frames that can be processed at every iteration by each and every module, ensuring a fair share for all the protocols and drivers awaiting to process incoming and outgoing frames. After each epoch, the scheduler calculates a new set of loop_scores for all the protocols and drivers in order to optimize the response time and the throughput of the stack.

Clone this wiki locally