KVM(基于内核的虚拟机)源代码研究

时间:2016-05-04 01:45:03

标签: kvm

我是KVM的新手,我想研究它的源代码。 KVM Forum提供了许多有用的资料。但是,它们过于通用而且不具体。虽然通过谷歌搜索,我几乎找不到关于KVM源代码的具体参考(也许我没有以正确的方式谷歌)。希望您能帮助我完成KVM的源代码研究。谢谢!

1 个答案:

答案 0 :(得分:0)

kvm内核代码可通过git树(如内核本身)获得。要使用git创建存储库,请键入

private static int counter = 1;
private static SemaphoreSlim semaphore = new SemaphoreSlim(7);

static void Main(string[] args)
{
    Console.Title = "Async";
    var x = Task.Run(() => MainAsync());
    Console.ReadLine();          
}

private static async Task MainAsync()
{
  while (true)
  {
    var dbData = await ...; // Imagine calling a database to get some work items to do, in this case 5 dummy items
    for (int i = 0; i < 5; i++)
    {
      var x = DoSomethingAsync(counter.ToString());
      counter++;
      Thread.Sleep(50);
    }
    Thread.Sleep(1000);
  }
}

private static async Task DoSomethingAsync(string jobNumber)
{
  await semaphore.WaitAsync();
  try
  {
    try
    {
      // Simulated mostly IO work - some could be long running
      await Task.Delay(5000);
      Console.WriteLine(jobNumber);
    }
    catch (Exception ex)
    {
      LogException(ex);
    }
    Log("job {0} has completed", jobNumber);
  }
  finally
  {
    semaphore.Release();
  }
}

或者,也可以通过the kernel.org gitweb interface访问它。

从QEMU 1.3开始,KVM用户空间代码位于主线QEMU中。请使用和开发

git clone git://git.kernel.org/pub/scm/virt/kvm/kvm.git

更多关于KVM Code