Thanks for your help Philip. We are reading your programming manual, which
is really good, but we would want to understand right. Your answers help us
a lot.
Andres
From: Philip Levis <[EMAIL PROTECTED]>
To: Andres Aberasturi <[EMAIL PROTECTED]>
CC: [email protected]
Subject: Re: [Tinyos-help] NesC and TinyOS
Date: Tue, 13 Jun 2006 09:00:46 -0700
On Jun 12, 2006, at 7:29 AM, Andres Aberasturi wrote:
Hi all,
We have been working with TinyOs and NesC some few months, but we still
have some doubts. We want to ask you the following three questions:
1.- In some places, we have read that events can call commands, post
tasks and signal other events. Also, we have read that commands can call
lower level commands. Then, a command cannot post a task? or signal an
event? is it right? We thought command can do it.
The only operation that issues a warning is when an async function calls a
sync function. For simplicity, sync functions are only safe to call when
the root of the call graph is a task. Async functions can also have
interrupt handlers are their root.
In practice, it is bad practice to signal an event (signal xxxx) inside a
command. There is nothing that prevents you from doing so, however. It is
bad practice because it can easily lead to infinite call loops. For
example:
call Foo.send();
event void Foo.sendDone();
commmand void Foo.send() {
signal Foo.sendDone();
}
The TinyOS programming manual goes into detail on this and other good/ bad
programming practices.
2.- We have read that there are two level scheduling: events and tasks.
We know TinyOs scheduler manages tasks which are posted, so does TinyOs
scheduler manage events? or are events managed like commands?
The distinction is sync/async. The term "event" was overloaded in the
original TinyOS paper to mean both "callback" and "interrupt." The
command/event distinction means the former, the task/event distinction
means the latter. The nesC paper and the TinyOS programming guide are good
resources for learning about the details.
3.- If you have a task posted, could you post the same task other time?
We mean if we have a task in the task qeue, could we post the same task
again? Perhaps it is a simple question, but we think it is possible that
if the task is in the task qeue, we couldn't post it again.
This depends on what version of TinyOS you're using. In 1.x, a single
task can have multiple outstanding posts in the task queue. In 2.x, a task
can only have one outstanding post. This latter behavior turns out to have
a lot of nice isolation and fairness properties. TEP 106 has a good
discussion of the tradeoffs.
Phil
_________________________________________________________________
Moda para esta temporada. Ponte al día de todas las tendencias.
http://www.msn.es/Mujer/moda/default.asp
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help