Fatmawati Achmad Zaenuri/Shutterstock
Programs that are poorly written or performing badly can leave zombie processes lurking inside your Linux computer. Find out how zombies are created, and how you can finally lay them to rest.
Linux, of course, has to keep track of all the applications and daemons running on your computer. One of the ways it does this is by maintaining theprocess table. This is a list of structures in kernel memory. Each process has an entry in this list that contains some information about it.
There isnt a great deal in each of the process table structures. They hold the process ID, a few other data items, and a pointer to theprocess control block(PCB) for that process.
Its the PCB that holds the many details Linux needs to look up or set for each process. The PCB is also updated as a process is created, given processing time, and finally destroyed.
The Linux PCB contains over 95 fields. Its defined as a structure called task_struct.h, and its over 700 lines long. The PCB contains the following types of information:
The Process State can be any of the following:
In the Zombie state, the parent process calls one of the wait() families of functionswhen the child process is created. It then waits for a state change in the child process. Has the child process been stopped, continued, or killed by a signal? Has it terminated by running through the natural completion of its code?
If the state change is one that means the child process has stopped running, its exit code is read. Then, the childs PCB is destroyed and its entry in the process table is removed. Ideally, this all happens in the blink of an eye, and processes in the zombie state dont exist for very long.
RELATED: How to Run and Control Background Processes on Linux
A poorly written parent process might not call the wait() function when the child process is created. This means nothing is watching for state changes in the child process, and the SIGCHLD signal will be ignored. Or, perhaps another application is affecting the execution of the parent process, either due to poor programming or malicious intent.
However, if the parent process isnt watching for state changes in the child process, the proper system housekeeping wont occur. The PCB and the entry in the process table wont be removed when the child process terminates. This results in the zombie state never being removed from the PCB.
Zombies do use a bit of memory, but they dont usually pose a problem. The entry in the process table is small, but, until its released, the process ID cant be reused. On a 64-bit operating system, thats unlikely to cause any issues because the PCB is much larger than the process table entry.
A huge number of zombies could, conceivably, affect the amount of memory thats free for other processes. If youve got that many zombies, though, youve got a serious problem with the parent application or an operating system bug.
You cant kill a zombie process because its already dead. It wont respond to any signals because its been removed from memorytheres nowhere to send a SIGKILL signal. You can try sending the SIGCHLD signal to the parent process, but if it didnt work when the child process terminated, its unlikely to work now, either.
The only reliable solution is to kill the parent process. When its terminated, its child processes are inherited by the init process, which is the first process to run in a Linux system (its process ID is 1).
The init process regularly performs the necessary cleanup of zombies, so to kill them, you just have to kill the process that created them. The top command is a convenient way to see if you have any zombies.
Type the following:
This system has eight zombie processes. We can list theseby using the ps command and piping it into egrep. Again, zombie processes have a state flag of Z, and youll usually also see defunct.
Type the following:
The zombie processes are listed.
This is a neater way to discover the process IDs of zombies than scrolling back and forth through top. We also see that an application called badprg spawned these zombies.
The process ID of the first zombie is 7641, but we need to find the process ID of its parent process. We can do so by usingpsagain. Well use theoutput option (-o) to tell ps to display only the parents process ID, and then pass it with the ppid= flag.
The process we want to find will be indicated by using the -p (process) option, and then passing in the zombies process ID.
Therefore, we type the following command to look up the process information for process 7641, but it will only report the ID of the parent process:
Were told the parent process ID is 7636. We can now cross-reference this by usingps once more.
We see this matches the name of the parent process from earlier. To kill the parent process, use the SIGKILL option with the kill command as follows:
Depending on the owner of the parent process, you might also need to use sudo.
unless theyre in a massive horde. A few arent anything to worry about and a simple reboot will wipe them out.
However, if you notice that an application or process is always spawning zombies, thats something you should look into. Its most likely just a sloppily written program, in which case, perhaps theres an updated version that properly cleans up after its child processes.
See more here:
How to Kill Zombie Processes on Linux - How-To Geek
- Even Will Smith Couldnt Save Zombie Survival Game Undawn, Which Flopped Spectacularly - IGN - March 24th, 2024
- Rob Zombie Recommends This Surprisingly Wholesome Comedy - Dread Central - March 24th, 2024
- Army Writing and the Zombie (Noun) Apocalypse - Modern War Institute - United States Military Academy West Point - March 24th, 2024
- Fatal Fury's Mai Shiranui Is In This Zombie Survival Game For Some Reason - Time Extension - March 24th, 2024
- Should you be worried about 'zombie deer'? | College of Public Health - George Mason University - March 24th, 2024
- 'Scooby-Doo on Zombie Island' Scares Its Way to Blu-ray for the First Time This Spring - Collider - March 24th, 2024
- Rob Zombie hates my guts: GWAR's Dave 'Oderus Urungus' Brockie was a genius, and here's an interview that proves it - Louder - March 24th, 2024
- In the fight against gun violence, Rep. Frost Introduces the Destroy Zombie Guns Act - The Apopka Voice - March 24th, 2024
- Elfriede Jelinek's 'The Children of the Dead' is a historical zombie novel - The Washington Post - The Washington Post - March 24th, 2024
- Germany's Zombie Government Is Fueling the Far Right - The Atlantic - March 24th, 2024
- Zombie Survival Game Undawn Has Crashed And Burned According To A Reuters Report - MMOs.com - March 24th, 2024
- Will Smiths Zombie Game Has Been Hit Harder Than Chris Rock at the Oscars Its Astronomical Budget Was ... - imdb - March 24th, 2024
- Scooby-Doo On Zombie Island / Return to Zombie Island Blu-ray (Warner Archive Collection) - Blu-ray.com - March 24th, 2024
- Registration almost here for Dothans annual Zombie 5K Chase - WDHN - March 24th, 2024
- Zombie magic and gambling club Magic Island will come alive again this summer - Houston Chronicle - March 24th, 2024
- Undawn | The $140m zombie survival game starring Will Smith that bombed while nobody was looking - Filmstories - March 24th, 2024
- After 4 years, a cult classic zombie horror manga from Ga-Rei's creator is finally getting an official English release - Gamesradar - March 24th, 2024
- Will Smith's Zombie Game Has Been Hit Harder Than Chris Rock at the Oscars - Its Astronomical Budget Was ... - FandomWire - March 24th, 2024
- "The game literally no one knew existed": The Will Smith Zombie Survival Game is Reportedly a Big Flop and Fans Are ... - FandomWire - March 24th, 2024
- Zombie-palooza --- Get to the biggest undead music event in the latest Dead Island 2 expansion: SoLA - Gaming Trend - March 24th, 2024
- Bournemouth University medical students treat 'zombie attack' in mass training simulation - The Tab - March 24th, 2024
- Zombie car factories on the rise in China as buyers opt for EVs - Financial Times - March 16th, 2024
- Hey, Remember When Rob Zombie Was Going To Direct THE CROW 3? - FANGORIA - March 16th, 2024
- New Walking Dead Twist Shows How The Zombie Outbreak Will Finally End - Screen Rant - March 16th, 2024
- Candid conversations from death row with The Zombie Hunter - Arizona's Family - March 16th, 2024
- Zombie! The Musical - REVIEW - City Hub Sydney - March 16th, 2024
- A Gorgeous Harp and Guitar String Duet of 'Zombie' by The Cranberries in Honor of Alexei Navalny - Laughing Squid - March 16th, 2024
- Y2K Review: A 1999 Youth Nostalgia Comedy That Turns Into an Attack-of-the-Computers Zombie Movie. But Only the First One Is Fun - Variety - March 16th, 2024
- AMC Announces Every Zombie in The Walking Dead Getting Its Own Spin-Off - Hard Drive - March 16th, 2024
- The Growing Threat of Zombie Code - CXOToday.com - March 16th, 2024
- The Greatest Zombie Movie Ever Gets Theatrical Return For Anniversary - Giant Freakin Robot - March 16th, 2024
- You won't expect which fighting game character pops up in this random mobile zombie game trailer for a bizarre ... - EventHubs - March 16th, 2024
- Coby White, Butler and the 'Zombie Heat,' Fontecchio Are All Here to Stay - Canis Hoopus - March 16th, 2024
- 'Land of the Dead' 19 Years Later: Romero's Return Was Smarter Than the Average Zombie Movie - Bloody Disgusting - March 16th, 2024
- Z Nation Season 6: SYFY Tease Return of Zombie Series 6 Years After Its Death - ComingSoon.net - March 16th, 2024
- Zombie! The Musical (Hayes Theatre Co) - Limelight - March 16th, 2024
- Get This Definitive Edition Zombie Game For Free Right Now On Steam - Screen Rant - February 19th, 2024
- The Best Ghost and Zombie Movie Romances - Vulture - February 19th, 2024
- The couple trying to keep killer 'zombie viruses' at bay - and protect us from another pandemic - The Telegraph - February 19th, 2024
- Meet the Serbian Businessman/DJ Who Runs the Zombie AI Southwest Journal - Racket - February 19th, 2024
- Dead Island 2 Spreading Its Zombie Virus to Steam in April - GameSpace.com - February 19th, 2024
- Lincoln hosts Alice Cooper and Rob Zombie - Omaha - KETV Omaha - February 19th, 2024
- 'The Walking Dead - The Ones Who Live' Review AMC's Zombie Epic Shambles On - Collider - February 19th, 2024
- Legislative recap: zombie bills, teacher pay, lithium tax, pipelines and more - Black Hills Pioneer - February 19th, 2024
- Japan's stock markets are on a tear. Will 'zombie firms threaten the bull run? - CNBC - February 11th, 2024
- Thebe Phetogos haunted response to zombie figuration in art - The Washington Post - February 11th, 2024
- Cosmic dust from 'zombie' galaxies could form planets and life - The Telegraph - February 11th, 2024
- I walked with a zombie: 16 monster love interests that set hearts aflutter - The A.V. Club - February 11th, 2024
- Free Steam zombie shooter you've never heard of is getting rave reviews, somehow - GAMINGbible - February 11th, 2024
- South Korea's 'zombie football' finally leaves them in a hole too deep to climb out of - ESPN - February 11th, 2024
- Call of Duty: Modern Warfare 3's Zombie Mode is Getting Abandoned by Developer - FandomWire - February 11th, 2024
- Rob Zombie's House of 1000 Corpses Full Audio Being Released as Immersive Vinyl - ComicBook.com - February 11th, 2024
- Zombie 'apocalypse' caused by mind-altering fungi, like that in hit TV show The Last of Us, is possible MPs ar - Daily Mail - February 11th, 2024
- The dark horse of Steam Next Fest is this open-world zombie survival game that feels like an homage to the best game ... - Gamesradar - February 11th, 2024
- COVID-19 Zombie Viral Fragments Could Help Explain Why Some Infections Are More Severe | Weather.com - The Weather Channel - February 11th, 2024
- Gotham City becomes a Joker-infected zombie nightmare in new Batman #143 preview - Dexerto - February 11th, 2024
- Boy, 16, stabbed to death with zombie knife at birthday party, court hears - The Independent - February 11th, 2024
- ROB ZOMBIE And ALICE COOPER Announce Summer 2024 'Freaks On Parade' Tour With MINISTRY And FILTER - BLABBERMOUTH.NET - February 3rd, 2024
- Rob Zombie, Alice Cooper are bringing their 'Freaks on Parade Tour' to Indy this summer - IndyStar - February 3rd, 2024
- Alice Cooper And Rob Zombie Touring Again This Summer - Vermilion County First - February 3rd, 2024
- Rob Zombie and Alice Cooper's 'Freak' show coming Aug. 25 to the X in St. Paul - Star Tribune - February 3rd, 2024
- Rob Zombie and Alice Cooper get their freak on with tour stop in Houston - CultureMap Houston - February 3rd, 2024
- 'True Detective: Night Country' and the 'Zombie Virus' Theory - Pajiba Entertainment News - February 3rd, 2024
- Alice Cooper and Rob Zombie to team up at Star Lake; Heart to headline PPG Paints Arena - The Times - February 3rd, 2024
- Double bills of Rob Zombie and Alice Cooper, Train and REO Speedwagon coming this summer - St. Paul Pioneer Press - February 3rd, 2024
- Rob Zombie and Alice Cooper's Freaks On Parade 2024 tour: Presale code, tickets, dates, venues, & all you need to ... - Sportskeeda - February 3rd, 2024
- Rob Zombie and Alice Cooper added to Walmart AMP lineup - Fayetteville Flyer - February 3rd, 2024
- ROB ZOMBIE and ALICE COOPER continue "The Freaks On Parade" tour in 2024 - Lambgoat - February 3rd, 2024
- Rob Zombie, Alice Cooper to Continue Their 'Freaks on Parade' Tour with Filter and Ministry - MetalSucks - February 3rd, 2024
- 'Handling the Undead' Review: This Emotional Zombie Horror Movie Isn't as Unique as It Thinks | Sundance 2024 - Collider - February 3rd, 2024
- Sundance Review: Handling The Undead Deconstructs the Zombie Genre with Painful Dread - The Film Stage - February 3rd, 2024
- How many 'zombie' stores will be left in the Philly area after Rite Aid's bankruptcy? - The Philadelphia Tribune - February 3rd, 2024
- Rob Zombie, Alice Cooper announce 'Freaks on Parade' 2024 tour dates with Ministry and Filter - Brooklyn Vegan - February 3rd, 2024
- Rob Zombie, Alice Cooper coming to Milwaukee on Aug. 27, 2024 - FOX 6 Milwaukee - February 3rd, 2024
- Alice Cooper And Rob Zombie Announce 2024 Tour: See The Dates - iHeartRadio - February 3rd, 2024
- Rob Zombie and Alice Cooper to stop at Walmart AMP - KNWA - February 3rd, 2024
- Rob Zombie and Alice Cooper coming to Blossom - WJW FOX 8 News Cleveland - February 3rd, 2024
- Rob Zombie and Alice Cooper Reveal Joint U.S. Tour Dates Here's How To Get Presale Code Tickets - Grimy Goods - February 3rd, 2024
- Canada's 'zombie fires' continue to burn even under thick layers of snow - National Post - February 3rd, 2024
- Alice Cooper and Rob Zombie bringing Freaks on Parade to Coopers home state - MLive.com - February 3rd, 2024
Reviewed and Recommended by Erik Baquero