Dear Steve, Thanks a lot for your information!
(1) In TinyOS tutorial, it is said that "Hardware event handlers are executed in response to a hardware interrupt and also runs to completion, but may preempt the execution of a task or other hardware event handler. " (URL: http://www.tinyos.net/tinyos-1.x/doc/tutorial/lesson1.html). If "no platform implement nested interrupts", you're certainly right. Can anyone confirm this information? (2) To my understanding, the keyword "async" is used to specify a piece of code is an asynchronous operation, which means that "operations that occur without a regular or predictable time relation to other events." (URL: http://en.wikipedia.org/wiki/Asynchronous_operation). I think this meaning is lost when we call async command from task. Is it true that: (1) call async command; (2) call sync command; (3) signal async event; (4) signal sync event all equal to subroutine call. I also want to know the exact meaning of "a task post is an async operation", in Philip Levis's programming guide (I know the mechanism of deferred procedure call). (3) Got it. Thank you. Best regards, Yours, Zhifeng Lai -----Original Message----- From: Steve McKown [mailto:[EMAIL PROTECTED] Sent: Thursday, June 21, 2007 10:44 PM To: [email protected] Cc: Zhifeng Lai; 'David Gay'; 'Zhifeng Lai' Subject: Re: [Tinyos-help] FW: Consultation on nesC execution model. Hi, On Thursday 21 June 2007 05:15:26 am Zhifeng Lai wrote: > I have some confusion on nesC execution model: > > (1) Is it true that all the code is preemptable, except those contained > in atomic blocks? This isn't true, at least for TinyOS' use of nesC. Pre-emption in TInyOS is accomplished via hardware interrupts. AFAIK, no TinyOS platforms implement nested interrupts, so from a pre-emption standpoint an atomic block and a call graph executing under an ISR (interrupt service routine) are functionally equivalent. So, this means that only code not running in an atomic block and not running under an ISR is preemptible. A better way to say this is that code running in/under a task that is not in an atomic block is pre-emptable. > (2) What is the difference when we call async and sync command from > tasks? Nothing. A command using the 'async' modifier means that the command is safe to be called from async context, but it can still be called from non-async (task) context. A good example of this is seen in tos2's GeneralIO interface. Event signalling uses the same rules, but has practical differences in behavior. For example, most implementations of an interface defining async events will call them exclusively from async context. This means the signal handlers on the 'using' side of the interface wiring must have the async modifier and will be executed in async context as well. An example of this is GpioInterrupt's fired() event. > (3) Can events have more than one event handlers? Sure. Philip Levis' TinyOS Programming guide talks about fan-out. http://csl.stanford.edu/~pal/pubs/tinyos-programming.pdf All the best, Steve _______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
