top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Thread priority for intensive disk I/O operations using android?

+1 vote
779 views

What is best thread priority for intensive disk I/O operations - Foreground or Background?

posted Jul 28, 2013 by Abhay Kulkarni

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

Using a foreground priority isn't going to help anything anyway, provided your operations use large chunks for transfers: you're just going to be using compute time waiting for I/O operations to finish.

answer Jul 28, 2013 by Sonu Jindal
0 votes

Id recommend for the sake of the user to push all I/O work to the background to provide efficient reporting.

answer Jul 28, 2013 by Amit Parthsarthi
Similar Questions
+3 votes

We using C++ in the media layer and we want to raise the priority of our _AUDIO PROCESSING_ thread, to make sure the audio works well even the CPU is high (totally %98 on an slow Phone).

I have searched on google and find to use _setpriority( PRIO_PROCESS, 0, priority); but _setpriority function is change the process priority instead of the thread.

I know there is Java API to do that, but we need an C++ API. So does there any way to raise an single thread priority from C++ code?

0 votes

I made an app (Java based, without JNI stuff), to stress our android device. It does some intensive work and /sdcard IO writes (They are 60 threads) all of them are with FOREGROUND priority.

After a couple of minutes appeared crashes in different places (system_server - FinalizerDaemon timeouts) and then the Watchdog rebooted the device with message Watchdog killing system process: null.

I tested it also on Nexus 7 and other android devices in production, the behavior is the SAME. It seems that some apk, can overload the system and to reboot the user-space.

Is this behavior (under high pressure/load from FOREGROUND threads) is by design in android Jelly-Bean and are there any plans for some remedy for this situation.

+3 votes

My question is regarding the PC register value of which is giving to the created thread.

if I create a new process with fork() the PC value will be copied from parent to child as PC value is the next command in the code.

However if I create a new thread as following

#include <pthread.h>
int pthread_create(pthread_t *restrict tidp, const pthread_attr_t *restrict attr, void *(*start_rtn)(void), void *restrict arg)

with:

err = pthread_create(&thready, NULL, &mythread, NULL);

Now the question is where the created thread gets it's PC value. How does the PC value set to the first line of mythread code?

+4 votes

I have my Code . Kindly make it correct .

  protected void Button1_Click(object sender, EventArgs e)
  {
        System.Threading.Thread.Sleep(500);
        Image1.ImageUrl = "Below15.png";
        System.Threading.Thread.Sleep(500);
        Image1.ImageUrl = "Below26.png";
        System.Threading.Thread.Sleep(500);
        Image1.ImageUrl = "Below31.png";
        System.Threading.Thread.Sleep(500);
        Image1.ImageUrl = "Below40.png";
        System.Threading.Thread.Sleep(500);
        Image1.ImageUrl = "Above70.png";
 }
...