gnupic: Re: [gnupic] seek opinion re multitasking
Subject:
Re: [gnupic] seek opinion re multitasking
From:
John Sheahan ####@####.####
Date:
31 Jan 2005 09:21:58 +0000
Message-Id: <41FDF8AA.6080102@optushome.com.au>
David McNab wrote:
> Hi GnuPic'ers
>
> Need some opinions here.
>
> Development of Pic18Forth continues to surge, with the current dev
> version (not yet released) now having throw/catch exception handling,
> dynamic memory allocation and inline assembly.
>
> Now, I'm thinking about multitasking.
>
> Since Pic18Forth is VM-based, there's some good opportunities and
> flexibility for implementing multitasking, with several different
> schemes possible.
>
> Minimal 'task control block' could contain as little as just the current
> IP, return stack pointer and data stack pointer.
>
> Options are:
> 1) No multitasking - 'desire for multitasking reflects poor software
> design'
>
> 2) Voluntary round-robin - threads explicitly invoke a 'task-switch'
> function to voluntarily relinquish control of the CPU and allow another
> task to run - also, potentially blocking functions such as 'get char
> from tty' imply a task switch.
>
> 3) Task-as-event-handler - each task is dispatched like an event
> handler, and is expected to terminate promptly
>
> 4) Pre-emptive task switching - the bytecode execution loop may
> context-switch at any time before executing the next bytecode.
>
> What is your preferred tasking model for PIC programming?
>
for me, 4 means thinking about when I don't want to context switch,
which many things gets wrong.
Don't like 3 personally.
2 is a good place to be on simple things - which is usual for a pic.
1 can be done if you are pure enough. Tricky though..
john