Re: Multitasking Preview Release

new topic     » goto parent     » topic index » view thread      » older message » newer message

Rob Craig wrote:

>>I haven't looked into the details of ME,
>>but couldn't you do a full context switch of all of your ME data
>>after each task_yield(), and also at the start of a new task,
>>such that you copy (this may be just a pointer copy internally)
>>all the ME data for the new current task
>>into the simple variables that you use today? e.g.

   >>me_data1 = all_tasks_me_data1[task_self()]
   >>me_data2 = all_tasks_me_data2[task_self()]
   ...

>>You could create an ME context-switch routine for this,
>>and maybe create a wrapped version of task_yield()
>>to add this extra operation.

>>It would be extra overhead at each context switch,
>>but if the user did not use multitasking, he wouldn't need it,
>>and he would have little or no overhead.
>>You could also retain the structure of all the 
>>ME internal variables you are using now.

Yes, of course that's it. That does reduce the cost to programs that don't use
tasks to zero. All I would need is to redefine task_yield and do my context
switching there. I could even make task_yield a no-op in contexts where task
switching is inappropriate, for example in the middle of a class definition. This
will add some overhead to task_yield, but fairly small. (I might also redefine
task_create to reserve space for context switches to reduce the added overhead to
task_yield.)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu