7.1 Processes
7 Multi-tasking
This chapter describes the features of the ST20-C1 core provided to support multi-
tasking, and how to use them. The architecture of the ST20-C1, including the registers
and memory arrangement, are described in Chapter 3. Interrupts and traps are
described in Chapter 6. A full list of constants and data structures is given in Appendix
A.
Support is provided in the instruction set for timeslicing, scheduling processes and
manipulating queues of processes.
7.1 Processes
A process (also known as a task or thread) is an independent unit of software with a
single thread of control, i.e. a sequential algorithm. Any number of processes may be
run. A process which has been started but not terminated may be in one of several
different states:
• executing on the CPU;
• interrupted or trapped by an exception;
• inactive, i.e. waiting for a peripheral or semaphore signal;
• waiting for CPU time.
A process that is not inactive is said to be active. A process that is not executing or
interrupted is said to be descheduled. The states and main transitions are shown in
Figure 7.1. The scheduling transitions can be trapped so that a software scheduling
kernel can modify the transitions and so change the scheduling behavior, for example
by providing a system of process priorities.
Run
Not started
Waiting
for CPU
time
Descheduled
processes
Event
Terminate
Executing
Terminated
Timeslice
Interrupt
Descheduled
or trap
Active
processes
Return
Inactive
Interrupted
or
trapped
Figure 7.1 Process states and main transitions
78/205
®