0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Linux】システムアーキテクチャ

Last updated at Posted at 2021-05-19

Linux Process Information

Environment

以下のコマンドはすべて下記の環境にて実行しています。

yuta ❯ ~ 
❯❯❯ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

/procディレクトリについて

ファイル名 説明
/proc/cpuinfo CPUの情報
/proc/meminfo メモリの情報
/proc/ioports I/Oポートの情報
/proc/interrupts IRQの情報
/proc/bus/pci/devices PCIデバイスの情報
/proc/scsi/scsi SCSIデバイスの情報
/proc/bus/usb/devices USBデバイスの情報

/proc ディレクトリはHDDやSSKのストレージ上に作成されるわけではないです。
メモリの中に仮想的に作成されるファイルシステムです。
ファイルサイズが0の上、タイムスタンプが現在時刻になっていることがほとんどです。

yuta ❯ ~ 
❯❯❯ ls -la / | grep proc
dr-xr-xr-x 329 root root          0  5月 14 05:57 proc

/proc/cpuinfo

CPUに関する詳細な情報を確認することができます。
flagsとはCPUがどのようなモードに対応しているのかを確認できます。

モード 説明
vme 仮想モード拡張機能
de デバッグ機能
ht ハイパースレッディングテクノロジー
lm ロングモードサポート
yuta ❯ ~ 
❯❯❯ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 23
model name      : Intel(R) Pentium(R) 4              @3.20GHz  
stepping        : 10
microcode       : 2571
cpu MHz         : 2294.249
cache size      : 3072 KB
(略)
flags           : vme de pse tsc msr pae mce cx8 apic sep mtrr ht lm
(略)

/proc/meminfo

メモリーの詳細情報を取得可能
man procで確認したところ取得しているのは統計情報であった。

yuta ❯ ~ 
❯❯❯ cat /proc/meminfo
MemTotal:       16260048 kB
MemFree:         8698376 kB
MemAvailable:   12415868 kB
Buffers:          296564 kB
Cached:          4133240 kB
(略)

/proc/ioports

コンピュータ内部で、CPUがデータの送受信にI/Oポートを使用する。
その際に使用されるI/Oポートは固有のポートアドレスを持ち、識別される。

yuta ❯ ~                                                                                                                                        
❯❯❯ cat /proc/ioports                                                                                                                           
0000-0000 : PCI Bus 0000:00                                                                                                                     
  0000-0000 : dma1                                                                                                                              
  0000-0000 : pic1                                                                                                                              
  0000-0000 : timer0                                                                                                                            
  0000-0000 : timer1                                                                                                                            
  0000-0000 : keyboard                                                                                                                          
  0000-0000 : PNP0C09:00                                                                                                                        
    0000-0000 : EC data                                                                                                                         
  0000-0000 : keyboard                                                                                                                          
  0000-0000 : PNP0C09:00                                                                                                                        
    0000-0000 : EC cmd                                                                                                                          
  0000-0000 : rtc0                                                                                                                              
  0000-0000 : dma page reg
  0000-0000 : pic2
  0000-0000 : dma2
  0000-0000 : fpu
  0000-0000 : wdat_wdt
  0000-0000 : wdat_wdt
  0000-0000 : wdat_wdt
  0000-0000 : pnp 00:02
0000-0000 : PCI conf1
0000-0000 : PCI Bus 0000:00
  0000-0000 : pnp 00:02
  0000-0000 : pnp 00:02
    0000-0000 : ACPI PM1a_EVT_BLK
    0000-0000 : ACPI PM1a_CNT_BLK
    0000-0000 : ACPI PM_TMR
    0000-0000 : ACPI CPU throttle
    0000-0000 : ACPI PM2_CNT_BLK
    0000-0000 : pnp 00:04
    0000-0000 : ACPI GPE0_BLK
  0000-0000 : PCI Bus 0000:06
  0000-0000 : 0000:00:02.0
  0000-0000 : 0000:00:17.0
    0000-0000 : ahci
  0000-0000 : 0000:00:17.0
    0000-0000 : ahci
  0000-0000 : 0000:00:17.0
    0000-0000 : ahci
  0000-0000 : 0000:00:1f.4
    0000-0000 : i801_smbus
  0000-0000 : pnp 00:01
  0000-0000 : pnp 00:02
    0000-0000 : pnp 00:02
      0000-0000 : pnp 00:02

/proc/interrupts

IOデバイスごとにCPUあたりの割り込み回数を記録するために使用される。

割込の種類 説明
NMI システムに致命的な障害発生時
LOC ローカルタイマーによる割込発生時
TLB 仮想メモリアドレスと物理メモリアドレスのマッピングをCPUが切り替えた時
RES 他のコアへスケジューリング要求を出すときの割り込み
SPU 原因不明時割り込み
yuta ❯ ~                                                                                                                       
❯❯❯ cat /proc/interrupts                                                                                                       
            CPU0       CPU1       CPU2       CPU3                                                                              
   0:          8          0          0          0   IO-APIC    2-edge      timer                                               
   1:      59163          0       6403          0   IO-APIC    1-edge      i8042                                               
   8:          0          0          0          1   IO-APIC    8-edge      rtc0                                                
   9:        383         38          0          0   IO-APIC    9-fasteoi   acpi                                                
  12:    5359854     302833          0          0   IO-APIC   12-edge      i8042                                               
  20:          0          0          3          0   IO-APIC   20-fasteoi   i801_smbus                                          
 123:     857701          0          0          0   PCI-MSI 376832-edge      ahci[0000:00:17.0]                                
 124:          0        135          0          0   PCI-MSI 360448-edge      mei_me                                            
 125:      20289          0     515793      81440   PCI-MSI 327680-edge      xhci_hcd                                          
 126:          0          0          0          0   PCI-MSI 2621440-edge      mmc0                                             
 127:          0          0       6657          0   PCI-MSI 514048-edge      snd_hda_intel:card0                               
 128:       2490          0    1013338    4882675   PCI-MSI 1048576-edge      iwlwifi                                          
 129:       2658   12375366          0        193   PCI-MSI 32768-edge      i915                                               
 130:          0          0     137480          6   PCI-MSI 520192-edge      enp0s31f6                                         
 NMI:        144        912        888        886   Non-maskable interrupts                                                    
 LOC:   34154003   38515829   37693684   36393494   Local timer interrupts                                                     
 SPU:          0          0          0          0   Spurious interrupts                                                        
(略)

/proc/bus/pci/devices

PCIのデバイス情報を取得可能


yuta ❯ ~ 
❯❯❯ lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers (rev 08)
00:02.0 VGA compatible controller: Intel Corporation Skylake GT2 [HD Graphics 520] (rev 07)
00:08.0 System peripheral: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th/8th Gen Core Processor Gaussian Mixture Model
00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21)
00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21)
00:17.0 SATA controller: Intel Corporation Sunrise Point-LP SATA Controller [AHCI mode] (rev 21)
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #4 (rev f1)
00:1c.4 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #5 (rev f1)
00:1c.5 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #6 (rev f1)
00:1f.0 ISA bridge: Intel Corporation Sunrise Point-LP LPC Controller (rev 21)
00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21)
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)
00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21)
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection I219-V (rev 21)
02:00.0 Network controller: Intel Corporation Wireless 8260 (rev 3a)
05:00.0 SD Host controller: O2 Micro, Inc. SD/MMC Card Reader Controller (rev 01)

/proc/scsi/scsi

/proc/bus/usb/devices

参考

https://linuc.org/study/knowledge/

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?