Running multiple processes
Technically with Python, we can simply switch the inheritance of our thread from Thread
to Process
by running the following code:
from multiprocessing import Process from typing import Optional class ExampleProcess(Process): def __init__(self, seconds: int, name: str) -> None: super().__init__() self.seconds: int = seconds self.name: str = name self._return: Optional[int] = None def run(self) -> None: # do something demanding of the CPU pass def join(self) -> int: ...