[Tinyos-host-mote-wg] [Tinyos-2.0wg] proposed Scheduler interface change

David Gay dgay42 at gmail.com
Sat Oct 15 11:20:18 PDT 2005


I'd like to propose changing the scheduler interface to
interface Scheduler {

  /** Initialize the scheduler.*/
  command void init();

  /** Run the next task if one is waiting, otherwise return immediately. The
    * return value indicates whether a task was run -- TRUE indicates a task
    * ran, FALSE indicates there was no task to run.
    */
  command bool runNextTask( );

  /**
   * Enter an infinite task-running loop. Put the MCU into a low power
   * state when the processor is idle (task queue empty, waiting for
   * interrupts).
   */
  command void taskLoop();
}


The old interface had no taskLoop command, instead the runNextTask
command took a sleep parameter indicating whether the processor should
atomically sleep if the task queue was empty.

Rationale: the performance of the main TinyOS loop (aka, the proposed
taskLoop command) is important because it affects minimum power
consumption. It's much easier to optimise it as a whole, rather than
when constrained by the old runNextTask interface (just in case you're
wondering, this does produce a factor of 6 improvement in CPU cycles
on a "send one message per second  with the radio on" app).

Minor related change: __nesc_atomic_sleep should disable interrupts
after the sleep completes. This isn't really necessary, but it makes
its use inside an atomic section cleaner.

David

_______________________________________________
Tinyos-2.0wg mailing list
Tinyos-2.0wg at Mail.Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-2.0wg


More information about the Tinyos-host-mote-wg mailing list