Mobile Systems Richard Yang.

Slides:



Advertisements
Similar presentations
How to use TinyOS Jason Hill Rob Szewczyk Alec Woo David Culler An event based execution environment for Networked Sensors.
Advertisements

A System Architecture for Tiny Networked Devices
Threads, SMP, and Microkernels
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
Jason Hill, Robert Szewczyk, Alec Woo Spring 2000 TinyOS Operating System for Networked Sensors Networked SensorsSystem Structure Composing Components.
Tiny OS Optimistic Lightweight Interrupt Handler Simon Yau Alan Shieh CS252, CS262A, Fall The.
A System Architecture for Tiny Networked Devices Jason Hill U.C. Berkeley 9/22/2000.
Chapter 13 Embedded Systems
1 TinyOS Mohammad Rahimi CSCI599-Spring Motivation  The new class of distributed tiny devices  The new generation of software.
TinyOS Software Engineering Sensor Networks for the Masses.
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
Sensor Node Architecture Issues Stefan Dulman
1 Chapter 13 Embedded Systems Embedded Systems Characteristics of Embedded Operating Systems.
Spring 2000, 4/27/00 Power evaluation of SmartDust remote sensors CS 252 Project Presentation Robert Szewczyk Andras Ferencz.
ECE 526 – Network Processing Systems Design Network Processor Architecture and Scalability Chapter 13,14: D. E. Comer.
A System Architecture for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister
April 15, 2005TinyOS: A Component Based OSPage 1 of 27 TinyOS A Component-Based Operating System for Networked Embedded Systems Tom Bush Graduate College.
Low-Power Wireless Sensor Networks
Energy-Efficient Soft Real-Time CPU Scheduling for Mobile Multimedia Systems Wanghong Yuan, Klara Nahrstedt Department of Computer Science University of.
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
Overview of: System Architecture Directions for Networked Sensors John Kerwin CSE 291 Sensor Networks Paper by: Jason Hill, Robert Szewczyk, Alec Woo,
Dhanshree Nimje Smita Khartad
System Architecture Directions for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister Presented by Yang Zhao.
Reference: Ian Sommerville, Chap 15  Systems which monitor and control their environment.  Sometimes associated with hardware devices ◦ Sensors: Collect.
Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai.
Part 2 TinyOS and nesC Programming Selected slides from:
1 Mobile File Systems: Disconnected and Weakly Connected File Systems 3/29/2004 Richard Yang.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
1 Threads, SMP, and Microkernels Chapter Multithreading Operating system supports multiple threads of execution within a single process MS-DOS.
System Architecture Directions for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister Presenter: James.
Xiong Junjie Node-level debugging based on finite state machine in wireless sensor networks.
TinyOS Sandeep Gupta. Operating System (OS) What is an OS? Main functions  Process management  Memory management  Resource management Traditional OSs.
System Architecture Directions for Networked Sensors.
Time Management.  Time management is concerned with OS facilities and services which measure real time.  These services include:  Keeping track of.
Why does it need? [USN] ( 주 ) 한백전자 Background Wireless Sensor Network (WSN)  Relationship between Sensor and WSN Individual sensors are very limited.
1 Mobile Systems Richard Yang. 2 Admin. r Homework 4 m due Friday Dec. 8th.
Introduction to Operating Systems Concepts
INTRODUCTION TO WIRELESS SENSOR NETWORKS
Overview Motivation (Kevin) Thermal issues (Kevin)
Real-time Software Design
Adaptive Mobile Applications
Module 12: I/O Systems I/O hardware Application I/O Interface
Chapter 13: I/O Systems Modified by Dr. Neerja Mhaskar for CS 3SH3.
Jacob R. Lorch Microsoft Research
PROPELLER DISPLAY OF MESSAGE BY VIRTUAL LEDS
Simulation of Distributed Application and Protocols using TOSSIM
Credits: 3 CIE: 50 Marks SEE:100 Marks Lab: Embedded and IOT Lab
Chapter 2: System Structures
Operating System Structure
Real-time Software Design
Introduction to Microprocessors and Microcontrollers
Threads, SMP, and Microkernels
Operating Systems Chapter 5: Input/Output Management
Operating System Concepts
13: I/O Systems I/O hardwared Application I/O Interface
CS703 - Advanced Operating Systems
Lecture Topics: 11/1 General Operating System Concepts Processes
Lecture 4- Threads, SMP, and Microkernels
Language Processors Application Domain – ideas concerning the behavior of a software. Execution Domain – Ideas implemented in Computer System. Semantic.
Threads Chapter 4.
Chapter 5: I/O Systems.
Chapter 2: Operating-System Structures
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 2: Operating-System Structures
Operating System Overview
COMP755 Advanced Operating Systems
Module 12: I/O Systems I/O hardwared Application I/O Interface
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

