在Ubuntu上用Qemu模擬ARM版本的Fedora39

来源:https://www.cnblogs.com/pengdonglin137/p/18094139
-Advertisement-
Play Games

參考 Fedora Quick Docs Fedora Server Documentation Deploy an ARM64 Fedora VM on your PC: 3 steps Architectures/AArch64/Install with QEMU Virtualization ...


參考

作者

[email protected]

概述

最近在我的家裡的T620伺服器上折騰Fedora系統時,發現這個系統有很多優點,其中一個就是debuginfod,當你用gdb調試發行版自帶的可執行程式時,它可以幫你自動下載符號表和源碼包,極其方便,雖然ubuntu22.04也開始提供這個功能,但是嘗試了一下,感覺沒有fedora好用。我從事的是嵌入式開發,目標機都是ARM64架構的,所以也想在ARM64上把這個功能用起來。

網上看到Fedora支持樹莓派4,然後根據這個文章Fedora on Raspberry Pi操作了一下,確實可以。用樹莓派官方提供的燒錄工具,要寫入的OS選擇Use custom:

image

寫入的系統也是下麵提到的Fedora-Minimal-39-1.5.aarch64.raw.xz

燒寫完畢,插到樹莓派4B,連上HDMI線和串口,就可以看到啟動界面了,測試發現,串口只能輸出日誌,不能輸入,需要連上一個USB鍵盤到樹莓派4B上來輸入。

帶個樹莓派在身邊也不太方便,能不能用Qemu模擬一個Fedora的運行環境呢?

步驟

安裝虛擬化相關的軟體包

sudo apt install virt-manager
sudo apt install qemu-system-aarch64

啟動服務並且設置為開機啟動

sudo systemctl start libvirtd
sudo systemctl enable libvirtd

下載ARM64版本的fedora39鏡像

下麵是下載鏈接:https://alt.fedoraproject.org/alt/ ,因為後面要在x86上通過qemu模擬,選擇儘可能小的版本,我用的是“Fedora最小安裝”:

image

下載得到一個xz壓縮格式的文件:Fedora-Minimal-39-1.5.aarch64.raw.xz

改造虛擬機鏡像

使用7z對這個文件進行解壓縮,得到Fedora-Minimal-39-1.5.aarch64.raw

$ 7z x Fedora-Minimal-39-1.5.aarch64.raw.xz
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,12 CPUs Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (906EA),ASM,AES-NI)

Scanning the drive for archives:
1 file, 798690336 bytes (762 MiB)

Extracting archive: ../Fedora-Minimal-39-1.5.aarch64.raw.xz
--
Path = ../Fedora-Minimal-39-1.5.aarch64.raw.xz
Type = xz
Physical Size = 798690336
Method = LZMA2:23 CRC64
Streams = 1
Blocks = 256

Everything is Ok                        

Size:       6442450944
Compressed: 798690336

解壓得到的這個文件本身就是一個虛擬機鏡像,可以作為直接作為虛擬機鏡像運行,可以看一下這個虛擬磁碟的信息:


# 找一個空閑的loop設備
$ sudo losetup -f
/dev/loop19

# 綁定
$ sudo losetup /dev/loop19 ./Fedora-Minimal-39-1.5.aarch64.raw

# 用fdisk查看分區信息
$ sudo fdisk /dev/loop19

Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/loop19: 6 GiB, 6442450944 bytes, 12582912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdfc90da8

Device        Boot   Start      End Sectors  Size Id Type
/dev/loop19p1 *       2048  1230847 1228800  600M  6 FAT16
/dev/loop19p2      1230848  3327999 2097152    1G 83 Linux
/dev/loop19p3      3328000 12582911 9254912  4.4G 83 Linux

# 解綁
$ sudo losetup -d /dev/loop19

可以看到,這個磁碟有6GB,太小了,而且是raw格式的,不能打快照,而且太占空間,下麵對這個鏡像進行改造:

  • 改造成qcow2格式的
  • 將磁碟大小改造為100G
  1. 創建一個空的qcow2鏡像
