ℹ️ 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.1 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://pythontic.com/multiprocessing/process/terminate |
| Last Crawled | 2026-04-05 13:48:17 (1 day ago) |
| First Indexed | 2019-02-15 15:56:34 (7 years ago) |
| HTTP Status Code | 200 |
| Meta Title | process.terminate() method | Pythontic.com |
| Meta Description | The Python method process.terminate() uses SIGTERM to terminate a process. The child processes of the terminated processes are not terminated. The Python example terminates the child process and prints the output. |
| Meta Canonical | null |
| Boilerpipe Text | import multiprocessing as multiproc
import time
# Process function
def pfunc(mq):
for i in range(1,20):
mq.put("Message%d"%i)
time.sleep(1)
print("Child:Populated the Queue with:%d"%i)
if __name__ == "__main__":
# Set the method for process creation
multiproc.set_start_method('fork')
# Create a Queue
mq = multiproc.Queue()
childProc = multiproc.Process(target=pfunc,args=(mq,))
childProc.start()
print("Parent:After child process has started")
time.sleep(2)
# Terminate the child process
childProc.terminate()
print("Parent:After terminate() on the child process")
# Join will return immediately as the process has been terminated already
childProc.join()
print("Parent:Exit code of the child process on terminate():%d"%childProc.exitcode)
if childProc.is_alive() == True:
print(mq.get()) # Queue may be corrupt if process had encountered a terminate() call |
| Markdown | [Pythontic.com](https://pythontic.com/index)
- [Python Language Concepts](https://pythontic.com/multiprocessing/process/terminate)
- [Introduction to Python](https://pythontic.com/language/basics/introduction)
- [Keywords](https://pythontic.com/concepts/keywords)
- [Operators](https://pythontic.com/language/operators/overview)
- [Statements](https://pythontic.com/statements)
- [Exception Handling](https://pythontic.com/language/exception%20handling/introduction)
- [Strings In Python](https://pythontic.com/concepts/string/overview)
- [Python Built-in Functions](https://pythontic.com/functions/built-in/introduction)
- [Python Specifics](https://pythontic.com/concepts/python%20specifics/introduction)
- [Data Structures](https://pythontic.com/multiprocessing/process/terminate)
- [Containers](https://pythontic.com/containers)
- [Arrays](https://pythontic.com/arrays)
- [Concurrency](https://pythontic.com/multiprocessing/process/terminate)
- [Multithreading](https://pythontic.com/multithreading)
- [Multiprocessing](https://pythontic.com/multiprocessing)
- [Systems Programming](https://pythontic.com/multiprocessing/process/terminate)
- [Operating System](https://pythontic.com/operatingsystem)
- [Input/Output](https://pythontic.com/io)
- [Network Programming](https://pythontic.com/network)
- [Web Services](https://pythontic.com/webservices)
- [Utils](https://pythontic.com/multiprocessing/process/terminate)
- [Serialization](https://pythontic.com/serialization)
- [File Formats](https://pythontic.com/fileformats)
- [Logging](https://pythontic.com/logging)
- [Time and Date](https://pythontic.com/datetime)
- [Database Programming](https://pythontic.com/multiprocessing/process/terminate)
- [MySQL](https://pythontic.com/database/mysql)
- [PostgreSQL](https://pythontic.com/database/postgresql)
- [SQLite](https://pythontic.com/database/SQLite)
- [MongoDB](https://pythontic.com/database/MongoDB)
- [InfluxDB](https://pythontic.com/database/InfluxDB)
- [Redis](https://pythontic.com/database/redis)
- [Neo4j](https://pythontic.com/database/neo4j)
- [App Development](https://pythontic.com/app-development)
- [Analytics](https://pythontic.com/multiprocessing/process/terminate)
- [Data Analysis](https://pythontic.com/data-analysis)
- [Data Visualization](https://pythontic.com/visualization)
- [Mathematics & Statistical Functions](https://pythontic.com/mathematics)
- [Finance](https://pythontic.com/finance)
- [Image Processing](https://pythontic.com/image-processing)
- [About](https://pythontic.com/multiprocessing/process/terminate)
- [About Us](https://pythontic.com/about)
- [Privacy Policy](https://pythontic.com/privacy)
- [Contact](https://pythontic.com/contact)
# Process.terminate() method
1. [Home](https://pythontic.com/)
2. [Multiprocessing](https://pythontic.com/multiprocessing)
3. [Process](https://pythontic.com/multiprocessing/process/introduction)
4. Terminate
## Method Name:
terminate
## Method Signature:
terminate()
## Return Value:
NoneType
## Parameters:
Not Applicable
## Method Overview:
- Terminates the process corresponding to the process instance on which it was invoked.
- In Unix-like operating systems it uses SIGTERM signal to terminate the process.In Windows it uses TerminateProcess().
- It causes the child processes of the terminated process to become orphaned.
- After a process is terminated using terminate(), any data passing mechanisms held by the process like Queues, Pipes may become corrupt.
- If the process has acquired any synchronization objects this may cause a deadlock to other processes that were waiting on those synchronization objects.
## Example:
| |
|---|
| import multiprocessing as multiproc import time \# Process function def pfunc(mq): for i in range(1,20): mq.put("Message%d"%i) time.sleep(1) print("Child:Populated the Queue with:%d"%i) if \_\_name\_\_ == "\_\_main\_\_": \# Set the method for process creation multiproc.set\_start\_method('fork') \# Create a Queue mq = multiproc.Queue() childProc = multiproc.Process(target=pfunc,args=(mq,)) childProc.start() print("Parent:After child process has started") time.sleep(2) \# Terminate the child process childProc.terminate() print("Parent:After terminate() on the child process") \# Join will return immediately as the process has been terminated already childProc.join() print("Parent:Exit code of the child process on terminate():%d"%childProc.exitcode) if childProc.is\_alive() == True: print(mq.get()) \# Queue may be corrupt if process had encountered a terminate() call |
## Output:
| |
|---|
| Parent:After child process has started Child:Populated the Queue with:1 Parent:After terminate() on the child process Parent:Exit code of the child process on terminate():-1 |
[multiprocessing.context.Process class](https://pythontic.com/multiprocessing/process/introduction)
[is\_alive](https://pythontic.com/multiprocessing/process/is_alive)
[join](https://pythontic.com/multiprocessing/process/join)
[kill](https://pythontic.com/multiprocessing/process/kill)
[process constructor](https://pythontic.com/multiprocessing/process/process%20constructor)
[run](https://pythontic.com/multiprocessing/process/run)
[start](https://pythontic.com/multiprocessing/process/start)
***
Copyright 2026 © pythontic.com |
| Readable Markdown | null |
| Shard | 106 (laksa) |
| Root Hash | 1086311801948902306 |
| Unparsed URL | com,pythontic!/multiprocessing/process/terminate s443 |