Preemptive multitasking and non-preemptive multitasking