$ qemu-img create -f qcow2 fedora39_arm64.qcow2 100G
Formatting 'fedora39_arm64.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=107374182400 lazy_refcounts=off refcount_bits=16

$ ls -lh
total 6.1G
-rw-r--r-- 1 pengdl pengdl 194K 3月  27 14:31 fedora39_arm64.qcow2
-rw-rw-r-- 1 pengdl pengdl 6.0G 3月  27 10:52 Fedora-Minimal-39-1.5.aarch64.raw
  1. 綁定到nbd設備
  • 首先需要先載入nbd模塊:
$ sudo modprobe nbd
  • 綁定:
sudo qemu-nbd -c /dev/nbd0 ./fedora39_arm64.qcow2
  • 拷貝
$ sudo dd if=./Fedora-Minimal-39-1.5.aarch64.raw of=/dev/nbd0
12582912+0 records in
12582912+0 records out
6442450944 bytes (6.4 GB, 6.0 GiB) copied, 175.658 s, 36.7 MB/s

拷貝完畢,執行一下sync,確保數據落盤,此時也可以打個快照,如果後面擴容出問題,還可以利用快照進行恢復。

  • 對最後一個分區進行擴大
$ sudo fdisk /dev/nbd0

Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/nbd0: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdfc90da8

Device      Boot   Start      End Sectors  Size Id Type
/dev/nbd0p1 *       2048  1230847 1228800  600M  6 FAT16
/dev/nbd0p2      1230848  3327999 2097152    1G 83 Linux
/dev/nbd0p3      3328000 12582911 9254912  4.4G 83 Linux

# 刪除最後一個分區3
Command (m for help): d 
Partition number (1-3, default 3): 3

Partition 3 has been deleted.

