PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, August 2, 2022

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

 August 02, 2022     multithreading, python, vps     No comments   

Issue

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.

  • Thread 1 is given CPU
  • Thread 2 is given CPU
  • Thread 1 is given CPU
  • Thread 1 is given CPU
  • Thread 2 is given CPU

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.



Answered By - Ali Sajjad
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing