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?

[Linux][system][directory] 初期化システム_SysVinit, Upstart, systemd

Last updated at Posted at 2025-02-11

初期化システム

  • Linux システムの起動とプロセス管理を担う

初期化システムとその違い

項目 SysVinit Upstart systemd
起動方式 - 直列起動 - イベント駆動型
- 並列起動
- 並列起動
設定ファイル - /etc/inittab
- /etc/rc.d/
- /etc/event.d/
- /etc/init/
- /etc/systemd/system/
- /usr/lib/systemd/system/
起動速度 - 低速 - 中速 - 高速
採用ディストリビューション - 旧型(RHEL 6以前) - Ubuntu 9.10〜14.10 - 新型(RHEL 7以降、Ubuntu 15.04以降)
コマンド service initctl systemctl
管理単位 スクリプト job unit
cgroups対応 ❌ 非対応 ⚠️ 限定的に対応 ✅ 完全対応(リソース制御、階層管理など)

SysVinit

  1. initの起動
    • initはカーネルによって/sbin/initが呼び出されて開始される
  2. initの実行
    • /etc/inittabで、デフォルトのランレベルを確認する
  3. ランレベルに応じたサービスの起動
    • /etc/rc[0-6].dまたは/etc/init.d/ディレクトリ以下の起動スクリプトで、システムのサービスを開始、停止、再起動する
  4. プロセスのリリース管理
    • サービスやプロセスの管理はPID(プロセスID)を使用する
  5. ログイン画面の表示
    • サービスがすべて起動した後、initはログインプロンプトを表示する

systemd

  1. systemdの起動
    • systemdはカーネルによって/sbin/initが呼び出されて開始される
  2. systemdの実行
    • /etc/systemd/system/default.targetで、デフォルトのターゲットを確認する
  3. ターゲットに応じたUnitの読み込み・サービスの起動
    • /etc/systemd/systemディレクトリ以下のターゲットに応じたUnitの読み込み・サービスを起動する
    • systemdは、依存関係を考慮して並列でサービスを起動する)
  4. プロセスのリリース管理
    • サービスやプロセスの管理にcgroup(コントロールグループ)を使用する
  5. ログイン画面の表示
    • サービスがすべて起動した後、systemdはログインプロンプトを表示します

ランレベルとターゲット

ランレベル ターゲット
対象初期化システム init(SysVinit) systemd
停止 0 poweroff.target
シングルユーザーモード 1/s/S rescue.target
マルチユーザーモード
(テキストログイン)
2, 3, 4 multiuser.target
マルチユーザーモード
(グラフィカルログイン)
5 grafical.target
再起動 6 reboot.target

参考リンク

Ping-t

SysVinit

Upstart

systemd

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?