ACPI stands for Advanced Configuration and Power Interface. It can be used to power off system gracefully, this is especially useful in the case of virtulized Linux system.
ACPI was first released in 1996 by Compaq/Hewlett-Packard, Intel, Microsoft, Phoenix and Toshiba.
It allows control of power management from within the operating system.
Typically it can be configured from within the operating system. This is unlike APM where configuration often involves rebooting and entering the BIOS configuration screens to set parameters.
ACPI has several different software components:
A subsystem which controls hardware states and functions that may have previously been in the BIOS configuration. These states include:
power states (sleep, suspend)
a policy manager, which is software that sits on top of the operating system and allows user input on the system policies.
the ACPI also has device drivers that control/monitor devices such as a laptop battery, SMBus (communication/transmission path) and EC (embedded controller).
The above statement is a bit abstract, I will use the power button as example to show how it works.
From high level, when the power button is pressed, Linux kernel will receive ACPI message, and process it. Eventually linux kernel will publish the ACPI event to the userspace. These events can be seen by running acpi\_listen by simply starting "acpi\_listen". This can be easily verified if you have virtualbox and run a Linux VM (e.g. ubuntu).
In the window running the virtual machine, click menu "Machine->ACPI shutdown", you will see below:
Also VirtualBox will prompt the user to choose what action to take: shutdown, restart, sleep..
This is possible because there is "acpid" process running:
acpid listens to ACPI events, and processing the event based on rules provisioned under /etc/acpi/events/, then invoke proper action:
VirtualBox also provide tool "VBoxManage" to manage VM easily, one of them is to equvalent to the menu click, this can be achived by "VBoxManage controlvm <name|uuid> acpipowerbutton".
Be sure the running Linux kernel (in VirtualBox case, it is VM kernel), need have ACPI related configuration enabled: either build as module or builtin.