# 創建新分區,用預設設置
Command (m for help): n
Partition type
   p   primary (2 primary, 0 extended, 2 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (3,4, default 3): 3
First sector (3328000-209715199, default 3328000): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (3328000-209715199, default 209715199): 

Created a new partition 3 of type 'Linux' and of size 98.4 GiB.
Partition #3 contains a ext4 signature.

# 這裡比較重要,因為我們還需要保留原來分區3的內容,這裡選擇N
Do you want to remove the signature? [Y]es/[N]o: N

# 查看分區是否修改成功
Command (m for help): p
Disk /dev/nbd0: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdfc90da8

Device      Boot   Start       End   Sectors  Size Id Type
/dev/nbd0p1 *       2048   1230847   1228800  600M  6 FAT16
/dev/nbd0p2      1230848   3327999   2097152    1G 83 Linux
/dev/nbd0p3      3328000 209715199 206387200 98.4G 83 Linux


# 將修改寫入磁碟
Command (m for help): w

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

分區擴大完畢後,文件系統也需要進行調整,否則文件系統還是原來的大小。

  • 檢查文件系統錯誤(否則resize2fs會報錯)
$ sudo e2fsck -f /dev/nbd0p3 
e2fsck 1.45.5 (07-Jan-2020)
/dev/nbd0p3 has unsupported feature(s): FEATURE_C12
e2fsck: Get a newer version of e2fsck!

/dev/nbd0p3: ********** WARNING: Filesystem still has errors **********

報錯了,提示說我們這個文件系統開啟了比較新的特性,當前這個版本的e2fsck不支持,需要使用新版本的工具。這個工具的源碼在:https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/

下載後使用下麵的命令配置、編譯和安裝:

$ cd e2fsprogs/
$ ./configure --prefix=`pwd`/install
$ make -j8
$ make install

使用新編譯的工具檢查文件系統:

$ sudo ./e2fsprogs/install/sbin/e2fsck -f /dev/nbd0p3
e2fsck 1.47.0 (5-Feb-2023)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/nbd0p3: 41952/289728 files (0.2% non-contiguous), 485030/1156864 blocks
  • 擴大文件系統
$ sudo ./e2fsprogs/install/sbin/resize2fs -f /dev/nbd0p3
resize2fs 1.47.0 (5-Feb-2023)
Resizing the filesystem on /dev/nbd0p3 to 25798400 (4k) blocks.
The filesystem on /dev/nbd0p3 is now 25798400 (4k) blocks long.
  • 檢查文件系統是否擴大成功
$ sudo mount /dev/nbd0p3 ./mnt/                                                                                                                                                 [0/0]
pengdl@pengdl-HP:~/Soft/repeat$ ls mnt/
afs  bin  boot  dev  etc  home  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

$ df -hT .
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/nbd0p3    ext4   97G  1.8G   91G   2% /home/pengdl/Soft/repeat/mnt

看到上面的結果,表示擴容成功了。

  • 解除跟nbd設備的綁定
$ sudo qemu-nbd -d /dev/nbd0
/dev/nbd0 disconnected
  • 打個快照
$ qemu-img snapshot -c init_version ./fedora39_arm64.qcow2
$ qemu-img snapshot -l ./fedora39_arm64.qcow2
Snapshot list:
ID        TAG               VM SIZE                DATE     VM CLOCK     ICOUNT
1         init_version          0 B 2024-03-27 14:53:53 00:00:00.000          0

啟動虛擬機

得到最後改成得到的虛擬機鏡像fedora39_arm64.qcow2,然後就可以啟動虛擬機了,命令如下:

sudo virt-install \
        --name fedora39_arm64 \
        --virt-type qemu \
        --ram 4096 \
        --disk path=/home/pengdl/Soft/repeat/fedora39_arm64.qcow2,cache=none \
        --nographics \
        --import \
        --arch aarch64 \
        --vcpus 4

等待一會,會出現配置界面,可以在這裡創建用戶名、密碼等:

[  OK  ] Reached target nss-user-lookup.target - User and Group Name Lookups.
         Starting systemd-homed.service - Home Area Manager...
         Starting systemd-logind.service - User Login Management...
[  OK  ] Finished dracut-shutdown.service - Restore /run/initramfs on shutdown.
================================================================================
================================================================================

1) [x] Language settings                 2) [x] Time settings
       (English (United States))                (US/Eastern timezone)
3) [x] Network configuration             4) [x] Root password
       (Connected: enp1s0)                      (Root account is disabled)
5) [ ] User creation
       (No user will be created)


Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to
refresh]: 
5
================================================================================
================================================================================

User creation

1) [ ] Create user

Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to
refresh]: 
1
================================================================================
================================================================================

User creation

1) [x] Create user
2) Full name
3) User name
4) [x] Use password
5) Password
6) [x] Administrator
7) Groups
   wheel

Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to
refresh]: 
3
================================================================================
================================================================================

Enter a new value for 'User name' and press ENTER: 
pengdl                                                                                                                                                                                                             
================================================================================
================================================================================

User creation

1) [x] Create user
2) Full name
3) User name
   pengdl
4) [x] Use password
5) Password
6) [x] Administrator
7) Groups
   wheel

Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to
refresh]: 
5
================================================================================
================================================================================

Password: 
Password (confirm): 
================================================================================
================================================================================
Question

The password you have provided is weak: The password fails the dictionary check
- it is too simplistic/systematic
Would you like to use it anyway?


Please respond 'yes' or 'no': 
yes
================================================================================
================================================================================

User creation

1) [x] Create user
2) Full name
3) User name
   pengdl
4) [x] Use password
5) Password
   Password set.
6) [x] Administrator
7) Groups
   wheel

Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to
refresh]: 
c
================================================================================
================================================================================

1) [x] Language settings                 2) [x] Time settings
       (English (United States))                (US/Eastern timezone)
3) [x] Network configuration             4) [x] Root password
       (Connected: enp1s0)                      (Root account is disabled)
