817
No Mercy (files.catbox.moe)
submitted 1 week ago by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 298 points 1 week ago

Fake news.

Both Windows and Linux have their respective SIGTERM and SIGKILL equivalents. And both usually try SIGTERM before resorting to SIGKILL. That's what systemd's dreaded "a stop job is running" is. It waits a minute or so for the SIGTERM to be honoured before SIGKILLing the offending process.

[-] [email protected] 41 points 1 week ago

Also fake because zombie processes.

I once spent several angry hours researching zombie processes in a quest to kill them by any means necessary. Ended up rebooting, which was a sort of baby-with-the bath-water solution.

Zombie processes still infuriate me. While I'm not a Rust developer, nor do I particularly care about the language, I'm eagerly watching Redox OS, as it looks like the micro kernel OS with the best chance to make to it useful desktop status. A good micro kernel would address so so many of the worst aspects of Linux.

[-] [email protected] 79 points 1 week ago* (last edited 1 week ago)

Zombie processes are already dead. They aren't executing, the kernel is just keeping a reference to them so their parent process can check their return code (waitpid).

All processes becomes zombies briefly after they exit, just usually their parents wait on them correctly. If their parents exit without waiting on the child, then the child gets reparented to init, which will wait on it. If the parent stays alive, but doesn't wait on the child, then it will remain zombied until the parent exits and triggers the reparenting.

Its not really Linux's fault if processes don't clean up their children correctly, and I'm 99% sure you can zombie a child on redox given its a POSIX OS.

Edit: https://gist.github.com/cameroncros/8ae3def101efc08be2cd69846d9dcc81 - Rust program to generate orphans.

[-] [email protected] 3 points 1 week ago

I haven’t tried this, but if you just need the parent to call waitpid on the child’s pid then you should be able to do that by attaching to the process via gdb, breaking, and then manually invoking waitpid and continuing.

[-] [email protected] 7 points 1 week ago* (last edited 1 week ago)

I think that should do it. I'll try later today and report back.

Of course, this risks getting into an even worse state, because if the parent later tries to correctly wait for its child, the call will hang.

Edit: Will clean up the orphan/defunct process.

If the parent ever tried to wait, they would either get ECHILD if there are no children, or it would block until a child exited.

Will likely cause follow on issues - reaping someone elses children is generally frowned upon :D.

load more comments (40 replies)
load more comments (54 replies)
this post was submitted on 07 Jul 2024
817 points (92.6% liked)

linuxmemes

19849 readers
648 users here now

I use Arch btw


Sister communities:

Community rules

  1. Follow the site-wide rules and code of conduct
  2. Be civil
  3. Post Linux-related content
  4. No recent reposts

Please report posts and comments that break these rules!

founded 1 year ago
MODERATORS