Announcements Reprogramming HW2: Due on 3/16 (Wed), 2:30pm Mat: - - PDF document

announcements
SMART_READER_LITE
LIVE PREVIEW

Announcements Reprogramming HW2: Due on 3/16 (Wed), 2:30pm Mat: - - PDF document

Middleware for Wireless Announcements Reprogramming HW2: Due on 3/16 (Wed), 2:30pm Mat: mobile code Hard deadline! Agilla: mobile agent Midterm Open book, note Chenyang Lu CSE 467S 1 Chenyang Lu CSE 467S 2


slide-1
SLIDE 1

Chenyang Lu CSE 467S 1

Announcements

  • HW2: Due on 3/16 (Wed), 2:30pm
  • Hard deadline!
  • Midterm
  • Open book, note

Chenyang Lu CSE 467S 2

Middleware for Wireless Reprogramming

  • Maté: mobile code
  • Agilla: mobile agent

Chenyang Lu CSE 467S 3

Motivation for Mobile Code

  • Need to reprogram sensors after deployment
  • Change parameters
  • Change/add/remove modules
  • Change whole program
  • Manual installation on a large number of nodes

is impractical

Chenyang Lu CSE 467S 4

Summary: Maté

  • Instruction Set
  • Concise: utilizes the least amount of network

bandwidth

  • Tailorable: can be modified for special operations
  • Virtual Machine
  • Small footprint: fits in rene2 (1KB data, 16KB code)
  • Resilient: cannot crash the mote
  • Energy: tradeoff between deployment and execution

Chenyang Lu CSE 467S 5

Limitations of (Just) Mobile Code

  • Whole network runs one application
  • Cannot adapt to changes in
  • Goals
  • Environment
  • Network
  • Lack coordination between nodes

Chenyang Lu CSE 467S 6

Mobile Agents : A Motivation Example

1 2 3 4

slide-2
SLIDE 2

Chenyang Lu CSE 467S 7

Agilla Approach

  • Agent mobility
  • Clone and move to designated physical

locations

  • Inter-agent coordination
  • Operations on local and remote tuple

spaces

Chenyang Lu CSE 467S 8

System Architecture

TinyOS

Node (1,1)

Tuplespace Neighbors

Agilla Middleware MICA2 Mote Agents TinyOS

Node (2,1)

Tuplespace Neighbors

Agilla Middleware MICA2 Mote Agents

migrate remote access Chenyang Lu CSE 467S 9

Location-Based Addressing

(3,1) (3,2) (3,3) (2,2) (1,1) (1,3)

clone(3,3) clone(3,1)

Fire Detection Agent

Chenyang Lu CSE 467S 10

Agent Migration

  • Two types of migration instructions:
  • Move: smove, wmove
  • Clone: sclone, wclone
  • Two variants of each:
  • Strong
  • Weak

move(3,4)

clone(4,6) clone(3,5)

Chenyang Lu CSE 467S 11

Tuplespace-based Coordination

  • Inter-agent coordination done through tuple spaces
  • Shared memory interface
  • Pattern matching using tuples
  • Shared locally, accessible remotely

Tuplespace

OUT(< string: fir> ,< loc: 1,1> ) IN(< type: string> ,< loc: 1,1> )

Chenyang Lu CSE 467S 12

Tuplespace Instructions

  • out: insert
  • in: remove
  • rd: read
  • inp: probing remove
  • rdp: probing read
  • rout: insert
  • rinp: probing remove
  • rrdp: probing read
  • rrdpg: probing group

read of all neighbors Local Remote Note: all are non- blocking, rrdpg saves results on heap blocking

slide-3
SLIDE 3

Chenyang Lu CSE 467S 13

Examples

Chenyang Lu CSE 467S 14

Example: Fire Tracking Agent

  • If a neighbor is on fire
  • Clone to all neighbors within 1.4 grid hops
  • f the fire
  • Periodically repeat to maintain dynamic

perimeter

  • Sleeps 1.25 – 6 seconds during each epoch

Chenyang Lu CSE 467S 15

Agilla Conclusions

  • New paradigm for programming sensor

networks

  • flexible coordination
  • adaptive and open software structure
  • reasonable performance
  • Demonstrated feasibility of mobile agents in

sensor networks

  • Todos
  • Better programming models
  • More real-world experience
  • Security

Chenyang Lu CSE 467S 16

Readings

  • P. Levis and D. Culler, “Maté: a Virtual Machine for Tiny

Networked Sensors.” ASPLOS, Dec 2002.

  • (Strongly recommend) C.-L. Fok, G.-C. Roman, and C. Lu, "Rapid

Development and Flexible Deployment of Adaptive Wireless Sensor Network Applications," ICDCS, June 2005.

  • Chien-Liang Fok, Gruia-Catalin Roman, and Chenyang Lu, "Mobile

Agent Middleware for Sensor Networks: An Application Case Study," IPSN/SPOTS, April 2005.

  • Agilla Project: http://www.cs.wustl.edu/mobilab/projects/agilla/

Chenyang Lu CSE 467S 17

Operating Systems

  • TinyOS
  • Real-time POSIX
  • Real-time schedulability analysis

Chenyang Lu CSE 467S 18

Real-Time POSIX

  • Standard of UNIX
  • Supported by many operating systems
  • Variants of UNIX
  • Linux
  • Many commercial RTOS, e.g., VxWorks
  • Windows provides similar services
slide-4
SLIDE 4

Chenyang Lu CSE 467S 19

To Be Covered

  • Supervisor mode
  • Process management
  • Scheduling
  • Race condition

Chenyang Lu CSE 467S 20

Supervisor mode

  • On processors with supervisor mode, you can do the

following only in supervisor (kernel) mode

  • Execute privileged instructions and access special hardware
  • Set real-time priority
  • Device driver
  • Access to a separate address space (the kernel space)
  • This is the mode in which the operating system usually runs.
  • Provide protective barriers between programs.
  • Prevent applications from corrupting OS data.

Chenyang Lu CSE 467S 21

Supervisor Mode (2)

  • Careful about memory access (e.g.,

pointers) when

  • programs run in supervisor mode
  • Or processor has no supervisor mode
  • Support supervisor mode?
  • SHARC, ATMEL: No
  • Pentium, ARM: Yes

Chenyang Lu CSE 467S 22

ARM supervisor mode

  • Use SWI instruction to enter

supervisor mode, similar to subroutine:

SWI CODE_1

  • Sets PC to 0x08.
  • Argument to SWI is passed to

supervisor mode code.

  • Saves CPSR in SPSR.

Chenyang Lu CSE 467S 23

Trap

  • Trap (software interrupt): an exception

generated by an instruction.

  • Ex. enter supervisor mode.
  • Ex. call a service routine
  • ARM uses SWI instruction for traps.
  • SHARC offers three levels of software

interrupts.

  • Called by setting bits in IRPTL register.

Chenyang Lu CSE 467S 24

Exception

  • Exception: internally detected error.
  • Exceptions are caused by instruction

execution

  • unpredictable
  • Build on top of interrupt mechanism.
  • Exceptions are usually prioritized and

vectorized.

slide-5
SLIDE 5

Chenyang Lu CSE 467S 25

Terms

  • Interrupt: generate by external devices
  • Exception: generate by CPU due to

software errors

  • Ex. div by 0
  • Trap: generate by software using

instructions (enter supervisor mode:

  • pen file, read from network etc.)