Mobile Systems Richard Yang

Admin. Homework 4 due Friday Dec. 8th

Recap: J2ME and Windows CE/Mobile Scale down a popular programming environment to ease learning Use virtual machines to mask (some) device heterogeneity Use versioning to avoid using lowest common denominator

TinyOS http://www.tinyos.net/tinyos-1.x/doc/tutorial/

Hardware Assembled from off-the-shelf components 4Mhz, 8bit MCU (ATMEL) 512 bytes RAM, 8KB ROM Devices 900Mhz Radio (RF monolithics) 10-100 ft. range temperature sensor & light sensor LED outputs serial Port 1.5” x 1.5”

Schematic Diagram of a Mote

Sample Applications Active-badge-like location detection Sensor network monitoring periodically transmit node measurements to a base station forward data for other nodes that are out of range of the base station dynamically determine the correct routing topology for the network

Requirements Small foot print devices have limited memory and power resources Easy integration of hardware and software components think of a software component as a synthetic hardware components simulating the behavior of advanced hardware Many other requirements, e.g., robust operation should be reliable, and assist applications in surviving individual device failures

Example Application A simple TinyOS application which periodically reads in the light intensity value, computes a moving average, displays it on the LED How would you develop the system?

TinyOS: Components A tinyOS consists of one or more components linked together software components motivated by hardware component Each component specifies that it provides some interfaces allows other components to control it also uses some interfaces control other components

A uses interfaces I1 and I2 An interface declares a set of functions called commands that provider must implement and another set of functions called events that the interface user must implement A uses interfaces I1 and I2 I1 I2 commands events commands events B provides I1 C provides I2 C provides I3

Interface: Examples Timer.nc ADC.nc StdControl.nc interface StdControl {   command result_t init();   command result_t start();   command result_t stop(); } Timer.nc interface Timer { command result_t start( char type, uint32_t interval);   command result_t stop();   event result_t fired(); } ADC.nc interface ADC { async command result_t getdata();   async command result_t getContinuousData();   event result_t dataReady(uint 16_t data); }

Linking Components Two types of components: modules: individual components configurations : assemble components together, connecting interfaces (objects) used by components to interfaces (objects) provided by others

Example Application A simple TinyOS application which periodically reads in the light intensity value, computes a moving average, displays it on the LED See SenseTaskM.nc SenseTask.nc

TinyOS Component: Implementation Component contains: commands and event handlers can invoke lower level commands, but cannot block event handler can signal higher level signals while command cannot frame (storage) statically allocated, fixed sized to know memory requirement and avoid overhead of dynamic allocation Component Internal Tasks Internal State Commands Events

TinyOS Execution Model Concurrency model: only two threads long running tasks that can be interrupted by hardware event handlers Tasks perform the primary computation work commands and event handlers post tasks call lower level commands signal higher level events schedule other tasks within a component Each task is atomic with respect to other tasks run to completion, but can be preempted by events the task scheduler is a simple FIFO scheduler

Running tinyOS Program make mica ncc -o main.exe -target=mica SenseTask.nc avr-objcopy --output-target=srec main.exe main.srec Use uisp to install

A More Complete Sample Application Sensor network monitoring monitor temperature and light conditions periodically transmit measurements to a base station sensors can forward data for other sensors that are out of range of the base station dynamically determine the correct routing topology for the network

Internal Component Graph RFM Radio byte Radio Packet UART UART Packet I2C Temp Light Active Messages Clocks bit byte packet Ad hoc Routing Application application HW SW Hardware abstraction components, like the RFM radio component, map physical hardware into our component model. They translate hardware interrupts into events, and export commands to manipulate the individual I/O pins of the hardware. Synthetic hardware components simulate the behavior of advanced hardware. For example, the Radio Byte component shifts data into or out of the underlying RFM module, and signals when an entire byte has completed. High level software components perform control, routing, and all data transformations.

Message Send Transition Total propagation delay up the 5 layer radio communication stack is about 80 instructions Timing diagram of event propagation

