Applying multiprocessing and multithreading
Applying multiprocessing or multithreading techniques to any code isn’t a good choice; concurrency and parallelism are best reserved for the problem spaces where they provide the best results. As a rule of thumb, if a problem is input- or output-bound, it is better suited to being solved by increasing the concurrency handling of the system. If the problem requires more processing than data management, it is CPU-bound, and then multiprocessing is the best approach.
Usually, however, it is not that simple. Distributed systems, with their reliance on network communication, inherently have I/O characteristics that make them more suitable for the application of concurrency management techniques, while some of the components of the distributed systems could use the power of local/distributed processors to accelerate execution (e.g. when a specific large task is distributed across multiple parallel processors with a framework like MapReduce...