Towards Verifying Android Apps for the Absence of No-Sleep Energy Bugs

Size: px
Start display at page:

Download "Towards Verifying Android Apps for the Absence of No-Sleep Energy Bugs"

Transcription

1 Towards Verifying Android Apps for the Absence of No-Sleep Energy Bugs Panagiotis Vekris Ranjit Jhala, Sorin Lerner, Yuvraj Agarwal University of California, San Diego 1

2 2

3 Software Energy Bugs 3

4 Software Energy Bugs 4

5 Power Manager Concept Opportunistic suspend WakeLock API App developer directives Keep a device component awake 5

6 WakeLock Use Lock Based Mechanism PowerManager pm = getsystemservice(power); WakeLock l = pm.newwakelock( SCREEN ); //... screen stays on... 6

7 WakeLock Use Lock Based Mechanism PowerManager pm = getsystemservice(power); WakeLock l = pm.newwakelock( SCREEN ); //... screen stays on... No-sleep bugs Misuse of WakeLock API Screen on indefinitely Screen Awake => 25% battery drain per hour [Pathak 12] 7

8 Static Analysis Track No-Sleep Bugs Pathak [MobiSys 12] Reaching definitions dataflow analysis Detect known instances & find new ones Our Work Define policies => Verify absence of bug Track asynchronous calls Precise dataflow analysis 8

9 Activity A screen to interact with Application Component Building block Entry point Stack Model Top of stack = visible activity 9

10 Activity States oncreate() Created/ Background onforeground() onbackground() Foreground Callbacks Called by system on state transitions 10

