[Tinyos-help] TinyOS Tasks / BlockStorage

Philip Levis pal at cs.stanford.edu
Mon Sep 26 17:20:18 PDT 2005


On Mon, 2005-09-26 at 16:24 -0700, David Moss wrote:
> I have an issue with BlockStorage where if I access the
> flash (writing, mounting, erasing, etc.) a few times in a row, calls
> to BlockWrite.write stop working until I let the mote pause for a
> moment outside of the command or event it is running.  If the call to
> BlockWrite.write gets put in an infinite loop in one of my
> events/tasks, it always returns FAIL until I get out of the current
> task.  Seems like after I get out of the current task that's running,
> the BlockStorage has a chance to finish up whatever it needs to do so
> that BlockWrite will be able to be called.
>  
> I believe what's happening is one task, event, or command in my
> program is issuing is taking precedence over BlockStorage's tasks,
> preventing BlockStorage from being able to finish up whatever it's
> doing.  And the command or task that's running in my app can't
> continue on until BlockStorage has finished up.  It's a chicken and
> egg problem, locking up the mote.
>  
> Anybody know how to make your task/event/whatever run with lower
> precedence than other tasks in TOS 1.x?  
>  

These are split-phase operations, so you should wait for the completion
event. You can issue your next request in the completion event handler
(or post a task that then issues the next request).

Whether or not there is priority doesn't matter, as the storage tasks
can't run until your task completes. While the TinyOS task model could
support the notion of priorities (its implementation in 1.x doesn't, but
the 2.x scheduler is open to the idea), all of the concurrency analysis
is at odds with preemption.

Phil



More information about the Tinyos-help mailing list