Evaluation: Storage Scheduler only occupies 178 bytes Component Name Code Size (bytes) Data Size (bytes) Routing AM_dispatch AM_temperature AM_light AM RADIO_packet RADIO_byte RFM Light Temp UART UART_packet I2C 88 40 78 146 356 334 810 310 84 64 196 314 198 32 8 1 Processor_init TinyOS scheduler C runtime 172 178 82 30 16 Total 3450 226 Scheduler only occupies 178 bytes Complete application only requires 3 KB of instruction memory and 226 bytes of data (less than 50% of the 512 bytes available) Only processor_init, TinyOS scheduler, and C runtime are required

Evaluation: Timing Operations Cost (cycles) Time (µs) Normalized to byte copy Byte copy 8 2 1 Post an Event Call a Command Post a task to scheduler Context switch overhead 10 46 51 2.5 11.5 12.75 1.25 6 Interrupt (hardware cost) 9 2.25 Interrupt (software cost) 71 17.75

Mobile CPU Scheduling

Discussion What does CPU scheduling do in a traditional operating system? What (new) problems does CPU scheduling face in mobile computing?

CPU Power Consumption A major challenge of mobile CPU scheduling is to reduce power consumption CPU consumes 10%-30% of notebook power The power consumption rate P of a CMOS processor satisfies where k is a constant, C the capacitance of the circuit, f the CPU frequency, and V the voltage

CPU Power Consumption When the supply voltage is lower, charging/discharging time is longer; thus frequency should be lower Thus power consumption ~ O(V3) What does it imply?

Dynamic Voltage Scaling Dynamic Voltage Scaling (DVS) allows voltage to be dynamically adjusted to save power DVS-enabled processors, e.g., AMD (PowerNow!) http://www.amd.com/us-en/assets/content_type/DownloadableAssets/Power_Now2.pdf Intel (SpeedStep, XScale) Texas Instrument Transmata Discussion: what voltage to operate on? throughput

Dynamic Voltage Scaling Basic idea: determining voltage according to program response time requirement For normal applications, give reasonable response time For multimedia applications, use the deadline to determine voltage

multimedia applications Architecture multimedia applications monitoring requirements scheduling scheduler demand distribution profiler time constraint speed adaptor speed scaling CPU

Demand Prediction Online profiling and estimation: count number of cycles used by each job 1 CDF F(x) = P [X  x] cumulative probability Cmin=b0 b1 b2 br-1 br=Cmax

Demand distribution is stable or changes slowly Observations Demand distribution is stable or changes slowly

CPU Resource Allocation How many cycles to allocate to a multimedia job? Application should meet  percent of deadlines  each job meets deadline with probability   allocate C cycles, such that F (C ) =P [X  C ]   b1 b2 b0 br 1 br-1 cumulative probability F(x)  C

How Fast to Run the CPU? Assume the strategy is to run job i at a fix (also called uniform) speed Si Assume it needs Ci cycles during a time duration of Pi Fact: since power is a convex function of frequency, if a job needs C cycles in a period P, then the optimal frequency is C/P, namely the lowest constant frequency.

Why Not Uniform Speed? Intuitively, uniform speed achieves - minimum energy if use the allocated exactly However, jobs use cycles statistically - often complete before using up the allocated - potential to save more energy  stochastic DVS

Stochastic DVS For each job such that find speed Sx for each allocated cycle x time is 1/Sx and energy is (1 - F(x))S3x such that

Observation: speed up the processor with increasing clock cycles Example Speed Schedule cycle: speed: 100 MHz 200 MHz 400 MHz Job 1 2.5x106 cycles speed (MHz) 100 400 200 Job 2 1.2x106 cycles Observation: speed up the processor with increasing clock cycles

DVS A1 B1 A1 A1 A2 context switch Store speed for switched-out New speed for switched-in speed up within job switch back A1 B1 A1 speed A1 A2 execution

Extension to Linux kernel 2.4.18 Implementation Hardware: HP N5470 laptop Athlon CPU (300, 500, 600, 700, 800, 1000MHz) round speed schedule to upper bound system call process control block DVS modules PowerNow speed scaling Soft real-time scheduling standard Linux scheduler Extension to Linux kernel 2.4.18 716 lines of C code

Evaluation: Normalized Energy Reduces power consumption However, limited due to few speed options

Mobile File Systems

Discussion What challenges does the file system face in wireless/mobile environment?

The Problems Caused by Mobility Read miss stalls progress (the user has to stop working) Synchronization/consistency issues may need to synchronize multiple copies of the same file if multiple users, may need to solve consistency problems Heterogeneous device types each device has its own file systems and naming convention, e.g., digital camera, ipod

