[Tinyos-help] Can events preempt tasks?

Ravi Prasad ravi4edu at yahoo.com
Mon Jul 3 21:37:08 PDT 2006


Make an application as follows:

1. Implement a task 
        task free_run_timer(){
            a. initiate a  _free_  runing timer to count.
            b. wait a fixed amount of time.
            c. stop timer.
          d. Read and send the value of timer/counter to radio/uart.
        }
**Do not use any atomic statement in this task.

schedule a timer to post this task periodically.



2. Implement an event which is having a fixed delay in it. A short cut is to use the UART as an interrupt source. Everytime you send a character to mote from a PC by serial port it will generate an interrupt and thus an event.Remember to use the uart/radio interface in your application and start it properly.


Now if there is no event generated (do not send any radio or UART packet to mote) then the counter value will be same every time. When you generate an event(possibly by sending a uart packet) you can easily see the counter value to be changed which proves the task was preemted to serve the event.
**Probably you will have to genererate a series of events so that few of them fall inside the time when task is running.


Chalermphol Thammapalerd <t.chalermphol at gmail.com> wrote: Hi,
  
 I tried to prove one of the TinyOS concept, "Events preempt tasks, tasks do not", by using external event to preempt unfinished task.
 However, the task is not seem to be preempted at all.
 Are there any example(s) that prove this concept?
  
 Regards,
 Chalermphol
 _______________________________________________
Tinyos-help mailing list
Tinyos-help at Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20060703/c8e3b794/attachment.htm


More information about the Tinyos-help mailing list