pythonmultithreadingvpsupcloud

What will happen if i run a 2 threaded application on a vps server with 1 thread?


for my future project i would like my app to be live 24/7 on a Linode/UpCloud vps with 1 thread. My app uses threading python library for multiple tasks, what will happen if i run that app on 1 thread? Thanks!


Solution

  • Short Answer:

    It will run fine. E.g.

    Explanation:

    Multithreading does not necessarily mean that it is also multi-processing. If there is only one CPU with one thread, then the threads in your application will run turn by turn (almost). And this context switch will be so fast that you cannot even feel it.

    EDIT (Thanks Barmar's comment):

    It's called "timesharing", and it's how multiple processes work whenever the computer only has one CPU.