[PDF] [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 



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 cookbook 2019

[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/~schmidt

Institute 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 other

Introduction

Android Concurrency & Synchronization

D. C. Schmidt

3 Explore the motivations for & challenges of concurrent software

Understand the mechanisms that Android

provides to manage multiple threads that run concurrently within a process

Introduction

Process A Process B

Process C

Android Concurrency & Synchronization

D. C. Schmidt

4 Explore the motivations for & challenges of concurrent software

Understand the mechanisms that Android

provides to manage multiple threads that run concurrently within a process

Some Android mechanisms are based on

standard Java threading & locking mechanisms

Introduction

Android Concurrency & Synchronization

D. C. Schmidt

5 Explore the motivations for & challenges of concurrent software

Understand the mechanisms that Android

provides to manage multiple threads that run concurrently within a process

Some Android mechanisms are based on

standard Java threading & locking mechanisms

Other mechanisms are based on

Android concurrency idioms

Introduction

Looper

Message

Message

Message

Message

Message

Message

Queue

UI Thread

(main thread)

Message

Message

Background

Thread A

Handler

Message

Handler

Background

Thread B

Async Task

Android Concurrency &

Synchronization: Part 1

Douglas C. Schmidt

d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt

Institute 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

7

Learning Objectives in this Part of the Module

Understand the motivations for & challenges of concurrent software

Android Concurrency & Synchronization

D. C. Schmidt

8

Leverage hardware/software

advances e.g., multi-core processors & multi-threaded operating systems, virtual machines, & middleware

Motivations for Concurrent Software

www.androidauthority.com/tag/quad-core-phones has more info

Android Concurrency & Synchronization

D. C. Schmidt

9

Motivations for Concurrent Software

Leverage hardware/software

advances

Simplify program structure

e.g., by allow blocking operations

Classic single

perform blocking operations

This complicates app

implementations by decoupling the flow of control in time & space

Looper

Message

Message

Message

Message

Message

Message

Queue

UI Thread

(main thread)

Message

Android Concurrency & Synchronization

D. C. Schmidt

10

Motivations for Concurrent Software

Leverage hardware/software

advances

Simplify program structure

e.g., by allow blocking operations

Modern multi-threaded

architectures support blocking I/O in certain contexts

Looper

Message

Message

Message

Message

Message

Message

Queue

UI Thread

(main thread)

Message

Message

Background

Thread A

Handler

Message

Handler

Background

Thread B

Async Task

Android Concurrency & Synchronization

D. C. Schmidt

11

Motivations 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

advances

Simplify program structure

e.g., by allow blocking operations

Multi-threaded

Android example

Android Concurrency & Synchronization

D. C. Schmidt

12

Motivations 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 thread

Download an image

Display bitmap in the UI thread

Handles button clicks

Leverage hardware/software

advances

Simplify program structure

e.g., by allow blocking operations

Android Concurrency & Synchronization

D. C. Schmidt

13

Leverage hardware/software

advances

Simplify program structure

Increase performance

Parallelize computations

& communications

Motivations for Concurrent Software

Android Concurrency & Synchronization

D. C. Schmidt

14

Leverage hardware/software

advances

Simplify program structure

Increase performance

Improve response-time

UI thread

Motivations for Concurrent Software

Android Concurrency & Synchronization

D. C. Schmidt

15

Accidental Complexities

Challenges for Concurrent Software

Stem from limitations with development tools & techniques

Android Concurrency & Synchronization

D. C. Schmidt

16

Accidental 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 info

Android Concurrency & Synchronization

D. C. Schmidt

17

Accidental 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-

function

Cast to void *

Cast from void *

³4XMVL-P\SHG´ POUHMG OMQGOH

Not portable to non-POSIX platforms

Android Concurrency & Synchronization

D. C. Schmidt

18

Accidental 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

19

Accidental Complexities

Low-level APIs

Limited debugging tools

Challenges for Concurrent Software

Android Concurrency & Synchronization

D. C. Schmidt

20

Accidental Complexities

Low-level APIs

Limited debugging tools

Challenges for Concurrent Software

See www.dre.vanderbilt.edu/~schmidt/PDF/DSIS.pdf & www.fluid.cs.cmu.edu

Android Concurrency & Synchronization

D. C. Schmidt

21

Challenges for Concurrent Software

Stem from

fundamental domain challenges

Accidental Complexities

Inherent Complexities

Android Concurrency & Synchronization

D. C. Schmidt

22

Accidental Complexities

Inherent Complexities

Synchronization

Challenges for Concurrent Software

en.wikipedia.org/wiki/Synchronization_(computer_science) has more info

Synchronization is the application of

mechanisms to ensure that two concurrently- executing threads do not execute specific portions of a program at the same time

Android Concurrency & Synchronization

D. C. Schmidt

23

Accidental Complexities

Inherent Complexities

Synchronization

Scheduling

Challenges for Concurrent Software

en.wikipedia.org/wiki/Scheduling_(computing) has more info

Scheduling is the method by which

threads, processes, or data flows are given access to system resources

Android Concurrency & Synchronization

D. C. Schmidt

24

Accidental 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 does

Android Concurrency & Synchronization

D. C. Schmidt

25

Summary

Concurrent software helps

Leverage advances in hardware technology

Meet the quality & performance needs of apps & services

Android Concurrency & Synchronization

D. C. Schmidt

26

Summary

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 from

Limitations with development

tools/techniques

Android Concurrency & Synchronization

D. C. Schmidt

27

Summary

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 from

Limitations with development

tools/techniques

Fundamental domain

challenges

Android Concurrency &

Synchronization: Part 2

Douglas C. Schmidt

d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt

Institute 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

29
Understand how to program Java mechanisms available in Android to implement concurrent apps that process requests simultaneously via multithreading

Learning Objectives in this Part of the Module

Process A Process B

Process C

Android Concurrency & Synchronization

D. C. Schmidt

30

Overview of Java Threads in Android

Android implements many

standard Java concurrency & synchronization classes See docs.oracle.com/javase/tutorial/essential/concurrency

Android Concurrency & Synchronization

D. C. Schmidt

31

Overview of Java Threads in Android

Android implements many

standard Java concurrency & synchronization classes

Conceptual view

Concurrent computations

running in a (Linux) process that can communicate with each other via shared memory or message passing

Process A Process B

Process C

Android Concurrency & Synchronization

D. C. Schmidt

32

Overview of Java Threads in Android

Android implements many

standard Java concurrency & synchronization classes

Conceptual view

Implementation view

Each Java thread has a

program counter & a stack (unique)

The heap & static areas

quotesdbs_dbs22.pdfusesText_28