[Tinyos-help] Question about tasks in Tinyos 1.x

2006-09-26 Thread KANG HUI
Dr. Levis:
If a command has the following code

command result_t A.p(){
   ...
   post TaskB();
   ...
}
If some module call A.p(), the execution sequence is : first A.p() is
put into the task queue and runs to
completion, and then TaskB will be executed until a later time. And the
return value of A.p() is whether TaskB be put into the task queue.
So command and event function is also two kinds of tasks. But a C-like
function such as
void f(){
}
is not a task and will return immediately.
Is my understanding right? Please correct me. Thanks.

Regards,
Hui

___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] Question about tasks in Tinyos 1.x

2006-09-26 Thread Cory Sharp
Kang,Please search the TinyOS Help archives.  It seems like we discuss this at length at least once a month.  A handy form for search ing is here:
http://www.moteiv.com/community/TinyOS_InformationShort answer: commands and events are just like C functions, they're not tasks.CoryOn 9/26/06, 
KANG HUI <[EMAIL PROTECTED]> wrote:
Dr. Levis:If a command has the following codecommand result_t A.p(){   ...   post TaskB();   ...}If some module call A.p(), the execution sequence is : first A.p() isput into the task queue and runs to
completion, and then TaskB will be executed until a later time. And thereturn value of A.p() is whether TaskB be put into the task queue.So command and event function is also two kinds of tasks. But a C-like
function such asvoid f(){}is not a task and will return immediately.Is my understanding right? Please correct me. Thanks.Regards,Hui___Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDUhttps://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Re: [Tinyos-help] Question about tasks in Tinyos 1.x

2006-09-26 Thread KANG HUI
Hi, Cory,
Thank you for you reply.
But on the mailing list, most of them deal with interrupt and event
handler. When I concern about is the command function and task.
If as you said command function is like C function and returns
immediately, why does nesC need "asyn command"? Asynchrous command
function executes immediately and preempt tasks.
Is command function without "asyn" like task will be deferred for some
time. For example,
   (1)Non asyn command function
 In component A, it call B.process(), which isn't defiedn as a asyn
command. Then B. process() will be put into the task queue and executed
later.
(2) asyn command function
 Component A call B.process(), which is asyn command. Then B.process()
execute immediately and preempt other tasks in the task queue.

So my conclusion is that command function without "asyn" is like task,
insead of C-function.

Hui

On Tue, 26 Sep 2006, Cory Sharp wrote:

> Kang,
>
> Please search the TinyOS Help archives.  It seems like we discuss this at
> length at least once a month.  A handy form for search ing is here:
>
> http://www.moteiv.com/community/TinyOS_Information
>
> Short answer: commands and events are just like C functions, they're not
> tasks.
>
> Cory
>
> On 9/26/06, KANG HUI <[EMAIL PROTECTED]> wrote:
> >
> > Dr. Levis:
> > If a command has the following code
> >
> > command result_t A.p(){
> >...
> >post TaskB();
> >...
> > }
> > If some module call A.p(), the execution sequence is : first A.p() is
> > put into the task queue and runs to
> > completion, and then TaskB will be executed until a later time. And the
> > return value of A.p() is whether TaskB be put into the task queue.
> > So command and event function is also two kinds of tasks. But a C-like
> > function such as
> > void f(){
> > }
> > is not a task and will return immediately.
> > Is my understanding right? Please correct me. Thanks.
> >
> > Regards,
> > Hui
> >
> > ___
> > Tinyos-help mailing list
> > Tinyos-help@Millennium.Berkeley.EDU
> > https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> >
>

___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] Question about tasks in Tinyos 1.x

