Multitasking enables a complex job to be implemented by designing separate tasks that operates independently or cooperates. Each task must so simple that it can be described by some sequential behavior. Each task is simple, but the total collection of tasks enables a complex job to be solved. State machines and timeslicing are two popular multitasking methods with long traditions. State machines have been used to design complex systems with high reliability requirements.
State machines requires that the task is split into states.
The state machine stays in one state at a time, and switch to another state when the specified conditions are met. Actions are performed during the transitions. States represent a situation that is stable for some time interval. State machines can be implemented on ALL PICmicros, also on the smallest PIC16C52. Timeslicing means that the kernel interrupts each process after some milliseconds and give control to another task.