5) [x] User creation
       (Administrator pengdl will be
       created)


Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to
refresh]: 
c
[  OK  ] Finished initial-setup.service - Initial Setup configuration program.
[  OK  ] Reached target getty-pre.target - Preparation for Logins.
[  OK  ] Started [email protected] - Getty on tty1.
[  OK  ] Started [email protected] - Serial Getty on ttyAMA0.
[  OK  ] Reached target getty.target - Login Prompts.
[  OK  ] Reached target multi-user.target - Multi-User System.
         Starting systemd-update-utmp-runle…- Record Runlevel Change in UTMP...
[  OK  ] Finished systemd-update-utmp-runle…e - Record Runlevel Change in UTMP.

Fedora Linux 39 (Thirty Nine)
Kernel 6.5.6-300.fc39.aarch64 on an aarch64 (ttyAMA0)

fedora login: pengdl
Password: 
[pengdl@fedora ~]$ 

確認系統信息

# 發行版
[pengdl@fedora ~]$ cat /etc/redhat-release 
Fedora release 39 (Thirty Nine)

# 內核版本
[pengdl@fedora ~]$ cat /proc/version 
Linux version 6.5.6-300.fc39.aarch64 (mockbuild@f67da981c3f1401b99e509796f7601de) (gcc (GCC) 13.2.1 20230918 (Red Hat 13.2.1-3), GNU ld version 2.40-13.fc39) #1 SMP PREEMPT_DYNAMIC Fri Oct  6 19:36:57 UTC 2023

# 文件系統掛載信息
[pengdl@fedora ~]$ df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/vda3      ext4       97G  1.8G   91G   2% /
devtmpfs       devtmpfs  4.0M     0  4.0M   0% /dev
tmpfs          tmpfs     2.0G     0  2.0G   0% /dev/shm
efivarfs       efivarfs  256K   13K  244K   5% /sys/firmware/efi/efivars
tmpfs          tmpfs     780M  804K  779M   1% /run
tmpfs          tmpfs     2.0G   20K  2.0G   1% /tmp
/dev/vda2      ext4      974M  129M  778M  15% /boot
/dev/vda1      vfat      599M   35M  564M   6% /boot/efi
tmpfs          tmpfs     390M  4.0K  390M   1% /run/user/1000

# 磁碟分區
[pengdl@fedora ~]$ lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
zram0  251:0    0  3.8G  0 disk [SWAP]
vda    252:0    0  100G  0 disk 
├─vda1 252:1    0  600M  0 part /boot/efi
├─vda2 252:2    0    1G  0 part /boot
└─vda3 252:3    0 98.4G  0 part /

# CPU信息
[pengdl@fedora ~]$ lscpu
Architecture:            aarch64
  CPU op-mode(s):        32-bit, 64-bit
  Byte Order:            Little Endian
CPU(s):                  4
  On-line CPU(s) list:   0-3
Vendor ID:               ARM
  Model name:            Cortex-A57
    Model:               0
    Thread(s) per core:  1
    Core(s) per cluster: 4
    Socket(s):           -
    Cluster(s):          1
    Stepping:            r1p0
    BogoMIPS:            125.00
    Flags:               fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
NUMA:                    
  NUMA node(s):          1
  NUMA node0 CPU(s):     0-3
Vulnerabilities:         
  Gather data sampling:  Not affected
  Itlb multihit:         Not affected
  L1tf:                  Not affected
  Mds:                   Not affected
  Meltdown:              Not affected
  Mmio stale data:       Not affected
  Retbleed:              Not affected
  Spec rstack overflow:  Not affected
  Spec store bypass:     Vulnerable
  Spectre v1:            Mitigation; __user pointer sanitization
  Spectre v2:            Vulnerable
  Srbds:                 Not affected
  Tsx async abort:       Not affected

關閉