2006-09-27 Thread Crif1102
Hi all,  As Hui I don't understand the difference between async and sync...  If the the answer is like Cory says, there is no difference between sync and async command, perhaps only the fact that the compiler reports possible data races in the command was delcare sync. Is right?  About events.. I have seen that if a event was delcared sync, when it is signaled and there's a current operation running, the event was ignored. Instead, if the event was declared async, the current operation is stopped and the control pass to the procedure implemented by the component that use that interface. Is right?     Thanks to all!     Cristian   KANG HUI <[EMAIL PROTECTED]> ha scritto:   Hi, Cory,Thank
 you for you reply.But on the mailing list, most of them deal with interrupt and eventhandler. When I concern about is the command function and task.If as you said command function is like C function and returnsimmediately, why does nesC need "asyn command"? Asynchrous commandfunction executes immediately and preempt tasks.Is command function without "asyn" like task will be deferred for sometime. For example,(1)Non asyn command functionIn component A, it call B.process(), which isn't defiedn as a asyncommand. Then B. process() will be put into the task queue and executedlater.(2) asyn command functionComponent A call B.process(), which is asyn command. Then B.process()execute immediately and preempt other tasks in the task queue.So my conclusion is that command function without "asyn" is like task,insead of C-function.HuiOn Tue, 26 Sep 2006, Cory Sharp wrote:>
 Kang,>> Please search the TinyOS Help archives. It seems like we discuss this at> length at least once a month. A handy form for search ing is here:>> http://www.moteiv.com/community/TinyOS_Information>> Short answer: commands and events are just like C functions, they're not> tasks.>> Cory>> On 9/26/06, KANG HUI <[EMAIL PROTECTED]>wrote:> >> > Dr. Levis:> > If a command has the following code> >> > command result_t A.p(){> > ...> > post TaskB();> > ...> > }> > If some module call A.p(), the execution sequence is : first A.p() is> > put into the task queue and runs to> > completion, and then TaskB will be executed until a later time. And the> > return value of A.p() is whether TaskB be put into the task queue.> > So command and event function is also
 two kinds of tasks. But a C-like> > function such as> > void f(){> > }> > is not a task and will return immediately.> > Is my understanding right? Please correct me. Thanks.> >> > Regards,> > Hui> >> > ___> > Tinyos-help mailing list> > Tinyos-help@Millennium.Berkeley.EDU> > https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help> >>___Tinyos-help mailing listTinyos-help@Millennium.Berkeley.EDUhttps://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help 
		Yahoo! Mail: gratis 1GB per i messaggi, antispam, antivirus, POP3___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Re: [Tinyos-help] Question about tasks in Tinyos 1.x

2006-09-27 Thread KANG HUI
Hi,
Actually, not asyn and sync. What I concer about is command function and
task.

On Wed, 27 Sep 2006, Crif1102 wrote:

> Hi all,
>   As Hui I don't understand the difference between async and sync...
>   If the the answer is like Cory says, there is no difference between sync 
> and async command, perhaps only the fact that the compiler reports possible 
> data races in the command was delcare sync. Is right?
>   About events.. I have seen that if a event was delcared sync, when it is 
> signaled and there's a current operation running, the event was ignored. 
> Instead, if the event was declared async, the current operation is stopped 
> and the control pass to the procedure implemented by the component that use 
> that interface. Is right?
>
>   Thanks to all!
>
>   Cristian
>
>
> KANG HUI <[EMAIL PROTECTED]> ha scritto:
>   Hi, Cory,
> Thank you for you reply.
> But on the mailing list, most of them deal with interrupt and event
> handler. When I concern about is the command function and task.
> If as you said command function is like C function and returns
> immediately, why does nesC need "asyn command"? Asynchrous command
> function executes immediately and preempt tasks.
> Is command function without "asyn" like task will be deferred for some
> time. For example,
> (1)Non asyn command function
> In component A, it call B.process(), which isn't defiedn as a asyn
> command. Then B. process() will be put into the task queue and executed
> later.
> (2) asyn command function
> Component A call B.process(), which is asyn command. Then B.process()
> execute immediately and preempt other tasks in the task queue.
>
> So my conclusion is that command function without "asyn" is like task,
> insead of C-function.
>
> Hui
>
> On Tue, 26 Sep 2006, Cory Sharp wrote:
>
> > Kang,
> >
> > Please search the TinyOS Help archives. It seems like we discuss this at
> > length at least once a month. A handy form for search ing is here:
> >
> > http://www.moteiv.com/community/TinyOS_Information
> >
> > Short answer: commands and events are just like C functions, they're not
> > tasks.
> >
> > Cory
> >
> > On 9/26/06, KANG HUI wrote:
> > >
> > > Dr. Levis:
> > > If a command has the following code
> > >
> > > command result_t A.p(){
> > > ...
> > > post TaskB();
> > > ...
> > > }
> > > If some module call A.p(), the execution sequence is : first A.p() is
> > > put into the task queue and runs to
> > > completion, and then TaskB will be executed until a later time. And the
> > > return value of A.p() is whether TaskB be put into the task queue.
> > > So command and event function is also two kinds of tasks. But a C-like
> > > function such as
> > > void f(){
> > > }
> > > is not a task and will return immediately.
> > > Is my understanding right? Please correct me. Thanks.
> > >
> > > Regards,
> > > Hui
> > >
> > > ___
> > > Tinyos-help mailing list
> > > Tinyos-help@Millennium.Berkeley.EDU
> > > https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> > >
> >
>
> ___
> Tinyos-help mailing list
> Tinyos-help@Millennium.Berkeley.EDU
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
>
>
> -
> Yahoo! Mail: gratis 1GB per i messaggi, antispam, antivirus, POP3

___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] Question about tasks in Tinyos 1.x

2006-09-27 Thread Philip Levis

On Sep 27, 2006, at 3:21 AM, Crif1102 wrote:


Hi all,
As Hui I don't understand the difference between async and sync...


Like Hui, you should read Tutorial 2 of TinyOS 2.x. :)

Phil

___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help