Approaches Read miss Synchronization/consistency issues explicit user file selection, e.g., MS briefcase automatic hoarding, e.g., CODA, SEER Synchronization/consistency issues keep modification logs and develop merge tools, e.g., Bayou efficient file comparisons and merging, e.g., rsync, LBFS Heterogeneous device types masks the differences , e.g., EnsemBlue

SEER: automatic prediction of related files to avoid user manual configuration of hoarding

SEER: A Predictive Hoarding System Views user activities as composed of projects than individual files Predicates files in a project and fetch them together Discussion: how do you predicate all of the files a project may use?

Basic Idea of SEER: Semantic Distance Quantifies user’s intuition about relationship between files smaller  closer in relation Infers relationship static (done by an external investigator), e.g., observes directory structure/membership observes naming convention #include in a program dynamic watches user’s behavior What is semantic distance : quantify user’s intuition about relationship between files

Lifetime Semantic Distance Looks at file open/close (not file content !!) Lifetime semantic distance: The lifetime semantic distance between an open of file A and an open of file B is defined as 0 if A has not been closed before B is opened and the number of intervening file opens (including the open of B) otherwise End up with multiple lifetime semantic distances between two events of two files needs distance between two files, not events uses geometric mean to convert to a single distance A B C D Time Sample file access sequence Semantic distance - AB , AC is 0 - AD is 3

Basic Idea of SEER: Clustering Algorithm Based on algorithm by Jarvis and Patrick Allows overlapping clusters Steps calculates n nearest neighbors for each file Phase 1: if two points (files here) have at least kn overlapping neighbors, combine their clusters into one Phase 2: if two points have more than kf but less than kn overlapping neighbors, overlap the clusters i.e. add each to the other cluster Relation Action kn ≤x kf≤x<kn x<kf Combine clusters Overlapping clusters No action Summary of clustering algorithm

Number of shared neighbors Example Seven files , A-G {A} {B} {C} {D} {E} {F} {G} Phase 1: {A, B}  {A, B, C} {D, E} {F, G}  {D,E,F, G} Phase 2: two pairs {A, C} {C, D} {A, C} : same cluster already {C, D}  overlap clusters Final result {A, B, C, D} {C,D, E, F,G} From To A B C D E F G A B C D E F G kn kf kn kf Number of shared neighbors

Using Both Lifetime Semantic Distance and the Input of External Investigator Essentially gives application specific info Example large directory distance => looser relationship subtract directory distance from shared neighbor count

Real World Anomalies: Special Cases Many special cases authors use a heuristic to solve each Shared libraries e.g. : library X might cause unwanted clustering Heuristic: files which represent more than a certain percentage of all references marked as “frequently-referenced” (1%) eliminate from calculation Number of special cases, and they use a heuristic for each. I’ll just take a couple

More Special Cases … Simultaneous access Critical files (e.g. : startup files) rarely accessed but important use heuristic and hoard special control file that specifies such files detect by names e.g. .login etc Temporary files (e.g. : in /tmp) transient and don’t depict correct relationship might displace other important files from n closest heuristic: ignore files in /tmp etc. completely Simultaneous access e.g. : read mail & compile code independent streams are intermixed ! maintain reference-history on a per-process basis

Scheduling of Multimedia Applications Earliest deadline first (EDF) scheduling - allocate cycle budget per job - execute job with earliest deadline and positive budget - charge budget by number of cycles consumed - preempt if budget is exhausted

Bayou: automatic conflict update

Bayou: Managing Update Conflicts Basic idea: application specific conflict detection and update Two mechanisms for automatic conflict detection and resolution dependency check merge procedure

Bayou Write Operation: An Example

Mobile file systems: dealing with low bandwidth: LBFS: efficient file comparison and merging

Motivation The CODA system assumes that modifications are kept as logs (CML) a user sends the logs to the servers to update If the storage of a client is limited, it may not be able to save logs then upon reconnection, the cache manager needs to find the difference between the stored file and its local cached copy same problem exists for the rsync tool ! Question: how to efficiently compare the differences of two remote files (when the network connection is slow)?

LBFS: Low-Bandwidth File System Break Files into chunks and transfer only modified chunks Fixed chunk size does not work well why?

Flexible Chunk Size Compute hash value of every 48 byte block if the hash value equals to a magic value, it is a chunk boundary