ST20-C1 STMICROELECTRONICS [STMicroelectronics], ST20-C1 Datasheet - Page 84

no-image

ST20-C1

Manufacturer Part Number
ST20-C1
Description
Instruction Set Reference Manual
Manufacturer
STMICROELECTRONICS [STMicroelectronics]
Datasheet
7.8 Scheduling kernels
The following code would set up a process control block:
The process is then inactive, so it can be added to the back of the scheduling queue
using run , exactly as in section 7.5.
7.8
A scheduling kernel can be written to override the default scheduling behavior of the
ST20-C1, but still using the very fast micro-code scheduling. The basis of such a
scheduler would be trap handlers to trap the system exceptions el_idle_trap,
el_run_trap, el_stop_trap, el_timeslice_trap and el_schedule_exception_trap.
When these traps are taken, a scheduling event is due or the processor has become
idle. The trap replaces the default scheduling action. When the trap handler returns,
the CPU will continue with the next instruction. Traps are described in Chapter 6.
Additional system calls may be implemented by user-defined trap handlers, called
using ecall .
7.9
Semaphores are a mechanism for managing access to shared resources within a
multi-tasking environment. The semaphore operations are provided by the instructions
listed in Table 7.4.
The semaphore instructions act on a semaphore control block, defined in Table 7.5.
Each semaphore has a semaphore control block, which implements a linked list of
waiting processes and a count of free resources. The count should be initialized to the
total number of available resources (usually one), and the front list pointer should be
initialized to the empty value NotProcess . For fast signalling and minimal interrupt
latency, semaphore control blocks should be in fast memory, preferably on-chip.
84/205
Word offset
2
1
0
ld entry_point; ld control_block; stnl pw.Iptr;
ld work_space_top; arot; stnl pw.Wptr;
Scheduling kernels
Semaphores
s.Back
s.Front
s.Count
Slot name
signal
wait
stop
run
Mnemonic
Table 7.5 Semaphore control block
Table 7.4 Semaphore instructions
The back of the semaphore waiting list.
The front of the semaphore waiting list.
The unsigned number of extraprocesses that the semaphore will allow
to continue running on a wait request.
signal
wait
stop process
run process
Name
Purpose

Related parts for ST20-C1