VirtualBox

source: vbox/trunk/src/VBox/Main/Docs-Intro.cpp@ 49223

Last change on this file since 49223 was 44533, checked in by vboxsync, 12 years ago

VBoxSVSI.cpp: doxygen and hungarian adjustments.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.6 KB
Line 
1/* $Id: Docs-Intro.cpp 44533 2013-02-04 20:55:12Z vboxsync $ */
2/** @file
3 * This file contains the introduction to Main for developers.
4 */
5
6/*
7 * Copyright (C) 2011-2013 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18/** @page pg_main Main API
19 *
20 * First of all, check out the "Technical background" chapter in the manual, pay
21 * attention to the "VirtualBox executables and components" chapter. It lists
22 * three processes, (1) VBoxSVC, (2) VirtualBox in manager mode and (3)
23 * VirtualBox in VM mode. This will be referred to as (1) server, (2) client
24 * and (3) VM process, respectively.
25 *
26 *
27 * @section sec_main_walk_thru_suspend IConsole::Pause Walkthru
28 *
29 * The instigator can be a client (VirtualBox in manager mode, VBoxManage
30 * controlvm, web services, ++) or the VM process it self (i.e. you select
31 * pause via the menu or the host key short cut).
32 *
33 * We will not cover the case where the guest triggers a suspend.
34 *
35 * Approximate sequence of events:
36 * - Client calls IConsole::Pause.
37 * - The COM/XPCOM routes this to the VM process, invoking Console::Pause() in
38 * ConsoleImpl.cpp. (The IConsole::Pause method in the client process is a
39 * COM/XPCOM stub method which does marshalling+IPC.)
40 * - Console::Pause validates the Console object state, the VM state and the VM
41 * handle.
42 * - Console::Pause calls VMR3Suspend to do the actual suspending.
43 * - VMR3Suspend() in VMM/VMMR3/VM.cpp calls VMMR3EmtRendezvous() to change the
44 * VM state synchronously on all EMTs (threads performing as virtual CPUs).
45 * - VMMR3EmtRendezvous() will first detect that the caller isn't an EMT and
46 * use VMR3ReqCallWait() to forward the call to an EMT.
47 * - When VMMR3EmtRendezvous() is called again on an EMT, it will signal the
48 * other EMTs by raising a force action flag (VM_FF_EMT_RENDEZVOUS) and then
49 * poke them via VMR3NotifyGlobalFFU(). Then wait for them all to arrive.
50 * - The other EMTs will call VMMR3EmtRendezvousFF as soon as they can.
51 * - When all EMTs are there, the calling back of vmR3Suspend() on each CPU in
52 * decending order will start.
53 * - When the CPU with the higest ID calls vmR3Suspend() the VM state is
54 * changed to VMSTATE_SUSPENDING or VMSTATE_SUSPENDING_EXT_LS.
55 * - When the CPU with ID 0 calls vmR3Suspend() the virtual device emulations
56 * and drivers get notified via PDMR3Suspend().
57 * - PDMR3Suspend() in VMM/VMMR3/PDM.cpp will iterate thru all device
58 * emulations and notify them that the VM is suspending by calling their
59 * PDMDEVREG::pfnSuspend / PDMUSBREG::pfnSuspend entry point (can be NULL).
60 * For each device it will iterate the chains of drivers and call their
61 * PDMDRVREG::pfnSuspend entry point as well.
62 * - Should a worker thread in a PDM device or PDM driver be busy and need some
63 * extra time to finish up / notice the pending suspend, the device or driver
64 * will ask for more time via PDMDevHlpSetAsyncNotification(),
65 * PDMDrvHlpSetAsyncNotification() or PDMUsbHlpSetAsyncNotification().
66 * PDMR3Suspend will then poll these devices and drivers frequently until all
67 * are done.
68 * - PDMR3Suspend() will return to vmR3Suspend() once all PDM devices and PDM
69 * drivers has responded to the pfnSuspend callback.
70 * - The virtual CPU with ID 0 returns from vmR3Suspend() to the rendezvous
71 * code and the EMTs are released.
72 * - The inner VMMR3EmtRendezvous() call returns and this in turn triggers the
73 * VMR3ReqCallWait() call to return (with the status code of the inner call).
74 * - The outer VMMR3EmtRendezvous() returns to VMR3Suspend().
75 * - VMR3Suspend() returns to Console::Pause().
76 * - Console::Pause() checks the result and flags provides error details on
77 * failure.
78 * - Console::Pause() returns to the COM/XPCOM marshalling/IPC stuff.
79 * - Switch back to client process.
80 * - The IConsole::Pause() call returns. The end.
81 *
82 * Summary of above: Client process calls into the VM process, VM process does a
83 * bunch of inter thread calls with all the EMT, EMT0 suspends the PDM devices
84 * and drivers.
85 *
86 * The EMTs will return to the outer execution loop, vmR3EmulationThreadWithId()
87 * in VMM/VMMR3/VMEmt.cpp, where they will mostly do sleep. They will not
88 * execute any guest code until VMR3Resume() is called.
89 *
90 */
91
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette