I am trying to list the times in which it is useful to run some code in a separate process. Does the following short list cover it?

  1. Speed: the obvious one.

    • Multiprocess/distributed parallism
    • Worker process, vs GUI process for responsiveness of UI etc
  2. Security:

    • No shared-memory space decreases attack vectors
    • Part of (but not all of) sandboxing
  3. Ability to interrupt on time out: This is a bit of a hack

    • Rather than filling all code with checks to see if have hit a time out condition, run it in its own process, and have a watch dog timer in the main process, which will trigger and interrupt vis SIGINT or failing that SIGKILL on the process doing the work after a timeout.
  4. Unreliable libraries

    • Sometimes you find youself needing to use a library this is not reliable.
    • You can wrap that library into its own (actor) process
    • For example:
      • it might leak memory internally: solvable by restarting the process c
      • It might on certain corner-cases just segfault. Running it in its own process lets it crash without bringing down the whole process. So you can fail gracefully or restart the wrapper process.
    • Obviously one wish to avoid that by replacing the library. But one can't always do that immediately. And sometimes as a bussiness decision it might not be worth it.
  5. External Tools

    • some tools are entire programs that are run on the commandline via. Obviously they run in their own process

Does that cover all the cases?

  • 1
    What is the point of making such a list? Note that "list of things" questions will typically get closed as "too broad" – Doc Brown May 11 '17 at 6:47
  • Using multiple process doesn't improve performance over multiple threads in a single process in most scenarios. – CodesInChaos May 11 '17 at 8:17
  • @DocBrown One tends to differenciate between Long Lists, and short lists. Short list have a fixed length. As compaired to long lists which tend to be more or less shopping questions. – Lyndon White May 11 '17 at 8:22
  • @CodesInChaos that does not change that using multiple processes is used for speed. (It has pros and cons vs multiple threads) – Lyndon White May 11 '17 at 8:24
  • Well, I guess by thinking a while about this question this list can become at least medium sized ;-) So I don't see how there can be a "right" answer. – Doc Brown May 11 '17 at 8:48

Add to that list:

  1. Programming Language Incompatibilty

    You need to use a third party library for a specific task that has only a C interface while rest of your program is in Java.

  2. Compiler Version Incompatibility

    You need to use a third party library for a specific task that is available only with a VS2010 build while rest of your program is in VS2015.

  3. Independent Distribution

    You might find value in distributing/selling the two programs independently.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.