0

This is on Android, my application slows down the UI interaction when it is trying to create a big file, my SD card is slow and I can observe that high iowait occurs and the CPU just sits idle when creating the big file, during this process, the application is sluggish, UI interaction is unresponsive, this looks normal since my SD card is slow and this is what is expected with high iowait.

I read somewhere that as long as one uses asynchronous IO, iowait will not impact the performance of the application, now one thing that I don't quite understand is that I am creating the big file in a background thread, which is concurrently running alongside with the UI thread and I think shouldn't block the UI thread. Yes, I am not using Java non-blcoking IO APIs, but isn't it enough to be asynchronous by using a background thread?

P.S. I am creating the big file by opening a RandomAccessFile and seeking to a specified position.

neevek
  • 11,760
  • 8
  • 55
  • 73
  • you should not allow the user to interact with the UI thread when you are doing some heavy IO task..it will cause a UI lag..just give a ProgressDialog while you are writing the file. – bakriOnFire May 26 '13 at 05:35
  • Use Traceview to get a better sense of what's going on. It feels like you have some dependencies between your background thread and the main application thread -- Traceview should help point those out. – CommonsWare May 26 '13 at 05:42

0 Answers0