ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.2 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://mozillazg.com/2017/07/python-how-to-generate-kill-clean-zombie-process.html |
| Last Crawled | 2026-05-27 07:26:41 (7 days ago) |
| First Indexed | 2018-01-02 14:05:00 (8 years ago) |
| HTTP Status Code | 200 |
| Content | |
| Meta Title | Python: 僵尸进程的产生和清除方法 - mozillazg's Blog |
| Meta Description | Python: 僵尸进程的产生和清除方法 - 僵尸进程产生的原因 在 unix 或 unix-like 的系统中,当一个子进程退出后,它就会变成一个僵尸进程,如果父进程没有通过 wait 系统调用来读取这个子进程的退出状态的话,这个子进程就会一直维持僵尸进程状态。 Zombie process - Wikipedia 中是这样描述的: On Unix and Unix-like computer operating systems, a zombie process or defunct process is a process that has completed execution (via the exit system call) but still has an entry in the process table: it is a process in the "Terminated state". This occurs for child processes, where the entry is still needed to allow the parent process to read its child's exit status: once the exit status is read via the wait system call, the zombie's entry is removed from the process table and it is said to be "reaped". A child process always first becomes a zombie before being removed from the resource table. In most cases, under normal system operation zombies are immediately waited on by their parent and then reaped by the system – processes that stay zombies for a long time are generally an error and cause a resource leak. 并且僵尸进程无法通过 kill 命令来清除。 本文将探讨如何手动制造一个僵尸进程以及清除僵尸进程的办法。 手动制造一个僵尸进程 为了便于后面讲解清除僵尸进程的方法,我们使用日常开发中经常使用的 multiprocessing 模块来制造僵尸进程(准确的来说是制造一个长时间维持僵尸进程状态的子进程): $ cat test_a.py from multiprocessing import Process, current_process import logging import os import time logging.basicConfig( level=logging.DEBUG, format='%(asctime)-15s - %(levelname)s - %(message)s' ) def run(): logging.info('exit child process %s', current_process().pid) os._exit(3) p = Process(target=run) p.start() time.sleep(100) 测试: $ python test_a.py & [1] 10091 $ ... |
| Meta Canonical | null |
| Boilerpipe Text | heavy column, fetched on demand |
| Markdown | heavy column, fetched on demand |
| Readable Markdown | heavy column, fetched on demand |
| ML Classification | |
| ML Categories | null |
| ML Page Types | null |
| ML Intent Types | null |
| Content Metadata | |
| Language | zh |
| Author | null |
| Publish Time | 2017-07-20 00:00:00 (8 years ago) |
| Original Publish Time | 2017-07-01 00:00:00 (8 years ago) |
| Republished | No |
| Word Count (Total) | 1,032 |
| Word Count (Content) | 969 |
| Links | |
| External Links | 17 |
| Internal Links | 12 |
| Technical SEO | |
| Meta Nofollow | No |
| Meta Noarchive | No |
| JS Rendered | No |
| Redirect Target | null |
| Performance | |
| Download Time (ms) | 472 |
| TTFB (ms) | 468 |
| Download Size (bytes) | 8,379 |
| Location | |
| Host ID | 199 (laksa199) |
| Partition ID | 81 |
| Root Hash | 2094915011136856399 |
| Unparsed URL | com,mozillazg!/2017/07/python-how-to-generate-kill-clean-zombie-process.html s443 |