Generally in a multitasking system with timeslicing,
there are two queues
(or lists)---one for processes that are running, and another one for
processes that are waiting for something (usually I/O to complete). The
code that manages the tasks take the next task on the run queue and
dispatch it.
That is one way. the other is one task list with a bitwise flag
indicating that tasks status. A task is removed from the list when
complete and entered on the list at startup. The first(or last)
task on the list is one permanent one usually a null task. The priority
can be stored in the tasklist as well (if not round robin).
I did this on my first z80 multitasking system. The task list included
queued IO as well so that things like testing to see if a task could
continue from a blocked-IO state was possible.
Allison