About Chromebooks

Chromebook, ChromeOS and Google Chrome browser news

Multiple cores with CPU affinity can boost VM performance on Chromebooks

This new ChromeOS change could boost VM performance on Chromebooks

Google is working on a new code change for ChromeOS that could boost VM performance on Chromebooks. ChromeOS uses a custom VM, or virtual machine, to run Linux on Chromebooks, as well as for Android apps. The change would enable CPU affinity, which is a way to constrain or enable the VM to use certain processors on a multi-core Chromebook.

What’s changing for VM performance on Chromebooks

Here’s the description of the code change:

When –host-cpu-topology flag is specified, crosvm will create 1:1 affinity masks between host CPUs and VM’s vCPUs. Extend this mechanims to also pass the cluster IDs and CPU capacity information to the guest.

There are a few things to unpack here.

First, the code change is specific to crosvm, which, if you’re not familiar with, is the custom VM monitor that Google created specifically for ChromeOS. It’s very lightweight compared to typical virtual machines that you may be familiar with, such as Parallels Desktop, QEMU or VirtualBox.

Linux on my Chromebook

Any time you open Linux on a Chromebook, for example, crosvm executes to create a VM. Inside that VM, Linux runs in a container which helps add more security between Linux and the ChromeOS system. Both the VM and the container do add overhead since the CPUs are running a virtualized, or software-based, computer instance.

What is CPU affinity?

So, what is CPU affinity and how could it affect the VM running on Chromebooks? Essentially, CPU affinity is a way to optimize and balance the CPU cores between its regular operating system and a virtual one.

Given that Chromebooks use multi-core processors, CPU affinity can allocate a greater number of cores for the two systems. It can also reduce or limit the cores if that’s required. However, I don’t think that’s the main reason for this code change.

I’m also over-simplifying this a bit to aid in understanding. There’s quite a bit going on at the system level with regards to CPU affinity and task scheduling.

This is an older Linux forum post from 2008 about CPU affinity but the principle still applies on the benefits:

One of these useful linux utilities is called taskset which allows setting the cpu affinity of a process. This is just a fancy way of saying bonding a process to a specific set of cpu(s). Why would you want to do this? The short answer is Load balancing. With multicore cpus becoming the de facto standard, there are some very practical uses of this when it comes to virtualization.

On a typical multicore cpu today, each core has enough power to easily run a physical machine so you can see the practical application of this; pin a virtual machine to a cpu core. This is applicable for most applications. If your application needs more cpu cycles you can scale up by pinning your virtual machine to multiple cores.

Let’s talk about cores!

CPU affinity can boost VM performance on Chromebooks with multi-core processors.

Think of it this way, using the Framework Chromebook. It has a 12th gen Intel Core i5 processor with 12 cores. All of the running tasks are spread out among the cores as needed, to balance performance and efficiency. The above image shows how much each individual CPU core is in use.

You can see the various tasks are spread out between the many CPU cores. In that example, I’m just using ChromeOS for web browsing.

Here’s what happens when I start doing something in Linux, which is running in a VM on the Chromebook:

Multiple cores with CPU affinity can boost VM performance on Chromebooks

You can see that two of the physical CPU cores are handling most of the load for the VM and Linux at that point in time. That kind of seems like a waste of resources when there are plenty of other cores to balance out the load.

How CPU affinity could boost VM performance on Chromebooks

With CPU affinity enabled and configured on a Chromebook, constraints on how many cores used for the VM can be adjusted. That would allow the VM to enjoy the same performance and efficiency optimizations as ChromeOS itself.

Instead of the VM using just a few CPU cores, for example, half of them could essentially be devoted to ChromeOS. The other half could be focused on the VM tasks. Note that even with CPU affinity, a physical CPU core can never be fully allocated to a virtual machine.

CPU affinity can boost VM performance on Chromebooks

According to Parallels, this approach could provide a 20 percent performance boost; at least for that company’s VM product:

If your physical server has several processors installed, you can bind a virtual machine or Container to specific CPUs so that only these CPUs are used to handle the processes running in the virtual machine or Container. The feature of binding certain processes to certain CPUs is known as CPU affinity. Establishing CPU affinity between virtual machines and Containers and physical processors can help you increase your system performance up to 20%.

Obviously, without more details specific to crovm , and since I can’t currently test performance of this upcoming change now, I don’t know how much of a performance boost CPU affinity may bring. It’s definitely something I will test once the change is made, however.

ChromeOS and the ARCVM on Chromebooks

And if I recall correctly, Google is leveraging its effort on crosvm for all virtualized activities on Chromebooks. So it’s possible, likely even, that Android apps could gain some performance here too.

author avatar
Kevin C. Tofel

6 thoughts on “This new ChromeOS change could boost VM performance on Chromebooks

  1. This is similar to what is done on cloud-native applications, no? From my very limited understanding, you have these 128 core CPUs in the cloud so there is a need to bind long-running (but relatively low resource) apps to a single core and/or thread. And Google does use a version of Chromium OS in their Google Cloud Platform version of Kubernetes. It would be fascinating if what they are doing in their cloud platforms is filtering down to their consumer products like this.

    But it is necessary. The latest numbers from IDC, Gartner, Canalys etc. states that only 19 million Chromebooks sold in 2022. That is the lowest number – and by a good margin – since 17 million in 2019. It looks like Google completely failed to capitalize on not just the pandemic, but all the tablet sales from the Lenovo Duet. (Lenovo’s tablet sales were way down in 2022 despite their releasing several interesting and competitive Android models, which lets you know that the original Duet did sell quite a bit, but their successors didn’t.)

    1. Name a product Google ever capitalised on, lol, they couldn’t sell water in the desert. Every success they’ve had has been by giving the product away in markets where the competition was amazingly bad such as Chrome v IE.

      To me Chrome OS is amazing but I wish it was Microsoft or Apple or even Amazon, it would have more of a certain future.

      1. Microsoft and Amazon doesn’t assure certainty. Amazon fired most of his Alexy team because Bezos thinks Alexa is not profitable (!), even though the brand is synonymous with Amazon now.
        And Microsoft cancelled product as much as Google. They rebooted their mobile OS at least trice, Windows Mobile (1-6.5) the Windows Phone (7-8) then Windows Mobile (again) 10. They cancelled Windows Kin after only 1 month. Windows Live, Windows Live tile, Skype is on its deathbed and the list can go on.

  2. Is their any indication of ChromeOS finally getting a Linux Store?
    People and reviwers avoid Crostini becuse they don’t like CLI for installing app (at least at first).

    1. Nope, I haven’t seen anything with respect to a Linux store for apps on Chromebooks. This reviewer doesn’t avoid Crostini… I use it 4-6 hours a day!

  3. Assigning fixed resources to VM is so old school. We are at a point in technology where host ChromeOS, Android VM, Linux VM should be able to use all cores at the same time just like a host OS but the process of each VM separated from each other by some thread or something. The Host would still have permission to adjust this when host needs those cores. The same should be true for storage and RAM. Assigning storage and RAM to VM is old school, wasted, and inefficient.

Comments are closed.

Scroll to top