What is a PID?
Computer’s Operating Systems always assign a PID (Process Identifier) number to each process running on the system, this number is important because you need it to modify/alter priorities or kill the process.
PIDs are used by the kernel to track processes, and also used by many utilities, such as “ps“, “top“, and “kill“, running system-program processes are known as, services, subsystems, or “daemons”, and that’s the meaning of the letter “d” you will find on the names, let’s say mysqld, httpd, firewalld, etc.
Windows PID
Processes to be useful must be active, I mean running on memory and that make use of the computer resources, mainly CPU and Memory and that’s something you also have on windows machines, you can use the Windows “Task Manager” and go to the TAB “Details” (as shown in the follow screenshot) to see all the processes currently running on the system.
MariaDB PID and more
Now that you know a little bit more about PIDs you can execute the following CLI command to see information about the MariaDB Process ID.
ps aux | grep mysql
How to manually terminate (kill) a process
If for some reason, a process becomes errant or unresponsive, aka “zombie” you might want to terminate it, in these cases, the “kill” command is the tool to be used, see below the syntax:
kill -s PID
The “-s” parameter refer to the type of “signal” to be send to the process, this signal is usually sent by the kernel, the user, or a given program wanting to terminate the process, see below the most commonly used signals:
- 1 (SIGHUP) – causes server programs to reread their configuration files
- 9(SIGKILL) – causes the process to exit without performing routine shutdown tasks
- 15(SIGTERM) – causes the process to exit but allows it to close open files
If you don’t specify a signal, the default value is 15 (SIGTERM).