Tools

Sun's VirtualBox virtualization software release offers interesting features that allow developers to measure multicore scalability. As these new features were not available in previous versions, it is very important to consider them when evaluating a virtualization solution in order to test parallel performance in different operating systems and hardware environments.

A not very well-known proverb says "After you eat fruit, thank the tree". A user with a multicore microprocessor should show gratitude to a successful multicore scalability.

Talking about information systems, scalability is an application's ability to upgrade its performance, its response time or the number of users to which it can provide services. We can measure scalability from many points of view (among others):

Processing capacity.

Features and services (new functions, new cards, new hardware).

Storage capacity.

Memory.

One of the great difficulties related to multicore programming is the possibility of testing the application's scalability using different hardware and diverse operating systems. If you develop an application without multiplatform in mind, you may still have to test it on different operating systems. For example, an application designed to run in Windows XP SP 2 and later should also run on Windows Vista; Windows 2003; Windows 7 and Windows 2008.

Virtualization software really simplified the testing process. You can run many different operating systems in a sandbox, using different memory and storage configurations without the need to install a quad-boot system. Previous versions of VirtualBox offered this capability. However, they had a great problem for developers working with multicore programming, concurrency and parallelized algorithms. They allowed creating virtual machines using just one processor, one physical core, one logical core, just a single thread. Hence, you couldn't really test applications designed to exploit multicore microprocessors using VirtualBox. Besides, other popular desktop virtualization software was limited to just two processors, two physical cores, two logical cores, two concurrent threads. If you worked with a quad-core microprocessor, you wouldn't be able to assign more than two logical cores to the virtual machine.

I liked VirtualBox. It was very easy to install, very easy to configure and it offered exciting features. However, I wasn't able to work with multicore virtual machines. It was impossible to test multicore scalability using VirtualBox.

However, Sun recently launched VirtualBox 3.0. One of the most exciting features is its capability to create virtual machines with up to 32 cores, 32 concurrent threads. Really awesome! Nevertheless, you must be careful and you must consider many restrictions when working with virtualization to test multicore scalability.

The results are not going to represent the strict results offered by the equivalent real, physical hardware configuration. However, you will get a rough idea of what's going to happen in a real hardware configuration similar to the one being virtualized.

For example, if you want to test the multicore scalability for a parallelized application in Windows, you can change its process affinity settings. A few months ago, I However, this technique is just restricting the logical cores that the operating system is going to use to schedule threads created in this process. The other concurrent threads running on the operating system, belonging to dozens of concurrent processes, are going to take full advantage of all the available logical cores. Thus, this technique will not offer an accurate result. Sometimes, an application uses other services. These services could also be trying to exploit multicore capabilities. In these cases, it is even more important to use other techniques.

You can change some Windows settings to restrict the number of logical cores in the boot sequence. This technique could offer more realistic results. However, you should need to reboot as many times as the different number of configurations that you want to test. If you want to test the application running with 1; 2; 3; 4; 5; 6; 7 and 8 logical cores, provided that you have an Intel Core i7 or similar microprocessor, you will have to reboot 8 times. Believe me, rebooting 8 times is a very frustrating experience.

Using VirtualBox 3.0, you have two alternatives to simplify testing multicore scalability. If you have enough disk space, you can create 8 virtual machines with 8 different configurations (1; 2; 3; 4; 5; 6; 7 and 8 logical cores). If you do not have enough disk space, you can create one or more virtual machines and reboot them changing the number of cores. Rebooting a virtual machine is really faster than rebooting your computer. Besides, you can go on reading your e-mail, talking by instant messaging or using Twitter.

VirtualBox 3.0 offers the possibility to create more virtual cores than the number of available logical cores in the host computer (the one running VirtualBox). For example, you can create a virtual machine with 4 cores running VirtualBox on a dual-core microprocessor without Hyper-Threading capabilities (just 2 logical cores). This feature is a bit dangerous when testing multicore scalability. If you want the most accurate results, you should not configure a virtual machine with more logical cores than the ones available in the underlying hardware. Why? Because you are testing scalability and you don't want to emulate hardware that does not exist. You just want to restrict the number of available cores in certain configurations.

Virtualization simplifies multicore scalability testing. However, you should use a microprocessor with hardware virtualization capabilities to obtain the best results. Besides, if you want to test your applications with many different memory configurations, you'll be happy using a 64-bits host operating system. VirtualBox 3.0 can run on 64-bits operating systems. Thus, you have access to huge memory for your virtual machines. In the forthcoming months, more desktop, notebooks and laptops will have more than 4 GB. It is very important that the parallelized applications consider the available memory in 64-bits systems. You can also test this situations using VirtualBox or similar virtualization software.

Virtualization software is an excellent alternative to test your applications in different potential hardware and software configurations. You can play with the configurations without worrying about damaging your workstation. The results will differ from real hardware configurations. However, you'll be able to know whether your algorithms are scaling as the number of cores increase.

You can find more information about VirtualBox 3.0 new capabilities in this article by Eric J. Bruno.

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task.
However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

This month's Dr. Dobb's Journal

This month,
Dr. Dobb's Journal is devoted to mobile programming. We introduce you to Apple's new Swift programming language, discuss the perils of being the third-most-popular mobile platform, revisit SQLite on Android
, and much more!