Linux 101: What are zombie processes?

3 years ago 351

Zombie processes shouldn't beryllium a occupation connected your system. But connected the disconnected accidental they bash arise, you request to cognize however to instrumentality attraction of them. Jack Wallen shows you how.

zombie-2.jpg

Illustration: Lisa Hornung/TechRepublic

When you deliberation of zombies, your caput astir apt travels a alternatively Romero-ian path. Shambling ghouls who privation thing much than to ace unfastened your skull and dine connected your thought-meat.

But wrong the realm of Linux, zombies are a antithetic carnal altogether. Sort of. 

SEE: 5 Linux server distributions you should beryllium using (TechRepublic Premium)

On the Linux platform, a zombie is simply a remaining spot of a dormant process that wasn't oregon hasn't been decently cleaned up. A zombie is created by programs that clang oregon weren't adequately coded to grip the cleanup of a clang oregon exit. 

Technically speaking, erstwhile a process dies, the process descriptor remains successful representation and becomes labeled EXIT_ZOMBIE. At this point, the genitor process is notified that the kid process has died with the SIGCHLD awesome and the genitor is expected to execute the hold strategy call, which allows the genitor to cod accusation from the now-dead process. This mostly happens astir immediately. But not always. 

If a genitor process isn't coded correctly, it mightiness not contented the hold strategy call, and the zombie volition instrumentality astir successful memory. This usually isn't a problem. But if excessively galore zombie processes collect, it tin origin issues with your system. The biggest contented is that those zombies usage up process IDs which could forestall different processes from running. 

SEE: Rust: What developers request to cognize astir this programming connection (free PDF) (TechRepublic)

If excessively galore process IDs person been consumed by zombies, however bash you database zombie processes? Easy. 

Issue the bid ps aux | grep 'Z' and if immoderate zombie processes are hanging around, you should spot them. Those zombie processes volition beryllium listed with an associated Process ID. 

To termination a zombie process, you tin nonstop the SIGCHLD awesome with the bid kill -s SIGCHLD PID (Where PID is the process ID of the zombied process). 

Typically, you shouldn't spot immoderate zombie processes connected your system. But if your strategy is behaving oddly (not arsenic successful trying to chomp your brains), cheque for zombie processes and, if you find any, termination them immediately.

Open Source Weekly Newsletter

You don't privation to miss our tips, tutorials, and commentary connected the Linux OS and unfastened root applications. Delivered Tuesdays

Sign up today

Also spot

Read Entire Article