/* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. ChibiOS/RT is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. ChibiOS/RT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /** * @page article_roundrobin Round Robin scheduling explained * Unlike many other RTOSes, ChibiOS/RT supports multiple threads at the * same priority level and schedules them using an aggressive * round-robin strategy.
* The strategy is defined as aggressive because any scheduling event * causes the round-robin threads to rotate.
* A round-robin rotation can happen because of the following events: * - The currently executed thread voluntarily invokes the @p chThdYield() * API in order to allow the execution of another thread at the same * priority level, if any. * - The currently executed thread voluntarily goes into a sleep state * (see @ref thread_states), when the thread is awakened it goes behind * any other thread at the same priority level. * - The currently executed thread is preempted by an higher priority * thread, the thread is reinserted in the ready list (see @ref scheduling) * behind any other thread at the same priority level. * - If the @p CH_TIME_QUANTUM configuration constant is set to a value * greater than zero and if the specified time quantum expired and if * a thread with equal priority is ready then the currently executing * thread is automatically reinserted in the ready list behind any * other thread at the same priority level. * . * As you can see the @p CH_TIME_QUANTUM setting is really useful only if * there are threads at the same priority level that can run not preempted * for long periods of time and that do not explicitly yield using * @p chThdYield(). Because of this you should consider setting * @p CH_TIME_QUANTUM to zero in your configuration file, this makes the * kernel much faster and smaller and does not forbid the use of * multiple threads at the same priority level. */