Android Concurrency Synchronization Android concurrency idioms Introduction See www dre vanderbilt edu/~schmidt/PDF/BC-schmidt pdf for more info
Previous PDF | Next PDF |
[PDF] Android™ Concurrency - Pearsoncmgcom
reference manual It presents a model of concurrency that is somewhat Register your copy of Android Concurrency at informit com for convenient access to
[PDF] Android Concurrency & Synchronization: Introduction - Distributed
Android Concurrency Synchronization Android concurrency idioms Introduction See www dre vanderbilt edu/~schmidt/PDF/BC-schmidt pdf for more info
[PDF] Android Concurrency & Synchronization: Part 6 - Vanderbilt University
msg target public class Thread implements Runnable { public static Thread currentThread() { } public void run() { Looper prepare(); synchronized (this) {
[PDF] Lesson 11 Concurrency Control - Cleveland State University
Concurrency Control Example1 A Complete Android Example Creating Two Threads 1 2 1 (Style1) Create a common Thread, pass a custom Runnable 2
[PDF] Read PDF » Android Concurrency, 1e » TVXRAPVMUXBJ - RomWod
To get Android Concurrency, 1e PDF, you should access the hyperlink beneath and save the document or gain access to other information that are relevant to
[PDF] Read PDF Android Concurrency (Android Deep Dive) Online
Often it takes time reading a book, it is now easier and practical for you On this site is available a variety of latest books such as Read PDF Android Concurrency
[PDF] Effectively Manifesting Concurrency Bugs in Android Apps
Concurrency is a key factor in a mobile app: it should quickly respond to incoming events as well as processing time- consuming tasks in the background [ 2]
0134177436 Android Concurrency 1st Edition Android - Cinemazuid
pdf free 0134177436 android concurrency 1st edition android deep dive manual pdf pdf file Page 1/13 Page 2 Bookmark File PDF 0134177436 Android
[PDF] Android Development Lecture 5 - Università degli Studi di Parma
Marco Picone, Ph D Lecture Summary 2 - Concurrency - Concurrency Java - Concurrency User Interface - Concurrency Android ‣ Handler
[PDF] android create id in xml
[PDF] android database best practices pdf
[PDF] android design patterns and best practices
[PDF] android design patterns and best practices pdf
[PDF] android design patterns book
[PDF] android design patterns example
[PDF] android design patterns interview questions
[PDF] android design patterns pdf
[PDF] android design patterns tutorial
[PDF] android developer fundamentals (version 2)
[PDF] android developer fundamentals (version 2) pdf
[PDF] android developer fundamentals course practicals pdf
[PDF] android developer fundamentals course concept reference
[PDF] android developer fundamentals course (version 2)
Android Concurrency &
Synchronization: Introduction
Douglas C. Schmidt
d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidtInstitute for Software
Integrated Systems
Vanderbilt University
Nashville, Tennessee, USA
CS 282 Principles of Operating Systems II
Systems Programming for Android
Android Concurrency & Synchronization
D. C. Schmidt
2 Explore the motivations for & challenges of concurrent software Concurrent software can simultaneously run multiple computations that potentially interact with each otherIntroduction
Android Concurrency & Synchronization
D. C. Schmidt
3 Explore the motivations for & challenges of concurrent softwareUnderstand the mechanisms that Android
provides to manage multiple threads that run concurrently within a processIntroduction
Process A Process B
Process C
Android Concurrency & Synchronization
D. C. Schmidt
4 Explore the motivations for & challenges of concurrent softwareUnderstand the mechanisms that Android
provides to manage multiple threads that run concurrently within a processSome Android mechanisms are based on
standard Java threading & locking mechanismsIntroduction
Android Concurrency & Synchronization
D. C. Schmidt
5 Explore the motivations for & challenges of concurrent softwareUnderstand the mechanisms that Android
provides to manage multiple threads that run concurrently within a processSome Android mechanisms are based on
standard Java threading & locking mechanismsOther mechanisms are based on
Android concurrency idioms
Introduction
Looper
Message
Message
Message
Message
Message
Message
QueueUI Thread
(main thread)Message
Message
Background
Thread A
Handler
Message
Handler
Background
Thread B
Async TaskAndroid Concurrency &
Synchronization: Part 1
Douglas C. Schmidt
d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidtInstitute for Software
Integrated Systems
Vanderbilt University
Nashville, Tennessee, USA
CS 282 Principles of Operating Systems II
Systems Programming for Android
Android Concurrency & Synchronization
D. C. Schmidt
7Learning Objectives in this Part of the Module
Understand the motivations for & challenges of concurrent softwareAndroid Concurrency & Synchronization
D. C. Schmidt
8Leverage hardware/software
advances e.g., multi-core processors & multi-threaded operating systems, virtual machines, & middlewareMotivations for Concurrent Software
www.androidauthority.com/tag/quad-core-phones has more infoAndroid Concurrency & Synchronization
D. C. Schmidt
9Motivations for Concurrent Software
Leverage hardware/software
advancesSimplify program structure
e.g., by allow blocking operationsClassic single
perform blocking operationsThis complicates app
implementations by decoupling the flow of control in time & spaceLooper
Message
Message
Message
Message
Message
Message
QueueUI Thread
(main thread)Message
Android Concurrency & Synchronization
D. C. Schmidt
10Motivations for Concurrent Software
Leverage hardware/software
advancesSimplify program structure
e.g., by allow blocking operationsModern multi-threaded
architectures support blocking I/O in certain contextsLooper
Message
Message
Message
Message
Message
Message
QueueUI Thread
(main thread)Message
Message
Background
Thread A
Handler
Message
Handler
Background
Thread B
Async TaskAndroid Concurrency & Synchronization
D. C. Schmidt
11Motivations for Concurrent Software
private Bitmap bitmap; final ImageView iview = ... final Button button = ... button.setOnClickListener(new OnClickListener() { public void onClick(View v) { new Thread(new Runnable() { public void run() { bitmap = downloadImage(URI); iview.post(new Runnable() { public void run() { iview.setImageBitmap(bitmap);} }).start();Leverage hardware/software
advancesSimplify program structure
e.g., by allow blocking operationsMulti-threaded
Android example
Android Concurrency & Synchronization
D. C. Schmidt
12Motivations for Concurrent Software
private Bitmap bitmap; final ImageView iview = ... final Button button = ... button.setOnClickListener(new OnClickListener() { public void onClick(View v) { new Thread(new Runnable() { public void run() { bitmap = downloadImage(URI); iview.post(new Runnable() { public void run() { iview.setImageBitmap(bitmap);} }).start(); Start a new threadDownload an image
Display bitmap in the UI thread
Handles button clicks
Leverage hardware/software
advancesSimplify program structure
e.g., by allow blocking operationsAndroid Concurrency & Synchronization
D. C. Schmidt
13Leverage hardware/software
advancesSimplify program structure
Increase performance
Parallelize computations
& communicationsMotivations for Concurrent Software
Android Concurrency & Synchronization
D. C. Schmidt
14Leverage hardware/software
advancesSimplify program structure
Increase performance
Improve response-time
UI thread
Motivations for Concurrent Software
Android Concurrency & Synchronization
D. C. Schmidt
15Accidental Complexities
Challenges for Concurrent Software
Stem from limitations with development tools & techniquesAndroid Concurrency & Synchronization
D. C. Schmidt
16Accidental Complexities
Low-level APIs
Tedious, error-prone, & non-portable
Challenges for Concurrent Software
See www.dre.vanderbilt.edu/~schmidt/PDF/BC-schmidt.pdf for more infoAndroid Concurrency & Synchronization
D. C. Schmidt
17Accidental Complexities
Low-level APIs
typedef struct { char message_[20]; int thread_id_; } PARAMS; void *print_hello_world (void *ptr) {PARAMS *params = (PARAMS *) ptr;
printf ("%s from thread %d\n", params->message_, params->thread_id_); int main (void) { pthread_t thread; PARAMS params; params.thread_id_ = 1; strcpy (params.message_, "Hello World"); pthread_create (&thread, 0, &print_hello_world, (void *) ¶ms); pthread_join(thread, 0); return 0;Challenges for Concurrent Software
Pointer-to-
functionCast to void *
Cast from void *³4XMVL-P\SHG´ POUHMG OMQGOH
Not portable to non-POSIX platforms
Android Concurrency & Synchronization
D. C. Schmidt
18Accidental Complexities
Low-level APIs
Challenges for Concurrent Software
Other C threading APIs have similar accidental complexities typedef struct { char message_[20]; int thread_id_; } PARAMS; void *print_hello_world (void *ptr) {PARAMS *params = (PARAMS *) ptr;
printf ("%s from thread %d\n", params->message_, params->thread_id_); int main (void) { pthread_t thread; PARAMS params; params.thread_id_ = 1; strcpy (params.message_, "Hello World"); pthread_create (&thread, 0, &print_hello_world, (void *) ¶ms); pthread_join(thread, 0); return 0;Android Concurrency & Synchronization
D. C. Schmidt
19Accidental Complexities
Low-level APIs
Limited debugging tools
Challenges for Concurrent Software
Android Concurrency & Synchronization
D. C. Schmidt
20Accidental Complexities
Low-level APIs
Limited debugging tools
Challenges for Concurrent Software
See www.dre.vanderbilt.edu/~schmidt/PDF/DSIS.pdf & www.fluid.cs.cmu.eduAndroid Concurrency & Synchronization
D. C. Schmidt
21Challenges for Concurrent Software
Stem from
fundamental domain challengesAccidental Complexities
Inherent Complexities
Android Concurrency & Synchronization
D. C. Schmidt
22Accidental Complexities
Inherent Complexities
Synchronization
Challenges for Concurrent Software
en.wikipedia.org/wiki/Synchronization_(computer_science) has more infoSynchronization is the application of
mechanisms to ensure that two concurrently- executing threads do not execute specific portions of a program at the same timeAndroid Concurrency & Synchronization
D. C. Schmidt
23Accidental Complexities
Inherent Complexities
Synchronization
Scheduling
Challenges for Concurrent Software
en.wikipedia.org/wiki/Scheduling_(computing) has more infoScheduling is the method by which
threads, processes, or data flows are given access to system resourcesAndroid Concurrency & Synchronization
D. C. Schmidt
24Accidental Complexities
Low-level APIs
Limited debugging tools
Inherent Complexities
Synchronization
Scheduling
Deadlocks
Challenges for Concurrent Software
L2 L1 T2 T1 <Accidental Complexities
Inherent Complexities
Synchronization
Scheduling
Deadlock
See en.wikipedia.org/wiki/Deadlock for more info
A deadlock is a situation in which two or more
competing actions are each waiting for the other to finish, and thus neither ever doesAndroid Concurrency & Synchronization
D. C. Schmidt
25Summary
Concurrent software helps
Leverage advances in hardware technology
Meet the quality & performance needs of apps & servicesAndroid Concurrency & Synchronization
D. C. Schmidt
26Summary
Concurrent software helps
Leverage advances in hardware technology
Meet the quality & performance needs of apps & services Successful concurrent software solutions must address key accidental & inherent complexities arising fromLimitations with development
tools/techniquesAndroid Concurrency & Synchronization
D. C. Schmidt
27Summary
Concurrent software helps
Leverage advances in hardware technology
Meet the quality & performance needs of apps & services Successful concurrent software solutions must address key accidental & inherent complexities arising fromLimitations with development
tools/techniquesFundamental domain
challengesAndroid Concurrency &
Synchronization: Part 2
Douglas C. Schmidt
d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidtInstitute for Software
Integrated Systems
Vanderbilt University
Nashville, Tennessee, USA
CS 282 Principles of Operating Systems II
Systems Programming for Android
Android Concurrency & Synchronization
D. C. Schmidt
29Understand how to program Java mechanisms available in Android to implement concurrent apps that process requests simultaneously via multithreading