In this article, we will look at what are Linux Processes & Scheduling Algorithm. We will go through Linux processes lists and a few Linux Processes commands to get a good grasp on it.
We will also look at a few Linux Scheduling Algorithm examples along with the Bash Script coding implementation. We would also look at a few Linux scheduling tasks. There is a lot to cover, so let’s begin.
Prerequisite
- Must have Linux OS or its Virtual Machine (YouTube Tutorial)
- Basic Linux commands hands-on. (Check here)
Table of Content
Linux Processes & Scheduling Algorithm
What are Linux Processes?
When a command is given by a user, a task is created which needs to be executed. For that, the OS has to assign resources to that task. Those resources would then be utilized in order to finish the execution of that task. These tasks are called processes or process singular.
When a command is executed, it creates a new process, identified by its unique process id called PID.
We could all list Linux processes or could filter out only those Linux processes running in active state. We could even send these Linux processes to background execution so that we could simultaneously work on a different task.
Foreground and Background Processes
- Foreground Process: Any command executed will start a process until finished and run in the foreground by default.
It will be able to take in input from the user and display output to the screen. Like how it’s done generally. Example:
- Background Process: It will also perform the exact same task in the exact same way as it does in the foreground process. Except, it will do so in the background. (No duh)
Meaning it would not be interactive and you would be able to perform other tasks meanwhile the process is under execution in the background. Example:
The & sign would make any process work in the background.
Let’s have a practical look at these Linux processes commands.
Processes
1. View all Linux processes list:
2. View a single Linux process:
PS Options
1. Linux processes list which is active
-A: Shows all running processes in the system
-e: Shows the extended information about processes, it’s exactly like -A switch.
-F: It means Full, it shows additional information in full formated way
2. Processes that are owned by a certain user
-x: Shows process information about the current user
-U: Shows information about the processes of the user mentioned in the command. (it is followed by a username or a UID)
3. To view Linux processes with admin privileges.
4. Processes which are owned by a certain group
Attributes of a Process
- UID: User ID that this process belongs to (the person/user/account running it)
- PID: Process ID
- PPID: Parent process ID (the ID of the process that started it)
- C: CPU utilization of process
- STIME: Process start time
- TTY: Terminal type associated with the process
- TIME: CPU time is taken by the process
- CMD: The command that started this process
Termination of a Process
To terminate a specific process, execute the following command:
Linux Processes & Scheduling Algorithm
What is CPU Scheduling in Linux?
CPU Scheduling is a procedure where a certain task is assigned some resources to get executed.
All the tasks coming in are sent to a queue, where they would wait for their turn until all the previous tasks prior to it get executed. These tasks are called a process.
The CPU Scheduling’s job is to make sure that the CPU does not sit idle. And that it should be executing the next process from the queue. It’s the CPU Scheduler who decides which task/process would go next to be executed.
Why Scheduling is Important?
There are a few factors that the CPU Scheduler considers before deciding which process to send next for execution.
- Maximize throughput (number of processes executed per unit of time)
- Minimize wait time (the time each process must wait in the queue until its turn to execute)
- Minimize response time (the time taken to fully execute a process)
Based on the above parameters, Linux Scheduler improves performance and response time for all the tasks. Which is essential to improve user experience. Our goal is to maximize throughput but minimize wait and response time. You can read more here.
Two Types of Linux Schedulers
1. Preemptive Scheduler
If a scheduler is preemptive, then it could decide that a certain process had enough CPU resources assigned to it and could revoke it back. Only to give it to another process instead.
It’s done only to improve the overall performance. This decision of Linux Scheduling is based on the factors mentioned earlier.
2. Non-Preemptive Scheduler
If a scheduler is non-preemptive, then it does not follow the same rules as the previous scheduler type. It would only revoke a process resource once execution is finished, or the process is waiting for an IO operation response.
Scheduling Algorithm
Types of Scheduling Algorithm in Linux
There are quite a lot of Process Scheduling Algorithms in Linux. We will be focusing on mainly these 3.
- First Come First Served (FCFS)
- Shortest Job First (SJF)
- Round Robin (RR)
Scheduling Algorithm: First Come First Serve (FCFS)
Scheduling Algorithm FCFS is probably the easiest to understand. Linux processes are executed sequentially. A process only starts to execute, once the previous process has finished.
Pros
- It is a non-preemptive scheduling algorithm.
- It is easy to implement and use. FIFO wait queue.
Cons
- Poor performance as the wait time is high.
- Shorter tasks might have to wait for a long time.
Scheduling Algorithm: Shortest Job First (SJF)
Unlike the Scheduling Algorithm FCFS, the Shortest Job First (SJF) executes those processes first and takes the least time to finish execution. Regardless of which process was in the queue first.
Pros
- Done in batch environments.
- Shorter tasks do not have to wait long.
Cons
- Not preferred in shared systems. Because the length of execution would be unknown beforehand.
Scheduling Algorithm: Round Robin (RR)
In Round Robin Scheduling Algorithm, each process is assigned a certain time period, also known as quantum, in which they would get executed. After the period ends, the next process would start executing for their allotted time.
For instance, let’s take 3 processes A, B, and C. They were all assigned a time period by the scheduler. The first process A would start getting executed. Regardless of whether it has finished or not, once its quantum ends, the process is preempted, and process B would begin the execution.
Once all processes’ time period ends, process A would start again.
Pros
- All processes get an equal share of the CPU.
- It is generally used in multi-tasking scenarios.
Cons
- If the quantum is too long, then the RR algorithm essentially acts like FCFS.
- If the quantum is too short, it will lower the efficiency of the CPU.
Linux Scheduling Implementation
Shortest Job First (SJF)
1. Initialize arrays for Processes and Burst Time as:
2. Initialize the count
3. Setup loops
4. Swapping
Linux Scheduling Task
- Calculate batch job process sequence for provided data
- Print Job sequence with Job name and Burst Time
Processes | Burst Time |
firefox | 2 |
nano | 8 |
gedit | 4 |
1 | |
ftp | 3 |
http | 7 |
And that’s a wrap!
These commands will only work on a LINUX terminal. And a common way to run Linux with Windows is to start a Virtual Machine using VMware.
I hope this article helped you learn exactly what are Linux Processes & Scheduling Algorithm. You may also want to learn Basic Linux commands hands on or Linux Bash Scripting. Please like this article and leave your reviews in the comment section below.
Have a great one!
Recent Posts
- Analiza_skuteczności_strategii_finansowych_z_uwzględnieniem_fortuna_i_długote
- LuckyLouis Casino mobilapp: spil nemt og hurtigt på farten
- Úspešné_stratégie_a_možnosti_zisku_s_fortuna_pre_inteligentných_stávkarov
- Прогресс_игроков_заметно_увеличивается_с_1wi
- Strategy_and_insights_regarding_1win_demonstrate_enhanced_gaming_experiences
Recent Comments
Archives
- June 2026
- May 2026
- October 2025
- October 2024
- September 2024
- August 2024
- June 2024
- January 2024
- November 2023
- October 2023
- September 2023
- August 2023
- June 2023
- May 2023
- March 2023
- December 2022
- November 2022
- October 2022
- September 2022
- August 2022
- July 2022
- June 2022
- May 2022
- April 2022
- February 2022
- January 2022
- December 2021
- November 2021
- October 2021
- September 2021
- August 2021
- July 2021
Categories
- 21
- aks 1 en
- aks 1 pl
- aks 18
- aks 28
- aks 31
- Angular
- AWS
- Backend Development
- Big Data
- Blog
- Cloud
- crypto 01
- crypto 05
- crypto 15
- crypto 19 en
- crypto 20
- crypto 20.05
- crypto 21.05
- crypto 29
- crypto 5
- Database
- Deployment
- DevOps
- Docker
- fi
- Frontend Development
- GitHub
- Google Cloud Platform
- hu
- Installations
- it
- Java
- JavaScript
- Linux
- MySQL
- Networking
- News
- nl
- no
- NodeJS
- Online casino
- Operating System
- Post
- public
- Python
- Python Flask
- Report
- Security
- Server
- SpringBoot
- Subdomain
- sushicasino 13
- TypeScript
- Uncategorized
- VSCode
- Webhosting
- WordPress
- Στοιχηματικές
Search
Recent Post
Analiza_skuteczności_strategii_finansowych_z_uwzględnieniem_fortuna_i_długote
- 27 June, 2026
- 8 min read
LuckyLouis Casino mobilapp: spil nemt og hurtigt
- 27 June, 2026
- 4 min read
Úspešné_stratégie_a_možnosti_zisku_s_fortuna_pre_inteligentných_stávkarov
- 27 June, 2026
- 8 min read