$ sudo poweroff
...
[  OK  ] Stopped systemd-remount-fs.service…mount Root and Kernel File Systems.
[  OK  ] Stopped systemd-fsck-root.service - File System Check on Root Device.
[  OK  ] Stopped systemd-tmpfiles-setup-dev…ic Device Nodes in /dev gracefully.
         Stopping systemd-zram-setup@zram0.…vice - Create swap on /dev/zram0...
[  OK  ] Stopped [email protected] - Create swap on /dev/zram0.
[  OK  ] Removed slice system-systemd\x2dzr…- Slice /system/systemd-zram-setup.
[  OK  ] Stopped lvm2-monitor.service - Mon…using dmeventd or progress polling.
[  OK  ] Reached target shutdown.target - System Shutdown.
[  OK  ] Reached target final.target - Late Shutdown Services.
[  OK  ] Finished systemd-poweroff.service - System Power Off.
[  OK  ] Reached target poweroff.target - System Power Off.
[  670.116621] reboot: Power down

Domain creation completed.
You can restart your domain by running:
  virsh --connect qemu:///system start fedora39_arm64

通過virt-manager修改虛擬機信息

進入virt-manger的配置界面,打開我們剛纔安裝的虛擬機:fedora39_arm64

image

打開後,點擊查看虛擬機的硬體詳細配置信息:

image

添加顯示設備和輸入設備:

  • 鍵盤

image

  • 顯示器

image

通過virt-manager啟動虛擬機

  • 啟動

image

  • 切到Graphic Console界面

image

等待一會,會出現登錄提示:

image

輸入用戶名和密碼

image

後續可以配置ssh登錄。

完。

本文來自博客園,作者:摩斯電碼,未經同意,禁止轉載


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 在之前的WPF示例中,都會用到一個MVVM框,也是一個比較常的MVVM框架,就是MVVM工具包【CommunityToolkit.Mvvm】,今天專門以一個簡單的小例子,簡述一下MVVM工具包的常見用法,僅供學習分享使用,如有不足之處,還請指正。 ...
  • 概述:通過對數組進行排序,代碼更好地利用了緩存,從而提高了程式的性能。這種現象通常被稱為"緩存友好"(cache-friendly)或"空間局部性"(spatial locality) 今天做一個數組數據計算時,發現一個效率問題,給大家分享一下 一個數組排序和不排序時同樣的邏輯處理速度是不一樣的。排 ...
  • // Stream MS HelpManual: https://learn.microsoft.com/zh-cn/dotnet/api/system.io.stream?view=net-8.0 // FileStream 官方手冊: https://learn.microsoft.com/zh ...
  • Grain 是 Orleans 框架中的基本單元,代表了應用程式中的一個實體或者一個計算單元。 每個Silo都是一個獨立的進程,Silo負責載入、管理和執行Grain實例,並處理來自客戶端的請求以及與其他Silo之間的通信。 通信原理 在相同的Silo中,Grain與Grain之間的通信通過直接的方 ...
  • SystemEvents 是一個開發 win32 視窗項目很常用的類,其中封裝了一些常用的系統廣播消息。在 WinUI3 項目中,SystemEvents 事件經常無法觸發,簡單排查了一下原因。 SystemEvent 內封裝了一個線程和一個視窗,通過視窗消息在內部線程上調用事件,內部使用了 Sys ...
  • 大家好,我是痞子衡,是正經搞技術的痞子。今天痞子衡給大家介紹的是i.MXRT1xxx系列GPIO提早供電會影響上電時序導致內部DCDC啟動失敗。 最近有一個 RW612 產品線的同事在設計一個雙 MCU 系統 Demo 時發現,當 RW612 板卡和 RT1060 板卡通過 UART 對接時,如果 ...
  • 目錄微型電腦的硬體共性結構及基本性能指標關於存儲器的介紹微型電腦的基本性能指標1. 字長2. 主頻3. 存儲容量4. 外設擴展能力5. 軟體配置情況Arm Cortex 系列微處理器系列概述Arm Cortex-A 系列處理器Arm Cortex-R 系列處理器Arm Cortex-M 系列處理 ...
  • 目錄遠程策略配置啟用遠程桌面使用設置啟用遠程桌面使用控制面板啟用遠程桌面 工作中有時需要使用遠程桌面,但工控機上面的策略一般都比較保守,遠程桌面經常會失敗。這裡記錄一下使用的遠程策略配置,方便以後工作中使用。 遠程策略配置 運行命令 gpedit.msc 打開本地策略編輯: 打開 電腦配置->管理 ...
