Welcome, Guest. Please login or register.

Author Topic: Contiki: I wonder....  (Read 6803 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Jupp3

  • Sr. Member
  • ****
  • Join Date: Mar 2002
  • Posts: 364
    • Show all replies
    • http://jupp3.amigafin.org
Re: wow. Talk about different...
« on: April 14, 2005, 09:35:17 AM »
Quote
A preemitive task scedular would take too much ram (and time) due to it's complexity.


Nonsense!

A pre-emptitive task scheduler can be done in well under 100 bytes of code and a table, size of which depends on max number of tasks (Or maybe you just consider that too big / complex :-) )

And how do I know?

Becouse I've done it!

Of course it was very simple (didn't have priorities, events or anything else, but it kinda proved, that it is possible)

Maybe I'll finish it some day :-)

And I don't quite agree with pre-emptitive multitasking making things more complex than co-operative... With pre-emptitive you don't have to even think about giving time for other tasks, as the OS will switch to the next task after pre-set time.
 

Offline Jupp3

  • Sr. Member
  • ****
  • Join Date: Mar 2002
  • Posts: 364
    • Show all replies
    • http://jupp3.amigafin.org
Re: wow. Talk about different...
« Reply #1 on: April 14, 2005, 08:07:55 PM »
Quote
I can only guess why cooperative multitasking was used. Maybe for portability?

That might be one of the reasons. Think of C64 for example. Just save the registers somewhere, that simple. But have you ever thought of how to write that on C? I'd guess it would be quite impossible.

There are just so many things you can't write in C. Accessing certain registers, zero page etc... Don't know if it would be possible to even change the stack pointer (if you wanted to share the stack between many tasks)

But in any case, Contiki is a proof of what can be done on an unexpanded C64 with C.