11 oncreate() { Create a WakeLock super.oncreate(); Associate with screen // setting up l = newwakelock( SCREEN ); } onforeground() onbackground() 11

12 oncreate() { super.oncreate(); // setting up l = newwakelock( SCREEN ); } onforeground() { //... } Acquire WakeLock l onbackground() 12

13 oncreate() { super.oncreate(); // setting up l = newwakelock( SCREEN ); } onforeground() { //... } onbackground() On Foreground with Screen WakeLock held 13

14 oncreate() { super.oncreate(); // setting up l = newwakelock( SCREEN ); } onforeground() { //... } onbackground() { //... } Release WakeLock l 14

15 oncreate() { super.oncreate(); // setting up l = newwakelock( SCREEN ); } onforeground() { //... } onbackground() { //... } Correct Use At Background with Screen WakeLock released 15

16 oncreate() { super.oncreate(); // setting up l = newwakelock(cpu); } izen Lite V2.3 Acquire CPU WakeLock //unimplemented onforeground(); Application in background //unimplenented onbackground(); 16

17 oncreate() { super.oncreate(); // setting up l = newwakelock(cpu); } izen Lite V2.3 Acquire CPU WakeLock //unimplemented onforeground(); //unimplenented onbackground(); Application in background holds CPU WakeLock 17

18 oncreate() { super.oncreate(); // setting up l = newwakelock(cpu); } izen Lite V2.3 Acquire CPU WakeLock //unimplemented onforeground(); //unimplenented onbackground(); Application in background holds CPU WakeLock without doing useful work Incorrect Use 18

19 Policies Rule Invisible Activities should not hold resources Policy Activity.onBackground( ) should release all WakeLocks 19

20 Policies Rule Invisible Activities should not hold resources Component Policy Activity.onBackground( ) should release all WakeLocks 20

21 Policies Rule Invisible Activities should not hold resources Callback Policy Activity.onBackground( ) should release all WakeLocks 21

22 Policies Rule Invisible Activities should not hold resources Policy Activity.onBackground( ) should release all WakeLocks Expected State 22

23 Policies WakeLocks Used in any component - Not only Activities Their effects cross component boundaries General policies Component Callback Expected WakeLock state We defined policies for basic components Conservative for the rest Static Analysis to enforce them 23

24 Tool Overview Uses a precise Dataflow algorithm [RHS 95] State: Set of WakeLocks that may be held at given program point Validate Check if state complies to policies 24

25 How our tool works onforeground() { } l = newwakelock(cpu); if (random() % 2 == 0) Connection point l = newwakelock(cpu) random() % 2 == 0 onbackground() { if (random() % 2 == 0) } random() % 2 == 0 25

26 State: l = newwakelock(cpu) WakeLocks that may be held. Initially empty set random() % 2 == 0 random() % 2 == 0 26

27 State: l = newwakelock(cpu) Annotation: l -> CPU random() % 2 == 0 l is associated with CPU random() % 2 == 0 27

28 State: l = newwakelock(cpu) Annotation: l -> CPU random() % 2 == 0 State is propagated to both branches random() % 2 == 0 28

29 State: l = newwakelock(cpu) random() % 2 == 0 Annotation: l -> CPU random() % 2 == 0 29

30 State: l = newwakelock(cpu) random() % 2 == 0 random() % 2 == 0 Annotation: l -> CPU Virtual method call to acquire Performed on WakeLock object l 30

31 State: l = newwakelock(cpu) random() % 2 == 0 Annotation: A l -> CPU random() % 2 == 0 A U { l } 31

32 State: l = newwakelock(cpu) random() % 2 == 0 Annotation: l -> CPU random() % 2 == 0 Acquire introduces l to set 32

33 State: l = newwakelock(cpu) random() % 2 == 0 Annotation: A l -> CPU B random() % 2 == 0 Join Statement A B 33

34 State: l = newwakelock(cpu) random() % 2 == 0 Annotation: l -> CPU random() % 2 == 0 Union of input sets 34

35 State: l = newwakelock(cpu) random() % 2 == 0 Annotation: A l -> CPU random() % 2 == 0 A-{ l } 35

36 State: l = newwakelock(cpu) random() % 2 == 0 Annotation: l -> CPU random() % 2 == 0 Release removes l from set Union of input sets 36

37 State: l = newwakelock(cpu) random() % 2 == 0 Annotation: l -> CPU random() % 2 == 0 WakeLock l may be held at the end of the code 37

38 Path Sensitivity //... critical operation if (l.isheld()) //... Wakelock released l.isheld() true false 38

39 Path Sensitivity l.isheld() true false l is not held Remove it from set State empty in the end 39

40 Context Sensitive Method Calls { l } myrelease(); myrelease() { { } if (l.isheld()) { l } } myrelease(); return; { l } A A-{ l } myrelease() If l is held in { the before calling if (l.isheld()) myrelease } A Method Summary return; It will be released after A-{ l } 40

41 Context Sensitive Method Calls { l } myrelease(); { } { l } myrelease(); { l } A myrelease() { if (l.isheld()) return; } A-{ l } 41

42 Handling Asynchrony Intent calls Asynchronous messages among components Threaded execution Java Threads Posted on Message Queue (Android)

43 Handling Asynchrony Component A Component B start(b); 43

44 Handling Asynchrony Component A Component B WakeLock set is preserved at component call start(b); Empty state is propagated back to caller component 44

45 Handling Asynchrony Component A start(b); Component B Component A exits in released state So does Component B 45

46 Handling Asynchrony Component A Component B start(b); Component B does not operate on WakeLock l 46

47 Handling Asynchrony Component A Component B start(b); Component A exits with released state Component B does not operate on WakeLock l Policies will not be checked against it 47

48 Handling Asynchrony Component Helper Thread { } { } Start(); Race Condition {l<async>} {l<async>} Release does not remove asynchronously acquired lock 48

49 Handling Asynchrony Component Helper Thread { } { } Start(); Race Condition {l<async>} {l<async>} Policy violated 49

50 Handling Asynchrony Component Helper Thread { } { } Start(); Race Condition { } {l<async>} 50

51 Tool Workflow Apk (Dalvik Bytecode Java Bytecode) 740 apps with wakelocks (out of 2718) Ded/Dex2jar Input to WALA/ our tool Retargeted Java Bytecode Optimized Java Bytecode 328 correctly decompiled Soot 51

52 Analysis Results for 328 apps No Policy Violations Policy Violations 44% 56% Many bugs in real apps or Too imprecise analysis Manual inspection of 31 violating apps 52

53 True Positives Apps confirmed to contain a bug: 14 of 31 Lifecycle Abuse 10 Incorrect release conditions Not all paths released

54 False Positives Correct apps flagged as buggy: 17 of 31 Complex release conditions Too strict policies 7 Unresolved Intent calls Wrapper with parameter Unrecognized callback

55 Soundness WALA Conservative at handling exception edges Foo() {... a.f; Null pointer Exception Edge Keep analysis precise: Exception edges bypass release operations }... return; Kill state over exception edges 56

56 Future work Soundness Exception edges Precision Add path sensitivity Asynchronous calls -> precise points-to analysis Refine policies Retarget Dalvik effectively 57

57 Conclusion No-sleep bugs are real We presented a tool that: Uses static analysis Guarantees for absence of no-sleep bugs Tracks asynchronous calls 58

Understanding and Detecting Wake Lock Misuses for Android Applications

Understanding and Detecting Wake Lock Misuses for Android Applications Understanding and Detecting Wake Lock Misuses for Android Applications Artifact Evaluated by FSE 2016 Yepang Liu, Chang Xu, Shing-Chi Cheung, and Valerio Terragni Code Analysis, Testing and Learning Research

More information

Understanding and Detecting Wake Lock Misuses for Android Applications

Understanding and Detecting Wake Lock Misuses for Android Applications Understanding and Detecting Wake Lock Misuses for Android Applications Artifact Evaluated Yepang Liu, Chang Xu, Shing-Chi Cheung, and Valerio Terragni Code Analysis, Testing and Learning Research Group

More information

Lecture 3 Android Internals

Lecture 3 Android Internals Lecture 3 Android Internals This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or

More information

Android System Power and Performance Analyzer

Android System Power and Performance Analyzer Android System Power and Performance Analyzer 1 Diraj H S, 2 Sneha.N.Shanbhag, 3 Rajashekar Murthy S 1 Student, 2 Student, 3 Associate Professor Department of information science Engineering, Rashtreeya

More information

Android Internals. Lecture 3. Operating Systems Practical. 19 October 2016

Android Internals. Lecture 3. Operating Systems Practical. 19 October 2016 Android Internals Lecture 3 Operating Systems Practical 19 October 2016 This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.

More information

Lecture 2 Android SDK

Lecture 2 Android SDK Lecture 2 Android SDK This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a

More information

Minds-on: Android. Session 2

Minds-on: Android. Session 2 Minds-on: Android Session 2 Paulo Baltarejo Sousa Instituto Superior de Engenharia do Porto 2016 Outline Activities UI Events Intents Practice Assignment 1 / 33 2 / 33 Activities Activity An activity provides

More information

Overview. CMSC 330: Organization of Programming Languages. Concurrency. Multiprocessors. Processes vs. Threads. Computation Abstractions

Overview. CMSC 330: Organization of Programming Languages. Concurrency. Multiprocessors. Processes vs. Threads. Computation Abstractions CMSC 330: Organization of Programming Languages Multithreaded Programming Patterns in Java CMSC 330 2 Multiprocessors Description Multiple processing units (multiprocessor) From single microprocessor to

More information

WakeScope: Runtime WakeLock Anomaly Management Scheme for Android Platform

WakeScope: Runtime WakeLock Anomaly Management Scheme for Android Platform WakeScope: Runtime WakeLock Anomaly Management Scheme for Android Platform Kwanghwan Kim, Hojung Cha Department of Computer Science Yonsei University Seoul, Korea {kwanghwan, hjcha}@cs.yonsei.ac.kr ABSTRACT

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Multithreading Multiprocessors Description Multiple processing units (multiprocessor) From single microprocessor to large compute clusters Can perform multiple

More information

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University CS 333 Introduction to Operating Systems Class 3 Threads & Concurrency Jonathan Walpole Computer Science Portland State University 1 Process creation in UNIX All processes have a unique process id getpid(),

More information

Repairing crashes in Android Apps. Shin Hwei Tan Zhen Dong Xiang Gao Abhik Roychoudhury National University of Singapore

Repairing crashes in Android Apps. Shin Hwei Tan Zhen Dong Xiang Gao Abhik Roychoudhury National University of Singapore Repairing crashes in Android Apps Shin Hwei Tan Zhen Dong Xiang Gao Abhik Roychoudhury National University of Singapore Android Repair System Criteria for Android repair system: Could be used by any smartphone

More information

ios vs Android By: Group 2

ios vs Android By: Group 2 ios vs Android By: Group 2 The ios System Memory Section A43972 Delta Core OS Layer Core Services Layer Media Layer CoCoa Touch Layer Memory Section A43972 Delta Aaron Josephs Core OS Layer - Core OS has

More information

Running. Time out. Event wait. Schedule. Ready. Blocked. Event occurs

Running. Time out. Event wait. Schedule. Ready. Blocked. Event occurs Processes ffl Process: an abstraction of a running program. ffl All runnable software is organized into a number of sequential processes. ffl Each process has its own flow of control(i.e. program counter,

More information

Detecting Data Races in Multi-Threaded Programs

Detecting Data Races in Multi-Threaded Programs Slide 1 / 22 Detecting Data Races in Multi-Threaded Programs Eraser A Dynamic Data-Race Detector for Multi-Threaded Programs John C. Linford Slide 2 / 22 Key Points 1. Data races are easy to cause and

More information

L.C.Smith. Privacy-Preserving Offloading of Mobile App to the Public Cloud

L.C.Smith. Privacy-Preserving Offloading of Mobile App to the Public Cloud Privacy-Preserving Offloading of Mobile App to the Public Cloud Yue Duan, Mu Zhang, Heng Yin and Yuzhe Tang Department of EECS Syracuse University L.C.Smith College of Engineering 1 and Computer Science

More information

Trust, but Verify. Two-Phase Typing for Dynamic Languages. Panagiotis Vekris, Benjamin Cosman, Ranjit Jhala. University of California, San Diego

Trust, but Verify. Two-Phase Typing for Dynamic Languages. Panagiotis Vekris, Benjamin Cosman, Ranjit Jhala. University of California, San Diego Trust, but Verify Two-Phase Typing for Dynamic Languages Panagiotis Vekris, Benjamin Cosman, Ranjit Jhala University of California, San Diego Scripting Languages Then Perl is the duct tape of the Internet.

More information

Ripple: Reflection Analysis for Android Apps in Incomplete Information Environments

Ripple: Reflection Analysis for Android Apps in Incomplete Information Environments Ripple: Reflection Analysis for Android Apps in Incomplete Information Environments Yifei Zhang, Tian Tan, Yue Li and Jingling Xue Programming Languages and Compilers Group University of New South Wales

More information

CS260 Intro to Java & Android 04.Android Intro

CS260 Intro to Java & Android 04.Android Intro CS260 Intro to Java & Android 04.Android Intro Winter 2015 Winter 2015 CS260 - Intro to Java & Android 1 Android - Getting Started Android SDK contains: API Libraries Developer Tools Documentation Sample

More information

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi ACTIVITY, FRAGMENT, NAVIGATION Roberto Beraldi Introduction An application is composed of at least one Activity GUI It is a software component that stays behind a GUI (screen) Activity It runs inside the

More information

The Dining Philosophers Problem CMSC 330: Organization of Programming Languages

The Dining Philosophers Problem CMSC 330: Organization of Programming Languages The Dining Philosophers Problem CMSC 0: Organization of Programming Languages Threads Classic Concurrency Problems Philosophers either eat or think They must have two forks to eat Can only use forks on

More information

Lecture 1 - Introduction to Android

Lecture 1 - Introduction to Android Lecture 1 - Introduction to Android This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/

More information

2017 Pearson Educa2on, Inc., Hoboken, NJ. All rights reserved.

2017 Pearson Educa2on, Inc., Hoboken, NJ. All rights reserved. Operating Systems: Internals and Design Principles Chapter 4 Threads Ninth Edition By William Stallings Processes and Threads Resource Ownership Process includes a virtual address space to hold the process

More information

Another difference is that the kernel includes only the suspend to memory mechanism, and not the suspend to hard disk, which is used on PCs.

Another difference is that the kernel includes only the suspend to memory mechanism, and not the suspend to hard disk, which is used on PCs. 9. Android is an open-source operating system for mobile devices. Nowadays, it has more than 1.4 billion monthly active users (statistic from September 2015) and the largest share on the mobile device

More information

Kernel hacking su Android. Better Embedded Andrea Righi

Kernel hacking su Android. Better Embedded Andrea Righi Kernel hacking su Android Agenda Overview Android Programming Android Power Management Q/A Overview What is Android OS? Linux kernel Android patches Bionic libc Dalvik VM (Java Virtual Machine) Application

More information

EECS 481 Software Engineering Exam #1. You have 1 hour and 20 minutes to work on the exam.

EECS 481 Software Engineering Exam #1. You have 1 hour and 20 minutes to work on the exam. EECS 481 Software Engineering Exam #1 Write your name and UM uniqname on the exam. There are ten (10) pages in this exam (including this one) and seven (7) questions, each with multiple parts. Some questions

More information

CMSC 330: Organization of Programming Languages. The Dining Philosophers Problem

CMSC 330: Organization of Programming Languages. The Dining Philosophers Problem CMSC 330: Organization of Programming Languages Threads Classic Concurrency Problems The Dining Philosophers Problem Philosophers either eat or think They must have two forks to eat Can only use forks

More information

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University CS 333 Introduction to Operating Systems Class 3 Threads & Concurrency Jonathan Walpole Computer Science Portland State University 1 The Process Concept 2 The Process Concept Process a program in execution

More information

Ariadnima - Android Component Flow Reconstruction and Visualization

Ariadnima - Android Component Flow Reconstruction and Visualization 2017 IEEE 31st International Conference on Advanced Information Networking and Applications Ariadnima - Android Component Flow Reconstruction and Visualization Dennis Titze, Konrad Weiss, Julian Schütte

More information

Android Fundamentals - Part 1

Android Fundamentals - Part 1 Android Fundamentals - Part 1 Alexander Nelson September 1, 2017 University of Arkansas - Department of Computer Science and Computer Engineering Reminders Projects Project 1 due Wednesday, September 13th

More information

Advanced RbScript. by Thomas Tempelmann. Thomas Tempelmann RbScript 201

Advanced RbScript. by Thomas Tempelmann. Thomas Tempelmann RbScript 201 Advanced RbScript by Thomas Tempelmann Advanced RbScript Topics handled in this session First part Pausing a script that is waiting for an event using a semaphore Killing a thread that is suspended by

More information

Amandroid: A Precise and General Inter-component Data Flow Analysis Framework for Security Vetting of Android Apps

Amandroid: A Precise and General Inter-component Data Flow Analysis Framework for Security Vetting of Android Apps 1 Amandroid: A Precise and General Inter-component Data Flow Analysis Framework for Security Vetting of Android Apps FENGGUO WEI, University of South Florida SANKARDAS ROY, Bowling Green State University

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Threads Synchronization Refers to mechanisms allowing a programmer to control the execution order of some operations across different threads in a concurrent

More information

Introduction to OS Synchronization MOS 2.3

Introduction to OS Synchronization MOS 2.3 Introduction to OS Synchronization MOS 2.3 Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Mahmoud El-Gayyar / Introduction to OS 1 Challenge How can we help processes synchronize with each other? E.g., how

More information

DefDroid: Towards a More Defensive Mobile OS Against Disruptive App Behavior

DefDroid: Towards a More Defensive Mobile OS Against Disruptive App Behavior http://defdroid.org DefDroid: Towards a More Defensive Mobile OS Against Disruptive App Behavior Peng (Ryan) Huang, Tianyin Xu, Xinxin Jin, Yuanyuan Zhou UC San Diego Growing number of (novice) app developers

More information

Summarizing Control Flow of Callbacks for Android API Methods

Summarizing Control Flow of Callbacks for Android API Methods Summarizing Control Flow of Callbacks for Android API Methods Danilo Dominguez Perez and Wei Le Iowa State University {danilo0, weile}@iastate.edu ABSTRACT Ensuring the reliability and security of Android

More information

Introduction to Android

Introduction to Android Introduction to Android Ambient intelligence Teodoro Montanaro Politecnico di Torino, 2016/2017 Disclaimer This is only a fast introduction: It is not complete (only scrapes the surface) Only superficial

More information

Computing Approximate Happens-Before Order with Static and Dynamic Analysis

Computing Approximate Happens-Before Order with Static and Dynamic Analysis Department of Distributed and Dependable Systems Technical report no. D3S-TR-2013-06 May 7, 2018 Computing Approximate Happens-Before Order with Static and Dynamic Analysis Pavel Parízek, Pavel Jančík

More information

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) Lecture 3: Android Life Cycle and Permission Entire Lifetime An activity begins its lifecycle when entering the oncreate() state If not interrupted

More information

Mobile and Ubiquitous Computing: Android Programming (part 1)

Mobile and Ubiquitous Computing: Android Programming (part 1) Mobile and Ubiquitous Computing: Android Programming (part 1) Master studies, Winter 2015/2016 Dr Veljko Pejović Veljko.Pejovic@fri.uni-lj.si The World of Android The Android Platform A mobile operating

More information

UnCovert: Evaluating thermal covert channels on Android systems. Pascal Wild

UnCovert: Evaluating thermal covert channels on Android systems. Pascal Wild UnCovert: Evaluating thermal covert channels on Android systems Pascal Wild August 5, 2016 Contents Introduction v 1: Framework 1 1.1 Source...................................... 1 1.2 Sink.......................................

More information

SYNCHRONIZATION M O D E R N O P E R A T I N G S Y S T E M S R E A D 2. 3 E X C E P T A N D S P R I N G 2018

SYNCHRONIZATION M O D E R N O P E R A T I N G S Y S T E M S R E A D 2. 3 E X C E P T A N D S P R I N G 2018 SYNCHRONIZATION M O D E R N O P E R A T I N G S Y S T E M S R E A D 2. 3 E X C E P T 2. 3. 8 A N D 2. 3. 1 0 S P R I N G 2018 INTER-PROCESS COMMUNICATION 1. How a process pass information to another process

More information

application components

application components What you need to know for Lab 1 code to publish workflow application components activities An activity is an application component that provides a screen with which users can interact in order to do something,

More information

Virtual Machine Design

Virtual Machine Design Virtual Machine Design Lecture 4: Multithreading and Synchronization Antero Taivalsaari September 2003 Session #2026: J2MEPlatform, Connected Limited Device Configuration (CLDC) Lecture Goals Give an overview

More information

Lecture 6: Android XML, Inversion of Control, Timers (Handlers), Activity

Lecture 6: Android XML, Inversion of Control, Timers (Handlers), Activity 1 / 31 Lecture 6: Android XML, Inversion of Control, Timers (Handlers), Activity Engineering Design with Embedded Systems Patrick Lam University of Waterloo January 18, 2013 2 / 31 Housekeeping: Tutorials

More information

Amandroid: A Precise and General Inter-component Data Flow Analysis Framework for Security Vetting of Android Apps

Amandroid: A Precise and General Inter-component Data Flow Analysis Framework for Security Vetting of Android Apps Amandroid: A Precise and General Inter-component Data Flow Analysis Framework for Security Vetting of Android Apps FENGGUO WEI, University of South Florida SANKARDAS ROY, Bowling Green State University

More information

Categorization and Detection of Energy Bugs and Application Tail Energy Bugs in Smartphones

Categorization and Detection of Energy Bugs and Application Tail Energy Bugs in Smartphones Categorization and Detection of Energy Bugs and Application Tail Energy Bugs in Smartphones by Abdul Muqtadir Abbasi A thesis presented to the University of Waterloo in fulfillment of the thesis requirement

More information

Interoperation of tasks

Interoperation of tasks Operating systems (vimia219) Interoperation of tasks Tamás Kovácsházy, PhD 4 th topic, Implementation of tasks, processes and threads Budapest University of Technology and Economics Department of Measurement

More information

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology Mobile Application Development Produced by David Drohan (ddrohan@wit.ie) Department of Computing & Mathematics Waterford Institute of Technology http://www.wit.ie Android Anatomy Android Anatomy 2! Agenda

More information

Bugs in software. Using Static Analysis to Find Bugs. David Hovemeyer

Bugs in software. Using Static Analysis to Find Bugs. David Hovemeyer Bugs in software Programmers are smart people We have good techniques for finding bugs early: Unit testing, pair programming, code inspections So, most bugs should be subtle, and require sophisticated

More information

Refinement Types for TypeScript

Refinement Types for TypeScript Refinement Types for TypeScript Panagiotis Vekris Benjamin Cosman Ranjit Jhala University of California, San Diego PLDI 16 Thursday, June 16 Extensible static analyses for modern scripting languages 2

More information

Concurrency Control. Synchronization. Brief Preview of Scheduling. Motivating Example. Motivating Example (Cont d) Interleaved Schedules

Concurrency Control. Synchronization. Brief Preview of Scheduling. Motivating Example. Motivating Example (Cont d) Interleaved Schedules Brief Preview of Scheduling Concurrency Control Nan Niu (nn@cs.toronto.edu) CSC309 -- Summer 2008 Multiple threads ready to run Some mechanism for switching between them Context switches Some policy for

More information

Services are software components designed specifically to perform long background operations.

Services are software components designed specifically to perform long background operations. SERVICES Service Services are software components designed specifically to perform long background operations. such as downloading a file over an internet connection or streaming music to the user, but

More information

CMSC 330: Organization of Programming Languages. Concurrency & Multiprocessing

CMSC 330: Organization of Programming Languages. Concurrency & Multiprocessing CMSC 330: Organization of Programming Languages Concurrency & Multiprocessing Multiprocessing Multiprocessing: The use of multiple parallel computations We have entered an era of multiple cores... Hyperthreading

More information

Motivation & examples Threads, shared memory, & synchronization

Motivation & examples Threads, shared memory, & synchronization 1 Motivation & examples Threads, shared memory, & synchronization How do locks work? Data races (a lower level property) How do data race detectors work? Atomicity (a higher level property) Concurrency

More information

RATCOP: Relational Analysis Tool for Concurrent Programs

RATCOP: Relational Analysis Tool for Concurrent Programs RATCOP: Relational Analysis Tool for Concurrent Programs Suvam Mukherjee 1, Oded Padon 2, Sharon Shoham 2, Deepak D Souza 1, and Noam Rinetzky 2 1 Indian Institute of Science, India 2 Tel Aviv University,

More information

EnergyPatch: Repairing Resource Leaks to Improve Energy-efficiency of Android Apps

EnergyPatch: Repairing Resource Leaks to Improve Energy-efficiency of Android Apps 1 EnergyPatch: Repairing Resource Leaks to Improve Energy-efficiency of Android Apps Abhijeet Banerjee, Lee Kee Chong, Clément Ballabriga and Abhik Roychoudhury Abstract Increased usage of mobile devices,

More information

Computation Abstractions. CMSC 330: Organization of Programming Languages. So, What Is a Thread? Processes vs. Threads. A computer.

Computation Abstractions. CMSC 330: Organization of Programming Languages. So, What Is a Thread? Processes vs. Threads. A computer. CMSC 330: Organization of Programming Languages Threads Computation Abstractions t1 t2 t1 t3 t2 t1 p1 p2 p3 p4 CPU 1 CPU 2 A computer t4 t5 Processes (e.g., JVM s) Threads CMSC 330 2 Processes vs. Threads

More information

Static Detection of Energy Defect Patterns in Android Applications

Static Detection of Energy Defect Patterns in Android Applications Static Detection of Energy Defect Patterns in Android Applications Haowei Wu Shengqian Yang Atanas Rountev Ohio State University, USA wuhaow yangs rountev}@cse.ohio-state.edu Abstract For static analysis

More information

CSE 374 Programming Concepts & Tools

CSE 374 Programming Concepts & Tools CSE 374 Programming Concepts & Tools Hal Perkins Fall 2017 Lecture 22 Shared-Memory Concurrency 1 Administrivia HW7 due Thursday night, 11 pm (+ late days if you still have any & want to use them) Course

More information

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) Lecture 3: Android Life Cycle and Permission Android Lifecycle An activity begins its lifecycle when entering the oncreate() state If not

More information

Threading and Synchronization. Fahd Albinali

Threading and Synchronization. Fahd Albinali Threading and Synchronization Fahd Albinali Parallelism Parallelism and Pseudoparallelism Why parallelize? Finding parallelism Advantages: better load balancing, better scalability Disadvantages: process/thread

More information

MultiJav: A Distributed Shared Memory System Based on Multiple Java Virtual Machines. MultiJav: Introduction

MultiJav: A Distributed Shared Memory System Based on Multiple Java Virtual Machines. MultiJav: Introduction : A Distributed Shared Memory System Based on Multiple Java Virtual Machines X. Chen and V.H. Allan Computer Science Department, Utah State University 1998 : Introduction Built on concurrency supported

More information

INF 212 ANALYSIS OF PROG. LANGS CONCURRENCY. Instructors: Crista Lopes Copyright Instructors.

INF 212 ANALYSIS OF PROG. LANGS CONCURRENCY. Instructors: Crista Lopes Copyright Instructors. INF 212 ANALYSIS OF PROG. LANGS CONCURRENCY Instructors: Crista Lopes Copyright Instructors. Basics Concurrent Programming More than one thing at a time Examples: Network server handling hundreds of clients

More information

Android Ecosystem and. Revised v4presenter. What s New

Android Ecosystem and. Revised v4presenter. What s New Android Ecosystem and Revised v4presenter What s New Why Mobile? 5B 4B 3B 2B 1B Landlines PCs TVs Bank users Mobiles 225M AOL 180M 135M 90M 45M 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Quarters

More information

Finding Concurrency Bugs in Java

Finding Concurrency Bugs in Java July 25, 2004 Background Our Work Recommendations Background Our Work Programmers are Not Scared Enough Java makes threaded programming too easy Language often hides consequences of incorrect synchronization

More information

2 Lecture Embedded System Security A.-R. Darmstadt, Android Security Extensions

2 Lecture Embedded System Security A.-R. Darmstadt, Android Security Extensions 2 Lecture Embedded System Security A.-R. Sadeghi, @TU Darmstadt, 2011-2014 Android Security Extensions App A Perm. P 1 App B Perm. P 2 Perm. P 3 Kirin [2009] Reference Monitor Prevents the installation

More information

Concurrency & Parallelism. Threads, Concurrency, and Parallelism. Multicore Processors 11/7/17

Concurrency & Parallelism. Threads, Concurrency, and Parallelism. Multicore Processors 11/7/17 Concurrency & Parallelism So far, our programs have been sequential: they do one thing after another, one thing at a. Let s start writing programs that do more than one thing at at a. Threads, Concurrency,

More information

Randomized Active Atomicity Violation Detection in Concurrent Programs

Randomized Active Atomicity Violation Detection in Concurrent Programs Randomized Active Atomicity Violation Detection in Concurrent Programs Chang-Seo Park EECS Department, UC Berkeley, CA, USA. parkcs@cs.berkeley.edu Koushik Sen EECS Department, UC Berkeley, CA, USA. ksen@cs.berkeley.edu

More information

CMSC 330: Organization of Programming Languages. Threads Classic Concurrency Problems

CMSC 330: Organization of Programming Languages. Threads Classic Concurrency Problems : Organization of Programming Languages Threads Classic Concurrency Problems The Dining Philosophers Problem Philosophers either eat or think They must have two forks to eat Can only use forks on either

More information

Homework # 7 Distributed Computing due Saturday, December 13th, 2:00 PM

Homework # 7 Distributed Computing due Saturday, December 13th, 2:00 PM Homework # 7 Distributed Computing due Saturday, December 13th, 2:00 PM In this homework you will add code to permit a calendar to be served to clients, and to open a calendar on a remote server. You will

More information

Concurrency, Thread. Dongkun Shin, SKKU

Concurrency, Thread. Dongkun Shin, SKKU Concurrency, Thread 1 Thread Classic view a single point of execution within a program a single PC where instructions are being fetched from and executed), Multi-threaded program Has more than one point

More information

Implementing Secure Software Systems on ARMv8-M Microcontrollers

Implementing Secure Software Systems on ARMv8-M Microcontrollers Implementing Secure Software Systems on ARMv8-M Microcontrollers Chris Shore, ARM TrustZone: A comprehensive security foundation Non-trusted Trusted Security separation with TrustZone Isolate trusted resources

More information

Synchronization. Before We Begin. Synchronization. Credit/Debit Problem: Race Condition. CSE 120: Principles of Operating Systems.

Synchronization. Before We Begin. Synchronization. Credit/Debit Problem: Race Condition. CSE 120: Principles of Operating Systems. CSE 120: Principles of Operating Systems Lecture 4 Synchronization January 23, 2006 Prof. Joe Pasquale Department of Computer Science and Engineering University of California, San Diego Before We Begin

More information

CSE 451: Operating Systems Winter Lecture 7 Synchronization. Steve Gribble. Synchronization. Threads cooperate in multithreaded programs

CSE 451: Operating Systems Winter Lecture 7 Synchronization. Steve Gribble. Synchronization. Threads cooperate in multithreaded programs CSE 451: Operating Systems Winter 2005 Lecture 7 Synchronization Steve Gribble Synchronization Threads cooperate in multithreaded programs to share resources, access shared data structures e.g., threads

More information

Static Analysis for Android: GUIs, Callbacks, and Beyond

Static Analysis for Android: GUIs, Callbacks, and Beyond Static Analysis for Android: GUIs, Callbacks, and Beyond Atanas (Nasko) Rountev Ohio State University Program Analyses and Software Tools Research Group Joint with my students Dacong Yan, Shengqian Yang,

More information

Synchronization SPL/2010 SPL/20 1

Synchronization SPL/2010 SPL/20 1 Synchronization 1 Overview synchronization mechanisms in modern RTEs concurrency issues places where synchronization is needed structural ways (design patterns) for exclusive access 2 Overview synchronization

More information

Android Internals. Lecture 1. Android and Low-level Optimizations Summer School. 13 July 2015

Android Internals. Lecture 1. Android and Low-level Optimizations Summer School. 13 July 2015 Android Internals Lecture 1 Android and Low-level Optimizations Summer School 13 July 2015 This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this

More information

Static Analysis Basics II

Static Analysis Basics II Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Static Analysis Basics

More information

CS378 -Mobile Computing. Services and Broadcast Receivers

CS378 -Mobile Computing. Services and Broadcast Receivers CS378 -Mobile Computing Services and Broadcast Receivers Services One of the four primary application components: activities content providers services broadcast receivers 2 Services Application component

More information

Advanced Android Power Management and Implementation of Wakelocks

Advanced Android Power Management and Implementation of Wakelocks Advanced Android Power Management and Implementation of Wakelocks Michael B Motlhabi University of the Western Cape Computer Science Department Modderdam Road Bellville 7535 2706912@uwc.ac.za ABSTRACT

More information

Android Activities. Akhilesh Tyagi

Android Activities. Akhilesh Tyagi Android Activities Akhilesh Tyagi Apps, memory, and storage storage: Your device has apps and files installed andstoredonitsinternaldisk,sdcard,etc. Settings Storage memory: Some subset of apps might be

More information

ITG Software Engineering

ITG Software Engineering Android Security Course ID: Page 1 Last Updated 12/15/2014 Android Security ITG Software Engineering Course Overview: This 5 day course covers the Android architecture, the stack, and primary building

More information

Android Internals and the Dalvik VM!

Android Internals and the Dalvik VM! Android Internals and the Dalvik VM! Adam Champion, Andy Pyles, Boxuan Gu! Derived in part from presentations by Patrick Brady, Dan Bornstein, and Dan Morrill from Google (http://source.android.com/documentation)!

More information

CalFuzzer: An Extensible Active Testing Framework for Concurrent Programs Pallavi Joshi 1, Mayur Naik 2, Chang-Seo Park 1, and Koushik Sen 1

CalFuzzer: An Extensible Active Testing Framework for Concurrent Programs Pallavi Joshi 1, Mayur Naik 2, Chang-Seo Park 1, and Koushik Sen 1 CalFuzzer: An Extensible Active Testing Framework for Concurrent Programs Pallavi Joshi 1, Mayur Naik 2, Chang-Seo Park 1, and Koushik Sen 1 1 University of California, Berkeley, USA {pallavi,parkcs,ksen}@eecs.berkeley.edu

More information

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Computer Systems Engineering: Spring Quiz I Solutions

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Computer Systems Engineering: Spring Quiz I Solutions Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.033 Computer Systems Engineering: Spring 2011 Quiz I Solutions There are 10 questions and 12 pages in this

More information

Multi-threaded programming in Java

Multi-threaded programming in Java Multi-threaded programming in Java Java allows program to specify multiple threads of execution Provides instructions to ensure mutual exclusion, and selective blocking/unblocking of threads What is a

More information

ANDROID NATIVE APP: INTRODUCTION TO ANDROID. Roberto Beraldi

ANDROID NATIVE APP: INTRODUCTION TO ANDROID. Roberto Beraldi ANDROID NATIVE APP: INTRODUCTION TO ANDROID Roberto Beraldi Role of an operating system APPLICATIONS OPERATING SYSTEM CPU MEMORY DEVICES Android = OS + Middleware Based on Linux Not just another distribution.

More information

Chapter 6: Process Synchronization

Chapter 6: Process Synchronization Chapter 6: Process Synchronization Objectives Introduce Concept of Critical-Section Problem Hardware and Software Solutions of Critical-Section Problem Concept of Atomic Transaction Operating Systems CS

More information

EMBEDDED SYSTEMS PROGRAMMING Application Basics

EMBEDDED SYSTEMS PROGRAMMING Application Basics EMBEDDED SYSTEMS PROGRAMMING 2015-16 Application Basics APPLICATIONS Application components (e.g., UI elements) are objects instantiated from the platform s frameworks Applications are event driven ( there

More information

11/19/2013. Imperative programs

11/19/2013. Imperative programs if (flag) 1 2 From my perspective, parallelism is the biggest challenge since high level programming languages. It s the biggest thing in 50 years because industry is betting its future that parallel programming

More information

Processes and Threads

Processes and Threads COS 318: Operating Systems Processes and Threads Kai Li and Andy Bavier Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall13/cos318 Today s Topics u Concurrency

More information

Shared Memory Programming with OpenMP. Lecture 8: Memory model, flush and atomics

Shared Memory Programming with OpenMP. Lecture 8: Memory model, flush and atomics Shared Memory Programming with OpenMP Lecture 8: Memory model, flush and atomics Why do we need a memory model? On modern computers code is rarely executed in the same order as it was specified in the

More information

Language-Based Security on Android (call for participation) Avik Chaudhuri

Language-Based Security on Android (call for participation) Avik Chaudhuri + Language-Based Security on Android (call for participation) Avik Chaudhuri + What is Android? Open-source platform for mobile devices Designed to be a complete software stack Operating system Middleware

More information

Tasks. Task Implementation and management

Tasks. Task Implementation and management Tasks Task Implementation and management Tasks Vocab Absolute time - real world time Relative time - time referenced to some event Interval - any slice of time characterized by start & end times Duration

More information

CMSC 132: Object-Oriented Programming II. Threads in Java

CMSC 132: Object-Oriented Programming II. Threads in Java CMSC 132: Object-Oriented Programming II Threads in Java 1 Problem Multiple tasks for computer Draw & display images on screen Check keyboard & mouse input Send & receive data on network Read & write files

More information

Synchronization. CS61, Lecture 18. Prof. Stephen Chong November 3, 2011

Synchronization. CS61, Lecture 18. Prof. Stephen Chong November 3, 2011 Synchronization CS61, Lecture 18 Prof. Stephen Chong November 3, 2011 Announcements Assignment 5 Tell us your group by Sunday Nov 6 Due Thursday Nov 17 Talks of interest in next two days Towards Predictable,

More information

Static Analysis for Android: GUIs, Callbacks, and Beyond

Static Analysis for Android: GUIs, Callbacks, and Beyond Static Analysis for Android: GUIs, Callbacks, and Beyond Atanas (Nasko) Rountev Joint work with Dacong Yan Shengqian Yang Haowei Wu Yan Wang Hailong Zhang Ohio State University PRESTO: Program Analyses

More information

Principles of Program Analysis. Lecture 1 Harry Xu Spring 2013

Principles of Program Analysis. Lecture 1 Harry Xu Spring 2013 Principles of Program Analysis Lecture 1 Harry Xu Spring 2013 An Imperfect World Software has bugs The northeast blackout of 2003, affected 10 million people in Ontario and 45 million in eight U.S. states

More information

Services. Background operating component without a visual interface Running in the background indefinitely

Services. Background operating component without a visual interface Running in the background indefinitely Services Background operating component without a visual interface Running in the background indefinitely Differently from Activity, Service in Android runs in background, they don t have an interface

More information