一周排行
    -Advertisement-
    Play Games
  • 前言 在我們開發過程中基本上不可或缺的用到一些敏感機密數據,比如SQL伺服器的連接串或者是OAuth2的Secret等,這些敏感數據在代碼中是不太安全的,我們不應該在源代碼中存儲密碼和其他的敏感數據,一種推薦的方式是通過Asp.Net Core的機密管理器。 機密管理器 在 ASP.NET Core ...
  • 新改進提供的Taurus Rpc 功能,可以簡化微服務間的調用,同時可以不用再手動輸出模塊名稱,或調用路徑,包括負載均衡,這一切,由框架實現並提供了。新的Taurus Rpc 功能,將使得服務間的調用,更加輕鬆、簡約、高效。 ...
  • 順序棧的介面程式 目錄順序棧的介面程式頭文件創建順序棧入棧出棧利用棧將10進位轉16進位數驗證 頭文件 #include <stdio.h> #include <stdbool.h> #include <stdlib.h> 創建順序棧 // 指的是順序棧中的元素的數據類型,用戶可以根據需要進行修改 ...
  • 前言 整理這個官方翻譯的系列,原因是網上大部分的 tomcat 版本比較舊,此版本為 v11 最新的版本。 開源項目 從零手寫實現 tomcat minicat 別稱【嗅虎】心有猛虎,輕嗅薔薇。 系列文章 web server apache tomcat11-01-官方文檔入門介紹 web serv ...
  • C總結與剖析:關鍵字篇 -- <<C語言深度解剖>> 目錄C總結與剖析:關鍵字篇 -- <<C語言深度解剖>>程式的本質:二進位文件變數1.變數:記憶體上的某個位置開闢的空間2.變數的初始化3.為什麼要有變數4.局部變數與全局變數5.變數的大小由類型決定6.任何一個變數,記憶體賦值都是從低地址開始往高地 ...
  • 如果讓你來做一個有狀態流式應用的故障恢復,你會如何來做呢? 單機和多機會遇到什麼不同的問題? Flink Checkpoint 是做什麼用的?原理是什麼? ...
  • C++ 多級繼承 多級繼承是一種面向對象編程(OOP)特性,允許一個類從多個基類繼承屬性和方法。它使代碼更易於組織和維護,並促進代碼重用。 多級繼承的語法 在 C++ 中,使用 : 符號來指定繼承關係。多級繼承的語法如下: class DerivedClass : public BaseClass1 ...
  • 前言 什麼是SpringCloud? Spring Cloud 是一系列框架的有序集合,它利用 Spring Boot 的開發便利性簡化了分散式系統的開發,比如服務註冊、服務發現、網關、路由、鏈路追蹤等。Spring Cloud 並不是重覆造輪子,而是將市面上開發得比較好的模塊集成進去,進行封裝,從 ...
  • class_template 類模板和函數模板的定義和使用類似,我們已經進行了介紹。有時,有兩個或多個類,其功能是相同的,僅僅是數據類型不同。類模板用於實現類所需數據的類型參數化 template<class NameType, class AgeType> class Person { publi ...
  • 目錄system v IPC簡介共用記憶體需要用到的函數介面shmget函數--獲取對象IDshmat函數--獲得映射空間shmctl函數--釋放資源共用記憶體實現思路註意 system v IPC簡介 消息隊列、共用記憶體和信號量統稱為system v IPC(進程間通信機制),V是羅馬數字5,是UNI ...