Retrofitting concurrency for Android applications through refactoring

Retrofitting concurrency for Android applications through refactoring
复制标题

DOI:
10.1145/2635868.2635903
复制
发表时间:
2014-11
期刊:
Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering
影响因子:
--
通讯作者:
Yu Lin;Cosmin Radoi;Danny Dig
Yu Lin;Cosmin Radoi;Danny Dig
中科院分区:
其他
文献类型:
--
作者:
Yu Lin;Cosmin Radoi;Danny Dig

文献摘要

被引文献

相似文献

在智能手机应用的UI事件线程中运行计算密集型或阻塞I/O操作可能会严重降低响应能力。尽管Android支持通过AsyncTask编写并发代码,但我们对开发人员如何使用AsyncTask来提高响应能力知之甚少。为了了解AsyncTask在实践中是如何使用/未充分使用/误用的,我们首先使用104个最受欢迎的开源Android应用程序的语料库进行了一项形成性研究,其中包括134万个Sort。我们的研究表明,尽管有一半的应用程序使用AsyncTask,但仍有数百个地方错过了将长时间运行的操作封装在AsyncTask中的机会。其次,46%的使用是手动重构的。然而,重构后的代码包含并发错误(如数据竞争)和性能错误(并发代码仍然按顺序执行)。受这些发现的启发,我们设计、开发并评估了Asynchronizer,这是一个自动化重构工具,使开发人员能够将长时间运行的操作提取到AsyncTask中。同步器使用指向静态分析来确定转换的安全性。我们的实证评估表明,Asynchronizer是(i)高度适用,(ii)准确,(iii)比手动重构更安全,(iv)它节省了开发时间,(v)其结果已被开源开发人员接受。这表明异步器是有用的。
Running compute-intensive or blocking I/O operations in the UI event thread of smartphone apps can severely degrade responsiveness. Despite the fact that Android supports writing concurrent code via AsyncTask, we know little about how developers use AsyncTask to improve responsiveness. To understand how AsyncTask is used/underused/misused in practice, we rst conduct a formative study using a corpus of top 104 most popular open-source Android apps comprising 1.34M SLOC. Our study shows that even though half of the apps use AsyncTask, there are hundreds of places where they missed opportunities to encapsulate long-running operations in AsyncTask. Second, 46% of the usages are manually refactored. However, the refactored code contains concurrency bugs (such as data races) and performance bugs (concurrent code still executes sequentially). Inspired by these ndings, we designed, developed, and evaluated Asynchronizer, an automated refactoring tool that enables developers to extract long-running operations into AsyncTask. Asynchronizer uses a points-to static analysis to determine the safety of the transformation. Our empirical evaluation shows that Asynchronizer is (i) highly applicable, (ii) accurate, (iii) safer than manual refactoring (iv) it saves development eort, (v) its results have been accepted by the open-source developers. This shows that Asynchronizer is useful.