On 6/23/26 09:58, Hongru Zhang wrote: >> On 5/20/26 23:15, Matthew Wilcox wrote: >>> >>> all of the applications i run are either single threaded or don't fork. >>> what multithreaded applications call fork? >> >> Traditionally the problem was random libraries using fork+execve to launch >> other >> programs ... instead of using alternatives like posix_spwan (some use cases >> require more work done before execve and cannot yet switch to that). I'd hope >> that that is less of a problem on Android. >> >> I assume Android zygote might be multi threaded? Maybe sshd as well? Systemd? >> But I'd be surprised if there are really performance implications. >> >> Not sure about webbroswers .... I think most of them switched to fork >> servers, >> where I would assume fork servers would be single-threaded. >> >> So, yeah, getting a clear understanding how this ends up being a problem on >> Android would be great. > > Barry asked me to share observations on fork() usage across Android > applications. > > I wrote a BPF-based tracing tool (kprobe on copy_process, checking > CLONE_VM to distinguish process creation from thread creation) and ran > it against the top 200 Android applications in the China market during > normal usage scenarios. > > Results: > - 82 out of 200 apps (41%) call fork() during normal operation
Crazy. Thanks for these numbers. > - Among these, some call fork() from multiple threads > > These are not zygote forks — they are fork() calls initiated by app > threads at runtime. Examples by category: > > Browsers: com.quark.browser, com.UCMobile, com.xunlei.browser > Shopping: com.taobao.taobao, com.tmall.wireless, com.achievo.vipshop > Video: com.youku.phone, com.qiyi.video, com.hunantv.imgo.activity > Social/IM: com.alibaba.android.rimet, com.ss.android.lark > News: com.ss.android.article.news, com.ss.android.article.lite > Navigation: com.autonavi.minimap, com.sdu.didi.psnger > Finance: com.eg.android.AlipayGphone, com.chinamworld.main I know that especially browser usually use fork servers: a tiny (single-threaded) process just to create new child processes. Any information regarding the apps above that use fork() on small vs. large processes? > > This confirms that fork() is widely used in real-world multi-threaded > Android applications. Above you write "some call fork() from multiple threads". Any further information on that? -- Cheers, David
