Quantcast
Channel: xda-developers - Android Software and Hacking General [Developers Only]
Viewing all articles
Browse latest Browse all 3614

[MOD] Link /dev/random to urandom for lag reduction

$
0
0
Hi,

This is just a suggestion to reduce lag on Android devices based on others' findings that the blocking /dev/random device may be the cause of the significant lag on most Android devices.

Why can't we just remove the /dev/random device and link it to /dev/urandom?:

1. mv /dev/random /dev/random.ORIG ; ln /dev/urandom /dev/random
2. Stop the seeder service if it's running.

Wakelock and battery drain is probably not a concern as there's nothing running in the background. Also this may be better than feeding /dev/random from external sources as the device is now non blocking.

Saw this on some JDK optimisation site and decided to try it. I'm getting some good results on all Android devices I've tried this on.

Since /dev/random is blocking and designed to protect us from Quantum alien cryptographers with mathematical certainty and urandom is non blocking pseudo-random device that most apps and OSs are using anyway.

I guess usability is more important than catering to a one in a impossibillion chance and a billion devices performing sub optimally.

Basically it could all be in an init.d script like this to include the kernel parameters to increase entropy and another suggestion to remove the randomized kernel address space feature to improve performance.

Code:

#!/system/bin/sh
sysctl -w kernel.randomize_va_space=0
sysctl -w kernel.random.write_wakeup_threshold=2048
sysctl -w kernel.random.read_wakeup_threshold=1024
mv /dev/random /dev/random.ORIG && ln /dev/urandom /dev/random

Your thoughts welcome.

Ref:

http://forum.xbian.org/thread-191.html
http://forums.oracle.com/forums/thre...hreadID=991619
http://itonguard.com/20090313/weblogic-starts-slow/

Viewing all articles
Browse latest Browse all 3614

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>