CompTIA Linux+ XK0-005 – Unit 07 – Process and Module Management Part 1
1. Topic A: Process Management
All right. In this unit we’re going to talk about our processes and module management. Now this is really getting into the deeper parts of the operating system of its functionality where we actually care about all the little processes that are running in their parent processes. So we’re going to talk about what they are, how to view them, describe what they do, how to kill them if we need to or perhaps even change some of the process priorities. And then from there we’ll talk about how do you can view your kernel information and manage the different modules that make up this entire thing. We call our Linux operating system.
2. Process Management
All right, so first we’re going to talk about process management and try to get any confusions about difference from a process to a program, and then hopefully let you know why we actually care about managing these processes.
3. Processes Part
All right, so first of all, a program is not a process. I mean, it sounds similar and when you look at it, but really a program, and I know I’m playing semantics, it’s an executable file that’s on a disk. It’s not the running of it. If it’s running, that’s the process. I know just to playing a little game with words, the process is considered an instance of that program. Now, some processes might actually support more than one program or may be called as a part of another program running. Those would be things like child processes. So we’ll get into the processes a little bit more. But that also helps give you a distinction between a file on a drive versus something that’s running and in memory. Now, of those processes, we categorize them in two ways user and system. The user processes are those processes that are applications you started.
A system process is something the operating system is running to be successful in whatever it’s trying to execute, whether it’s DNS services or DHCP or your file system quotas, whatever those things are that the operating system is dealing with are system processes. Technically you see a list of processes, but they’re not all running simultaneously. Now, you might even see that with little outputs that say this process is running at 20% and this one’s at 10%. You’re saying, well yeah, they’re running. It looks like they’re both running. They’re actually sharing time on that processor through this thing we call giving it a time slice. In fact, that’s what the operating system’s job is to do, is to manage those processes and give them each their own share of the processor. Now, if you have a multiprocessor box, well, then you actually could have multiple processors running at the same time, one on each of those processors.
4. Processes Part
In the advanced single processes there might be times when both might, for a short while overlap their use in a processor so that you could say they were technically for however many nanoseconds running simultaneously. But again, now we’re playing even worse word games so they don’t run simultaneously on the same processor. The operating system’s job is to go out there and deal with that. And we call it today preemptive multitasking. Preemptive means that it is the operating system that is in charge of choosing when to make that change. Prior to that, we had what was called cooperative multitasking. Cooperative meant that a program would run and when it was done, it would then say I’m done. And another program, whoever was next in line would get to use the processor until they’re done.
Now, the problem with that and I use my kids as an example I got all sorts of kids. I got a handful enough for a basketball team. And the way I look at it, it’s like this they’re playing ball, one of them. Besides, they don’t like how the others are playing so they keep the ball and they run around the field and won’t let anybody have their turn. That is the cooperative multitasking. The little child is not cooperating very well. They all complain. And so dad comes out, takes the ball from the little one and gives it back to everybody else to play with. That’s the operating system doing the preemptive multitasking. I, being the dad, was the operating system and I forced the application to give up its time and share it.
That’s the type of system you’ll see today when it’s the operating system splitting time. Hopefully you all got some good mental pictures there. But that does, I think, a good job of explaining what we are talking about. Now, these processes, these system processes that are running the ones on the operating system have been named demons, named after demons. These little imps or whatever they were in mythological days that would run and do all these little errands and things like that. Again, the folks involved in doing a lot of these processes is programming. They’re creative in their names and so you let them have some fun. That’s what they’re doing.
5. Process IDs Part
Now, every process that is running is given a unique identifier. Now, there are some specific identifiers that we’ll see for two of the processes. The rest are pretty much given out by randomness out of a list of available process IDs. The process ID itself. Process ID zero is the kernel or the operating system itself starting up? Well, we’re when the kernel first boots up, it’s going to call another process ID or another process called the init daemon or the initialization daemon. Now, the initd is how you normally see it. You’ve heard us talk about it, already gets the process ID of one. But if you look at it, it has what’s called a PPID or a parent process ID. That is, which process called it. Well, its parent ID is PPID zero or process ID zero, the kernel itself.
So that’s kind of how you can tell whether there’s a child process or a parent process or how they’re related. And that’s an important feature as well. When you’re trying to work with processes, determining if something’s running poorly, you need to kill it, you need to restart it. In fact, most everything begins from the initd, which is where we would go if we needed to start or restart or stop processes. As an example, where we mentioned it before was how to stop the actual X window process. And we showed you where you could go to the init de and stop that X window program. If you’re running any type of service, you can go to the init D and say restart and tell me which process to restart or which service, and it’s away doing those soft reboots to issues that are happening in the background. So it is the initdaon, the initialization damon.
6. Process IDs Part
Now, when these processes are building and one process calls another process and those might call other processes, you create what we call a process tree. And obviously it starts at process ID zero and branches down from there to all of these little branches or leaves or other terms that we use for describing a tree. And it’s an important part of our understanding of the operating system, how those all interrelate. Because how you change one process could, good or bad affect some other processes, which, in effect, is how our programs are running.
7. Demo – Exploring Processes
All right, we’re going to take a look at our command line and our Gui’s to take a look at some of these processes and what we can see through both options. I’m going to go to the applications the system tools and system monitor. All right, so System Monitor has kind of a quick little GUI graph to kind of show you a CPU history, network history, memory and the rest. I’m going to click on the Processes tab and this will show us the status of a lot of different processes. Now remember, the process itself is a program that is running. It’s not the program, but one that is running. You can see the percentage of CPU use that some of these different processes are running. If I click on the CPU column, its job is to give me kind of that top option, top being that it’s going to put the top user at the top or if I click it again, the bottom use at the bottom.
So here we go. This one’s got the top where the top user is going on, which is just System Monitor really it’s we’re not doing a whole lot. I can click on the Memory tab and for the same reasons, I can see which of these processes is using up most of my free memory that I have. And I can go to system information file system information? So it’s kind of a nice little tool graphically to see what we’re doing. Now, real quick, I just went back to Resources and you see a little spike here up to 100% on this CPU. Like I said, that’s not bad. That’s very typical. It just means that I was doing something that and if you can figure this whole line of 60 seconds that for like about 2 seconds caused the CPU to spike. So that’s very normal. It’s if this trend were staying up all the way at 100% or 80% and above nonstop, that’s when we would be worrying.
All right, so let’s go ahead and close down System Monitor and we’re going to take a look at some of the other options with our terminal window. So let’s use Applications and go to the Trainer or I’m sorry, to the Shell. I’m logged in as Trainer and we’re going to try some of these options like PS tree for the process tree and we’re going to pipe it into a more command so that we can kind of get an idea again about the processes that are running and see it in a hierarchical mode. And we should see most everything starting with the init or in. It the initial daemon that starts up running the initial process and everything goes underneath that. Now here we have the Ganom Desktop Manager. That’s the stuff that’s basically our X windows so we can see underneath that process another kind of again the tree hierarchy of those processes running.
And I can hit the spacebar and you can just kind of get the idea from there. The gnome terminal on it goes all the way through these different processes that are running. Now let’s try pstree with the dash dash help to see what the other options are. I just ran it as a program. One of the ones you might care about is actually seeing the process IDs that are running with each one. So there’s the dash p to be able to show us that information and we’ll give that a shot. So here’s the PS tree p and I should have piped it into my more command. I should know better by now. And again, here we are seeing the tree and now I have next to the processes the actual process ID. And we expected the init D to be the process of one and above that the one that’s unseen is the actual kernel itself, which is a process of zero.
All right, so that gives us kind of some nice information again about what’s running and it doesn’t give us quite the way the information that we wanted to see from the system monitor where we could actually get a little more information about how it’s behaving. But let’s look at that PS tree help again so we can see only those things that are running by a particular user. We can try to sort the output by process IDs. Again, you just have a lot of options that you can get information just off of this process, part of it, which I think you might find helpful in trying to figure out what’s running. Okay, another set of options. We’re going to do a listing command of the directory proc again, pipe that into the more command so that we can actually get a better idea about what’s running in this case.
Now you can see the different things that are showing up at the processes that are running. As we take a look through here, you get the idea of the process IDs and all of these other options that we’ve had as I scroll on through here. So you get the idea I’m hitting the space bar if you’re wondering. I’m just showing you all of these different processes that you can take a look at. That’s the process directory. All right, now one last thing we might want to do is take a look at the PID number one and within that directory to figure out what else might be happening inside there. So we’re going to try a cat command with that proc and we’re going to go with process ID one and we’ll put in the mounts here.
And the mounts file should correspond to all the process named mounts and that should be tracking our file systems that are mounted to the system and displaying that contents of this file should be able to see all of the currently mounted volumes. So that’s kind of a way of taking more advantage. But I’m afraid that because it is the init Damon process one that I might get a permission refused. Since I’m only logged in right now as the trainer, let’s see what happens. Well, no, it looks like it was willing to give me that information about the root file system. So that worked out pretty well. Shows me from the root all of the things that are mounted, all of the devices. USBs, right. You know, the here we go, the SDA one, how it’s formatted, which is the main drive on this, or actually my backup drive.
I think I have an SDA Zero here as well if I’m looking through this list. But again, the idea is it’s showing me all of the different file systems. It talks about the root file system and everything that I expect to see mounted within this system. So it’s kind of a nice option to put in there. I’m going to try the super user and see if the information comes out just a little bit different with that same cat command. And now it pretty much gives me the same, same set of information that I had before. So again, it’s just a method of going through and dealing with your process management, probably. I would say the GUI is a nicer method of looking at some of the options of filtering, of sorting, of determining what’s running than the command line. But the command line is also something that’s scriptable.
8. The ps Command
Now, if you would like to see which processors are running, there’s a series of PS commands that you can run that let you view all of those processes. Now, most often, you’re going to see those commands come in a couple of forms. The PS options that come with it will either have a dash option no dash whatsoever, or two dashes. Well, what do they mean? That just means you need to look up the help file on the PS command command or the man page to figure out what those options are.
Don’t worry, we’ll talk about a couple of them. So you get an idea of how those options affect the processes that you view. But that’s all it is, is we’re viewing processes. None of these are dealing with killing anything or something negative to that effect. It’s just what information do you want to see other than just a generic, here’s a list of processes? So these options kind of addons or filters of more information, generally more information than just the list.
9. Common ps Command Forms Part
All right, so here are some of the common options that you would have. First of all, the PS with the F that will list what we call the full details about a process that’s in your current shell. If you ran PS EF, that lists all the details about processes I like this. Across all terminals, including the daemons, PSL lists the full details, plus the process flag that is associated with the process permissions, the process state, the weight channel, and even more information. There you go. That’s full details.
10. Common ps Command Forms Part
The Psax notice, I didn’t say dash will list the process priority, the process state and CPU time associated with the processes across all of your terminals and daemons. The Psaux or Ox is similar to the Ax option, but this just adds the percentages of CPU time and memory and the user ID that’s associated with with the various processes. All right, so what are we getting at? We’re saying that these commands, this PS command, has many options to help you in understanding what processes are running, what’s dependent on it, the resources it’s using, and even which user is associated with those processes. It’s a matter of your being able to see information that helps you judge how things are running on that Linux operating system.
Interesting posts
The Growing Demand for IT Certifications in the Fintech Industry
The fintech industry is experiencing an unprecedented boom, driven by the relentless pace of technological innovation and the increasing integration of financial services with digital platforms. As the lines between finance and technology blur, the need for highly skilled professionals who can navigate both worlds is greater than ever. One of the most effective ways… Read More »
CompTIA Security+ vs. CEH: Entry-Level Cybersecurity Certifications Compared
In today’s digital world, cybersecurity is no longer just a technical concern; it’s a critical business priority. With cyber threats evolving rapidly, organizations of all sizes are seeking skilled professionals to protect their digital assets. For those looking to break into the cybersecurity field, earning a certification is a great way to validate your skills… Read More »
The Evolving Role of ITIL: What’s New in ITIL 4 Managing Professional Transition Exam?
If you’ve been in the IT service management (ITSM) world for a while, you’ve probably heard of ITIL – the framework that’s been guiding IT professionals in delivering high-quality services for decades. The Information Technology Infrastructure Library (ITIL) has evolved significantly over the years, and its latest iteration, ITIL 4, marks a substantial shift in… Read More »
SASE and Zero Trust: How New Security Architectures are Shaping Cisco’s CyberOps Certification
As cybersecurity threats become increasingly sophisticated and pervasive, traditional security models are proving inadequate for today’s complex digital environments. To address these challenges, modern security frameworks such as SASE (Secure Access Service Edge) and Zero Trust are revolutionizing how organizations protect their networks and data. Recognizing the shift towards these advanced security architectures, Cisco has… Read More »
CompTIA’s CASP+ (CAS-004) Gets Tougher: What’s New in Advanced Security Practitioner Certification?
The cybersecurity landscape is constantly evolving, and with it, the certifications that validate the expertise of security professionals must adapt to address new challenges and technologies. CompTIA’s CASP+ (CompTIA Advanced Security Practitioner) certification has long been a hallmark of advanced knowledge in cybersecurity, distinguishing those who are capable of designing, implementing, and managing enterprise-level security… Read More »
Azure DevOps Engineer Expert Certification: What’s Changed in the New AZ-400 Exam Blueprint?
The cloud landscape is evolving at a breakneck pace, and with it, the certifications that validate an IT professional’s skills. One such certification is the Microsoft Certified: DevOps Engineer Expert, which is validated through the AZ-400 exam. This exam has undergone significant changes to reflect the latest trends, tools, and methodologies in the DevOps world.… Read More »