from simulation to execution from simulation to execution
play

From Simulation to Execution: From Simulation to Execution: on a - PowerPoint PPT Presentation

Computing Science From Simulation to Execution: From Simulation to Execution: on a Certain Programming Paradigm for on a Certain Programming Paradigm for Reactive Systems Reactive Systems Pawel Gburzynski Department of Computing Science


  1. Computing Science From Simulation to Execution: From Simulation to Execution: on a Certain Programming Paradigm for on a Certain Programming Paradigm for Reactive Systems Reactive Systems Pawel Gburzynski Department of Computing Science University of Alberta & Olsonet Communications Wisla, November 2006 1

  2. Computing Science SMURPH A System for Modeling Unslotted Real-time A System for Modeling Unslotted Real-time PHenomena PHenomena A B C t a T 2t a Wisla, November 2006 2

  3. Computing Science Objects station link port ... processes packets, traffic patterns, mailboxes, timers, ... Wisla, November 2006 3

  4. Computing Science A sample code fragment mailbox DBuffer (Packet*) { mailbox DBuffer (Packet*) { void outItem (Packet *p) { delete p; }; void outItem (Packet *p) { delete p; }; void setup () { setLimit (MAX_Long); }; void setup () { setLimit (MAX_Long); }; }; }; ... ... station PMonitor : PMonitorInterface { station PMonitor : PMonitorInterface { DBuffer *DB; DBuffer *DB; void setup () { void setup () { PMonitorInterface::configure (); PMonitorInterface::configure (); DB = create DBuffer; DB = create DBuffer; }; }; }; }; Wisla, November 2006 4

  5. Computing Science A process process SlotGen (PMonitor) { process SlotGen (PMonitor) { Port *ORing; Port *ORing; DBuffer *DB; DBuffer *DB; SMarker *SMark; SMarker *SMark; int SCount; int SCount; void setup () { void setup () { ORing = S->ORing; ORing = S->ORing; DB = S->DB; DB = S->DB; SMark = create SMarker; SMark = create SMarker; SMark->fill (NONE, NONE, SlotML); SMark->fill (NONE, NONE, SlotML); setFlag (SMark->Flags, TOKEN); setFlag (SMark->Flags, TOKEN); SCount = 0; SCount = 0; }; }; states {GenSlot, XDone}; states {GenSlot, XDone}; perform; perform; }; }; Wisla, November 2006 5

  6. Computing Science A process SlotGen::perform { SlotGen::perform { state GenSlot: state GenSlot: if (DB->nonempty ()) if (DB->nonempty ()) terminate; terminate; else { else { SMark->Number = SCount; SMark->Number = SCount; ORing->transmit (SMark, XDone); ORing->transmit (SMark, XDone); } } state XDone: state XDone: ORing->stop (); ORing->stop (); ++SCount; ++SCount; Timer->wait (SegmWindow, GenSlot); Timer->wait (SegmWindow, GenSlot); }; }; Wisla, November 2006 6

  7. Computing Science SMURPH -> SIDE Interface to outside world: mailboxes can be Interface to outside world: mailboxes can be mapped to devices or sockets. mapped to devices or sockets. Virtual time mapped to real time. This simply Virtual time mapped to real time. This simply means that Timer delays are “actual.” means that Timer delays are “actual.” Wisla, November 2006 7

  8. Computing Science A natural paradigm Mailbox Sensor { Mailbox Actuator { Mailbox Sensor { Mailbox Actuator { … … … … int getValue (); int setValue (); int getValue (); int setValue (); … … … … } } } } Sensor *sns; Sensor *sns; … … sns->wait (RECEIVE, …); sns->wait (RECEIVE, …); … … Wisla, November 2006 8

  9. Computing Science How do we program small devices? From scratch: theoretically most efficient, From scratch: theoretically most efficient, practically tedious and/or messy (certainly not very practically tedious and/or messy (certainly not very effective). effective). Some platforms do exist, e.g., TinyOS. Unfortunately, Some platforms do exist, e.g., TinyOS. Unfortunately, they are quite a bit into consortium-type solutions. they are quite a bit into consortium-type solutions. What is the problem? Why can't we simply use Java What is the problem? Why can't we simply use Java (just kidding)? (just kidding)? Wisla, November 2006 9

  10. Computing Science The inspiring project To implement a simple wireless application on a card- To implement a simple wireless application on a card- sized microcontrolled device. sized microcontrolled device. Two stages: Two stages: ● High-level design and virtual implementation in ● High-level design and virtual implementation in SMURPH – to verify the concept and test SMURPH – to verify the concept and test performance. performance. ● The port of SMURPH code to the micro (by hand). ● The port of SMURPH code to the micro (by hand). Wisla, November 2006 10

  11. Computing Science Multiple processes/threads code shared, ROM (flash) code shared, ROM (flash) data needed anyway data needed anyway x gets in the way stack gets in the way stack How to have threads without a stack for each of them? How to have threads without a stack for each of them? E.g., TinyOS has no threads, only: E.g., TinyOS has no threads, only: ● callbacks (event handlers) and ● callbacks (event handlers) and ● “tasks” (non-preemptible chunks of code) ● “tasks” (non-preemptible chunks of code) Wisla, November 2006 11

  12. Computing Science A thread in PicOS process (sniffer, sess_t) char c; entry (RC_TRY) data->packet = tcv_rnp (RC_TRY, efd); data->length = tcv_left (packet); entry (RC_PASS) if (data->user != US_READY) { wait (&data->user, RC_PASS); delay (1000, RC_LOCKED); release; } ... entry (RC_LOCKED) ... entry (RC_ENP) tcv_endp (data->packet); signal (&data->packet); proceed (RC_TRY); endprocess (1) Wisla, November 2006 12

  13. Computing Science PicOS's footprint process process process process process process process process RAM private data shared stack ● 20 bytes of RAM per process ● 64 bytes of (global) stack goes a long way ● we have a non-trivial mesh system based on MSP430F148 (with 2KB of RAM per node) Wisla, November 2006 13

  14. Computing Science TCV plugin model application TARP MAC application TARP MAC TCP/IP? API plugs TCP/IP? pluggable transceiver interface (TCV) pluggable transceiver interface (TCV) phy the kernel the kernel the micro radio radio the micro radio radio Wisla, November 2006 14

  15. Computing Science Plugin interface preprocessing upon reception typedef struct { int (*tcv_ope) (int, int, ...); how to open a session int (*tcv_clo) (int, int); how to close a session int (*tcv_rcv) (int, address, int, int*, tcvadp_t*); int (*tcv_frm) (address, int, tcvadp_t*); int (*tcv_out) (address); application packet boundary int (*tcv_xmt) (address); preprocessing for output int (*tcv_tmt) (address); after packet transmission int tcv_info; on timeout } tcvplug_t; Wisla, November 2006 15

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend