ChibiOS/RT Logo ChibiOS/RT

Architecture - Reference Manual - Guides

Kernel Concepts

ChibiOS/RT Kernel Concepts

Naming Conventions

ChibiOS/RT APIs are all named following this convention: ch<group><action><suffix>(). The possible groups are: Sys, Sch, Time, VT, Thd, Sem, Mtx, Cond, Evt, Msg, SequentialStream, IO, IQ, OQ, Dbg, Core, Heap, Pool.

API Names Suffixes

The suffix can be one of the following:

Examples: chThdCreateStatic(), chSemSignalI(), chIQGetTimeout().

Interrupt Classes

In ChibiOS/RT there are three logical interrupt classes:

The mapping of the above logical classes into physical interrupts priorities is, of course, port dependent. See the documentation of the various ports for details.

System States

When using ChibiOS/RT the system can be in one of the following logical operating states:

Note that the above states are just Logical States that may have no real associated machine state on some architectures. The following diagram shows the possible transitions between the states:

inline_dotgraph_6.dot

Note, the SFI, Halted and SNMI states were not shown because those are reachable from most states:

inline_dotgraph_7.dot
Attention:
* except: Init, Halt, SNMI, Disabled.

Scheduling

The strategy is very simple the currently ready thread with the highest priority is executed. If more than one thread with equal priority are eligible for execution then they are executed in a round-robin way, the CPU time slice constant is configurable. The ready list is a double linked list of threads ordered by priority.

inline_dotgraph_8.dot


Note that the currently running thread is not in the ready list, the list only contains the threads ready to be executed but still actually waiting.

Threads States

The image shows how threads can change their state in ChibiOS/RT.

inline_dotgraph_9.dot

Priority Levels

Priorities in ChibiOS/RT are a contiguous numerical range but the initial and final values are not enforced.
The following table describes the various priority boundaries (from lowest to highest):

Threads Working Area

Each thread has its own stack, a Thread structure and some preemption areas. All the structures are allocated into a "Thread Working Area", a thread private heap, usually statically declared in your code. Threads do not use any memory outside the allocated working area except when accessing static shared data.

workspace.png


Note that the preemption area is only present when the thread is not running (switched out), the context switching is done by pushing the registers on the stack of the switched-out thread and popping the registers of the switched-in thread from its stack. The preemption area can be divided in up to three structures:

See the Port Templates documentation for details, the area may change on the various ports and some structures may not be present (or be zero-sized).


Generated on Sun Nov 28 2010 14:09:54 for ChibiOS/RT by doxygen 1.7.1