{"id":5689,"date":"2020-02-24T19:49:53","date_gmt":"2020-02-24T19:49:53","guid":{"rendered":"https:\/\/really.zonky.org\/?p=5689"},"modified":"2020-02-24T19:56:53","modified_gmt":"2020-02-24T19:56:53","slug":"virtual-cores-are-not-physical-cores","status":"publish","type":"post","link":"https:\/\/really.zonky.org\/?p=5689","title":{"rendered":"Virtual Cores Are Not Physical Cores"},"content":{"rendered":"\n<p>Every so often, I tune into a video on&nbsp;some form of virtualisation which perpetuates the myth that &#8216;virtual cores&#8217; that you allocate to a virtual machine are equivalent to the physical cores that the host has. In other words if you create a virtual machine with two cores, that is two cores that the rest of the host cannot use.<\/p>\n\n\n\n<p>Preposterious.<\/p>\n\n\n\n<p>Conceptually at least, a core is a queue runner that takes a task on a queue, runs that task for a while, and then sticks that task back on the queue. Except for specialised workloads, those cores are very often (even mostly) idle.<\/p>\n\n\n\n<p>To the host machine, tasks scheduled to run on a virtual core are just tasks to be performed waiting in the queue; ignoring practicality, there is no reason why there should not be more virtual cores in a virtual machine than there are in the host machine.<\/p>\n\n\n\n<p>If you take a look at the configuration of my virtual Windows machine  in VirtualBox :-<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"558\" height=\"177\" src=\"https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/2020-02-09_1926.png?resize=558%2C177&#038;ssl=1\" alt=\"\" class=\"wp-image-5693\" srcset=\"https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/2020-02-09_1926.png?w=558&amp;ssl=1 558w, https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/2020-02-09_1926.png?resize=300%2C95&amp;ssl=1 300w\" sizes=\"auto, (max-width: 558px) 100vw, 558px\" \/><\/figure>\n\n\n\n<p>You see :-<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>I&#8217;ve allocated 8 <em>virtual<\/em> cores to this machine. I rarely use this machine (although it is usually running), but it does not take much resources to run idle cores.<\/li><li>VirtualBox arbitrarily limits the number of cores I can allocate to the virtual machine to the number of <em>threads<\/em> my processor has; it also has a warning at the number of <em>cores<\/em> my processor has but doesn&#8217;t stop me allocating virtual cores in the &#8220;red&#8221; zone.<\/li><\/ol>\n\n\n\n<p>Qemu on the other hand has no such qualms about launching a virtual machine with 64 cores &#8211; well in excess of what my physical processor has. <\/p>\n\n\n\n<p>Of course you have to be sensible, but creating a virtual machine with 4 cores <em>does not<\/em> make four cores unavailable to your host machine. If a virtual machine is idle, it won&#8217;t be running much (no machine is ever completely idle) on your real cores. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Every so often, I tune into a video on&nbsp;some form of virtualisation which perpetuates the myth that &#8216;virtual cores&#8217; that you allocate to a virtual machine are equivalent to the physical cores that the host has. In other words if you create a virtual machine with two cores, that is two cores that the rest <a href='https:\/\/really.zonky.org\/?p=5689' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_share_on_mastodon":"0"},"categories":[4],"tags":[273,1853,1310,758,1913],"class_list":["post-5689","post","type-post","status-publish","format-standard","hentry","category-it","tag-cores","tag-qemu","tag-virtualbox","tag-virtualisation","tag-vmware","category-4-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1f2KI-1tL","_links":{"self":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/5689","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5689"}],"version-history":[{"count":4,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/5689\/revisions"}],"predecessor-version":[{"id":5698,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/5689\/revisions\/5698"}],"wp:attachment":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5689"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5689"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}