Search code examples
multithreadingconcurrencyf#parallel-processinghardware-infrastructure

Physical Cores vs Virtual Cores in Parallelism


When it comes to virtualization, I have been deliberating on the relationship between the physical cores and the virtual cores, especially in how it effects applications employing parallelism. For example, in a VM scenario, if there are less physical cores than there are virtual cores, if that's possible, what's the effect or limits placed on the application's parallel processing? I'm asking, because in my environment, it's not disclosed as to what the physical architecture is. Is there still much advantage to parallelizing if the application lives on a dual core VM hosted on a single core physical machine?


Solution

  • Is there still much advantage to parallelizing if the application lives on a dual core VM hosted on a single core physical machine?

    Always.

    The OS-level parallel processing (i.e., Linux pipelines) will improve performance dramatically, irrespective of how many cores -- real or virtual -- you have.

    Indeed, you have to create fairly contrived problems or really dumb solutions to not see performance improvements from simply breaking a big problem into lots of smaller problems along a pipeline.

    Once you've got a pipelined solution, and it ties up 100% of your virtual resources, you have something you can measure.

    Start trying different variations on logical and physical resources.

    But only after you have an OS-level pipeline that uses up every available resource. Until then, you've got fundamental work to do just creating a pipeline solution.