In a computer system including at least one microcontroller, by suspending
tasks after execution of particular instructions, such as a
load-register-from-external-memory instruction, or when a resource is not
ready, unnecessary attempts to execute subsequent instruction can be
avoided. If a processor register has not yet been loaded and the next
instruction attempts to use that register, the task will suspend. A task
can also be suspended by incorporating a computer instruction that
suspends the task after execution. A task can also be suspended by
utilizing resources that provide one or more suspend indications. Such
suspend indications can include a
"suspend-and-resume-on-current-instruction" indication that suspends the
current task and leaves the program counter (PC) value pointing to the
current instruction or can include a
"suspend-and-resume-on-next-instruction" indication that suspends the
current task after completion of the current instruction and advances the
program counter (PC) value to point to the next instruction. When the
task becomes active again, the task begins execution at the instruction
pointed to by the PC.