Wireless sensor networks (WSNs) are used for intrusion detection and consist of low-power embedded devices running an operating system like TinyOS or Contiki. TinyOS uses an event-driven execution model with tasks and handlers, programs in nesC, a dialect of C, and Contiki uses a protothread model and is programmed in C. WSNs have leaf nodes that sense data and forward it to a base station either directly or through other leaf nodes.