Project information

  • Category: CPU and Memory Management
  • Language: C
  • Project date: February, 2021

CPU Scheduler and Memory Coordinator

The goal of this project was to build a CPU Scheduler and Memory Coordinator to appropriately handle and balance workloads across multiple processors and VMs. Each program played the role of a hypervisor in managing the physical memory of the machine and how it’s used by the virtual machines, as well as managing and balancing the requirements of virtual CPUs (vCPUs) running on the physical CPUs (pCPUs). In designing the CPU Scheduler I used the Multi-Way Greedy and Longest Processing Time algorithms to appropriately pin each virtual CPU to a physical CPU.

  • Slide 1: All 4 VMs consume memory from the host.
  • Slide 2: Only 1 VM consumed memory, up to 2G; Other 3 VMs are idling.
  • Slide 3: 2 VMs consume energy. After some time 1 stops consuming and the other keeps consuming. Other 2 VMs are idling.
  • Slide 4: There are 8 VMs with 1 CPU each, running similar workloads. The vCPUs are pinned such that there are 2 vPCPUs pinned to each pCPU. Since pinning is already balanced, the scheduler should not be doing any additional work.
  • Slide 5: There are 8 VMs with 1 CPU each, running similar workloads. All the vCPUs are pinned to pCPU0. Pins should be changed such that there are 2 vCPUs pinned to each available pCPU.
  • Slide 6: There are 8 VMs with 1 CPU each but 4 VMs run a heavy workload and 4 VMs run a light load. The vCPUs are equally likely to run on any pCPU. In other words, the vCPUs are randomly pinned initially. The scheduler should use some statistic to decide the optimal pinning which will balance the workload across the pCPUs.