OneCompiler

Process Management - Class10

140

Process Management

When you launch any application or command, a process is created for that particular application and runs in the background (similar to the Task Manager in Windows). Each process is identified by a unique Process ID (PID).

Commands for Process Management:

  1. ps: Lists the running processes.

    • ps -eaf: Lists all running processes.
  2. Kill a process by PID:

    • kill -9 <PID>: Forcefully terminates the process with the specified PID.
  3. Kill a process by name:

    • pkill <process_name>: Terminates the process by its name.
  4. top: Displays real-time system performance, including:

    • Uptime
    • Tasks (foreground and background)
    • CPU utilization
    • Memory utilization
    • Swap memory usage

Swap Memory:

Swap memory is used when the main memory (RAM) is full. The Linux kernel may move inactive or "sleeping" processes to swap memory to free up RAM for active processes.


Package Management

In Linux, applications are distributed as packages. There are several ways to install packages:

  1. RPM (Red Hat Package Manager):

    • RPM files have the .rpm extension.
    • Example: python3.orge.12912.rpm

    Commands:

    • Install an RPM package:

      rpm -ivh <package_name>
      

      Example:

      rpm -i python3.orge.12912.rpm
      
    • List installed RPM packages:

      rpm -qa <rpm_package_name>
      

      Example:

      rpm -qa python3.orge.12912.rpm
      
    • Remove/Uninstall an RPM package:

      rpm -evh <rpm_package_name>
      
  2. YUM (Yellowdog Updater, Modified):

    • YUM is a higher-level package manager that uses RPM packages and resolves dependencies automatically.
  3. APT (Advanced Package Tool):

    • Used in Debian-based distributions like Ubuntu.

    • Install a package:

      apt-get install <package_name>
      

      Example:

      apt-get install python3
      
    • Uninstall a package:

      apt-get remove <package_name>
      
  4. wget:

    • Used to download files or packages from the internet.
    • Syntax:
      wget <URL>
      

Types of Packages:

  1. Online Packages: Installed directly from the internet.
  2. Offline Packages: Downloaded and installed manually (e.g., .rpm or .deb files).