Understanding Operating Systems and Processes
Overview of Operating Systems (OS)
An operating system (OS) is essential for managing hardware resources and running programs. Its primary role is to serve as an intermediary between the user and the computer hardware, enabling the execution of software.
Methods to Access an OS
There are four main ways to run and access operating systems:
Bare Metal: The OS is installed directly on the hardware without any intermediaries.
Cloud: The OS is hosted on remote servers, accessible via the internet.
Virtualization (e.g., VirtualBox): A hypervisor enables the OS to run as a virtual machine (VM) on top of another OS.
Containerization: Lightweight and portable, containerization allows isolated environments for applications without the overhead of a full OS per instance.
Role of the Hypervisor
A hypervisor is software that enables a single physical device to run multiple operating systems concurrently. It virtualizes hardware resources and assigns them to virtual machines.
Working with Processes in Linux
A process is an instance of a program in execution. In Linux, every process is assigned a unique Process ID (PID).
Launching a Program
If a program (e.g., Firefox) is launched via the terminal, it creates a process.
To monitor and manage this process, Linux provides various tools and commands.
Viewing Process Details
To view running processes along with their IDs, CPU, and RAM usage, use:
ps -aux
This command lists all processes, including details like the user, PID, and resource usage.
Managing Processes
If launched from the terminal:
Terminate: Use
Ctrl+C
to terminate the running process.Pause: Use
Ctrl+Z
to pause the running process.
If launched via GUI or terminal:
Terminate with
kill
:To terminate a process, use the command:
kill -9 <PID>
This forcibly ends the process identified by
<PID>
.
Resume a paused process with
kill
:To resume a paused process, use:
kill -19 <PID>
This sends the signal to restart the process.
Notes:
Using
kill -9
sends the SIGKILL signal, which terminates the process immediately without cleanup.Using
kill -19
sends the SIGCONT signal, which resumes a paused process.Ensure you have appropriate permissions to manage processes.
By understanding these fundamental concepts, you can effectively manage operating systems and processes in Linux environments.