使用qemu来学习Linux的休眠和唤醒

简介: 使用qemu来学习Linux的休眠和唤醒

休眠

在虚拟机中执行下面的命令:

# echo mem > /sys/power/state

唤醒

进入monitor模式:ctrl+a c

(qemu) system_wakeup

查看日志

查看虚拟机的内核日志:

[   63.878427] PM: suspend entry (deep)
[   63.880758] Filesystems sync: 0.002 seconds
[   63.905165] Freezing user space processes
[   63.918547] Freezing user space processes completed (elapsed 0.013 seconds)
[   63.918600] OOM killer disabled.
[   63.918604] Freezing remaining freezable tasks
[   63.933581] Freezing remaining freezable tasks completed (elapsed 0.014 seconds)
[   63.933956] printk: Suspending console(s) (use no_console_suspend to debug)
[   64.157554] ACPI: PM: Preparing to enter system sleep state S3
[   64.157873] ACPI: PM: Saving platform NVS memory
[   64.158183] Disabling non-boot CPUs ...
[   64.177614] smpboot: CPU 1 is now offline
[   64.190154] smpboot: CPU 2 is now offline
[   64.200412] smpboot: CPU 3 is now offline
[   64.209810] smpboot: CPU 4 is now offline
[   64.218578] smpboot: CPU 5 is now offline
[   64.225909] smpboot: CPU 6 is now offline
[   64.231571] smpboot: CPU 7 is now offline
[  109.246110] ACPI: PM: Low-level resume complete
[  109.246717] ACPI: PM: Restoring platform NVS memory
[  109.264354] Enabling non-boot CPUs ...
[  109.267436] x86: Booting SMP configuration:
[  109.267448] smpboot: Booting Node 0 Processor 1 APIC 0x1
[  109.309331] CPU1 is up
[  109.310011] smpboot: Booting Node 1 Processor 2 APIC 0x2
[  109.335256] CPU2 is up
[  109.336082] smpboot: Booting Node 1 Processor 3 APIC 0x3
[  109.360920] CPU3 is up
[  109.361831] smpboot: Booting Node 2 Processor 4 APIC 0x4
[  109.389742] CPU4 is up
[  109.390474] smpboot: Booting Node 2 Processor 5 APIC 0x5
[  109.417438] CPU5 is up
[  109.418530] smpboot: Booting Node 3 Processor 6 APIC 0x6
[  109.450698] CPU6 is up
[  109.451443] smpboot: Booting Node 3 Processor 7 APIC 0x7
[  109.480943] CPU7 is up
[  109.495593] ACPI: PM: Waking up from system sleep state S3
[  109.509932] pci 0000:00:01.0: PIIX3: Enabling Passive Release
[  109.516706] virtio_blk virtio2: 8/0/0 default/read/poll queues
[  109.539719] OOM killer enabled.
[  109.539724] Restarting tasks ... done.
[  109.544564] random: crng reseeded on system resumption
[  109.568101] PM: suspend exit
相关文章
|
1月前
|
Linux 编译器 开发工具
【Linux快速入门(三)】Linux与ROS学习之编译基础(Cmake编译)
【Linux快速入门(三)】Linux与ROS学习之编译基础(Cmake编译)
|
1月前
|
存储 安全 Linux
|
1月前
|
Linux Shell 数据安全/隐私保护
|
2月前
|
Linux 编译器 C语言
【Linux快速入门(一)】Linux与ROS学习之编译基础(gcc编译)
【Linux快速入门(一)】Linux与ROS学习之编译基础(gcc编译)
|
2月前
|
网络协议 Linux
linux学习之套接字通信
Linux中的套接字通信是网络编程的核心,允许多个进程通过网络交换数据。套接字提供跨网络通信能力,涵盖本地进程间通信及远程通信。主要基于TCP和UDP两种模型:TCP面向连接且可靠,适用于文件传输等高可靠性需求;UDP无连接且速度快,适合实时音视频通信等低延迟场景。通过创建、绑定、监听及读写操作,可以在Linux环境下轻松实现这两种通信模型。
44 1
|
2月前
|
Linux 开发工具
【Linux快速入门(二)】Linux与ROS学习之编译基础(make编译)
【Linux快速入门(二)】Linux与ROS学习之编译基础(make编译)
|
3月前
|
网络协议 Ubuntu Linux
用Qemu模拟vexpress-a9 (三)--- 实现用u-boot引导Linux内核
用Qemu模拟vexpress-a9 (三)--- 实现用u-boot引导Linux内核
|
4月前
|
NoSQL Ubuntu Linux
Linux内核学习
Linux内核学习
95 3
|
4月前
|
Ubuntu Linux
内核实验(四):Qemu调试Linux内核,实现NFS挂载
本文介绍了在Qemu虚拟机中配置NFS挂载的过程,包括服务端的NFS服务器安装、配置和启动,客户端的DHCP脚本添加和开机脚本修改,以及在Qemu中挂载NFS、测试连通性和解决挂载失败的方法。
253 0
内核实验(四):Qemu调试Linux内核,实现NFS挂载
|
4月前
|
NoSQL Linux Android开发
内核实验(三):编写简单Linux内核模块,使用Qemu加载ko做测试
本文介绍了如何在QEMU中挂载虚拟分区、创建和编译简单的Linux内核模块,并在QEMU虚拟机中加载和测试这些内核模块,包括创建虚拟分区、编写内核模块代码、编译、部署以及在QEMU中的加载和测试过程。
239 0
内核实验(三):编写简单Linux内核模块,使用Qemu加载ko做测试