1

I am testing one of my application on android's (Android version 7.0) termux terminal emulator. I want to spawn some zombie processes.

On GNU/Linux, if I open a terminal emulator and write:

ruby -e '10.times { fork { exit! } } && sleep '

This will create 10 zombie processes. To check about zombie processes, I write:

ruby -e "puts Dir['/proc/**'].select { |x| File.split(x)[1].then { |y| y.to_i.to_s == y } }.then { |a| %<Active Processes: #{a.size} (#{a.count { |x| IO.readlines(%<#{x}/status>)[1].split[1] == ?Z.freeze} } Zombies)> }"

Which outputs in the format:

Active Processes: 189 (10 Zombies)

But on Termux, I can't create zombie processes. When I am forking a process, the process count doesn't increase (as reported by htop and the ruby program). Even if I try to spawn processes, it won't spawn any. I have total 11 processes showing on Termux!

What's so different about android? Is there any way to test my application using termux? Or are there any other applications that will allow me to do such stuff?

1
  • 1
    I just created 100 zombie processes on Termux using for n in {1..100}; do (sleep 1 & exec /bin/sleep 10) & done and they do exist for 10 seconds as expected, then reaped by init. To see zombie processes: ps axo stat,ppid,pid,cmd | grep ^Z. Or just to take count use grep -c ^Z. – Irfan Latif Dec 9 '19 at 15:49
1

I just created 100 zombie processes on Termux using:

for n in {1..100}; do (sleep 1 & exec sleep 10) & done

and they do exist for 10 seconds as expected, then reaped by init. To see zombie processes:

~$ ps axo stat,ppid,pid,cmd | grep ^Z

Or just to take count use grep -c ^Z.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.