CompTIA Linux+ XK0-005 – Unit 07 – Process and Module Management Part 3

  • By
  • August 6, 2023
0 Comment

19. Foreground and Background

Now, another option you have is to run the same type of command but in the background so that it’s not in the foreground waiting to be finished before you can go back to your shell to do that which we described before was called a foreground process. We run it as a background process, and that’s not that hard to do. Again, it still does everything else that we said before. It’s going to run it in the subhead shell. It’s going to do its job, execute and come back and let you know when it’s done. But you can still do more work in the parent shell without having to wait. The only thing you need to do, remember, is that when this happens is you precede the background stuff or you set it up to run in the background with the ampersand. So you type in the command with an ampersand. The ampersand says this process in the background, so it’s still going to fork, but you’re not going to be stuck waiting for it to finish.

20. Demo – Comparing Foreground and Background Processes

Well, one of the other things we can look at with processes besides killing them off is to talk about foreground and background. So I’m going to type in the command sleep 600 that killed off. As you can see, my chance for ten minutes of doing anything with this particular shell. Now, the quick and easy kill was CTRL C. It’s kind of a universal kill, all the running processes in your shell. But we can have these these programs running in the background by putting an ampersand at the end of each of our commands. So what that does now is it gives me the sleep command still running, but it’s running in the background. So I have my command line back ready for me to go PS. All right, take a look. And you can see PS shows me I’m running sleep.

Now, if I want to use the foreground, I could say, bring back to the foreground that last command, Sleep 600. And now I’m back asleep. Okay, CTRL C. Well, let’s take a look at what happens if I run this sleep command three times. I’ve got three processes going. I give you the PS. You can see them all. There 233-1323. So I’ve got that running all the time. Now I’m going to type in jobs. And you can see I have three running jobs. So I’m going to say, let’s kill all, and the names of the jobs are asleep, terminated them all. We’ll do another jobs command, don’t have any more jobs. So I found a fast way of just kind of playing around with those processes running within my shell, foreground and background.

21. Process Priority

Alright, you are going to have a lot of processes running and they’re all going to have a different priority. Now, priority just means who is more important to the operating system and gets the first call at getting time on the CPU. In other words, if you have the highest rating, which is a priority of zero or the lowest rating of a priority 127, the highest rating one is going to get more processor time time than the lowest one. Now, this always confuses me because to me priority was the game of bowling, not the game of golf. Priority meant high score wins. In this case, it’s a golf game, low score wins. But that’s okay as long as you just remember it sounds opposite of what I just said.

Things are good, but it does determine your time slice. How much time do you get? Obviously, some system processes are going to take more prevalence in this entire thing than, oh, I don’t know, some little print job running in the background. So we want it to have the mouse and the keyboard and the screen and all that stuff running at the high priorities. Now, in some operating systems, you can just flat out change priorities altogether to make something like your mouse more important and the main kernel of the operating system. In that case, things pretty much come to a crash, so you can’t really change it by a numerical value.

We just know that there is a range from zero to 127. But you can use some commands to try to give certain processes either higher or lower priority. As an example, if I’m playing my favorite game and I’m trying to create a print job at the same time, and that print job keeps interrupting my game, making it run slow, and the print job is of no. Consequence to me I might try to make the process that is my game run with a higher priority than the print process so that I get more time slice than the other. OK, that is a good anti productive example of what not to do at work, but it gives you an idea of what I’m trying to accomplish by prioritizing these different processes.

22. Viewing Priorities

Now, first you probably want to view the priorities that already exist for each of the processes. I think that’s an important factor that if you’re going to make some changes, it’s probably a good idea that you see what those priorities are and you see a PRI column. That’s the priority. And if you want to sort them, remember your top command, but you want to look at what those priorities are so that you can kind of get an idea that if I change a priority of this process, would it or what would it negatively affect, that being other processes that are running. I think that’s an important aspect that you should know of the ripple effect.

If I say, take this low priority, make it a little higher, what did I do with everything else? And then can I complain if everything else runs? Credit because you made this process prioritization. So just take a look at it first, see what those priorities are so you’ve kind of get an idea of the range where they run and maybe get an idea of how you want to affect the priority of a certain process that you are going to change. Again, you’re going to be actually using a command that makes a suggested range of changes. And so you should see what it is now, so you’ll know what that range is going to affect.

23. Setting Priorities

Alright so when we talk about setting the priorities, you have to remember you are not going to directly set those priorities. We’re going to use a command that’s called the nice command it’s a nice way to suggest a priority. Now when you use the nice command, you’re going to have a minus and positive number range I think from -20 to plus 19 range that you can use as a suggestion of how to change the priority priority. Obviously the negative value is going to suggest that you make it a higher priority by moving it closer to zero. Remember golf game the positive number is actually going to say this is not as an important process make it lower priority.

Now when you put that in, you have to also make sure you name the process and it allows the kernel to make the decision whether or not it wants to follow your suggestion. But it can then choose how to best deal with your request on a particular process. Now, when you’re ready to set that process back to normal, and especially if you didn’t even look to see what normal was, there is a command called the RENAISS which basically says reset it to the original nice command for that process. And again, knowing the process ID makes this even easier because you can reference the processes by their PIDS.

24. Renice

So as an example, you’ve got this process. You’ve got your game running at a high process. The printer is down there in the middle of nowhere, and now the print job is done. And you say, okay, well, I can put this game back to its normal setting. So you would just type in Renee, put in the process ID, and then let it go, and that would tell it to put it back to its original priority.

25. Demo – Managing Process Priorities

All right, so I have two terminal windows open again, so we can play with the processes in one terminal window being affected by another one. And I’m going to put in this Sleep 600 so that I’ve got this first terminal being inactive for me. And on this side, we saw some of these commands already, El. We’re going to list the processes for everything when grep for sleep. And if I keep on talking about sleep, I’m going to be sleepy all myself. All right, so there we’ve got the list of those processes. Actually, I’m thinking two of those processes running right now. That’s kind of why I prefer the Ox here. It’s a little easier, I think, to see these. There we go. I’ve got the one sleep that is the actual sleep command, 23 321. Seeing that’s this process here, see, I just like PS Ox.

It’s easier for me to read. And then this other one, which is the Grep command. So that’s the process that we’re dealing with right there, 23 321. Now, one of the things that we are going to look at is what is the priorities of some of these things. In fact, I’m going to make this wide screen again, run that same Grep command just so we can get an idea of some of the options and start looking at priorities, because that’s kind of what we’re going to deal with, is dealing with priorities. In fact, PS El Grep sleep might also be nice enough to give us some of those finer points of information as well. And then we’re going to start playing around with these processes. So again, PS El is giving me both processes, whereas the PS ox at least gave me each one broken down by each user, okay.

Or by each actual process. All right, so let’s start playing with stuff here and see what happens if we go out there and start changing the way in which a process runs. Now, what I’m going to do is I’m going to kill sleep. There we go. And by killing the sleep, let’s go back here to the background window. I got my prompt back. What we’re going to do is we’re going to use this command nice dash n 15, sleep 600. So what we’re doing is we’re really saying we’re going to run that sleep command again, but nice, remember now is my way of trying to get just a little bit less priority than what I had before. So now when I’m looking at my process for the actual Sleep 600, I see that it is nice, a little nicer than it was before. Let’s try the PSEL.

And when I look at the PSEL value from the first time up here, where it was running just at its regular zero, or I should say 80, I see that I said let’s add 15. And it did, and it made it a value of 95. Okay. So that was pretty straightforward. It allowed me to play around with that process and change the value of the priorities by doing that. And the next thing we’re going to do is see if we can’t go in there and do a little re nice. So a, Renee, now I’m going to run as the administrator here. Re. Nice. Now, remember, I can’t do this on the other window because it’s sleeping, and I want to subtract ten from that process. And the process is 23. Three, three, one. It looks like based on that list and boom password for the here we go. For the root.

Old priority was 15. New priority is minus ten. And let’s do that again. PSEL. So now instead of it being 80 or 90 or 95 like it was, it’s now 70. So it’s running within a higher priority. And if I do the same thing with the PS OC, we can see that it’s running with less than being as nice as it was before. All right, so that’s where PSEL, I think, shows up a little better than this because it’s a little harder to understand what’s going on with the actual value. All right, so anyway, there’s two options that you have and of course, I’m going to kill all the sleep again and everybody’s back awake. So playing with priorities, using something benign in our example is great to practice with because you’re not going to cause input output devices to be ignored or to cause things to run. Haphazardly. By the way, you do the priorities with the sleep command.

Comments
* The most recent comment are at the top

Interesting posts

Preparing for Juniper Networks JNCIA-Junos Exam: Key Topics and Mock Exam Resources

So, you’ve decided to take the plunge and go for the Juniper Networks JNCIA-Junos certification, huh? Great choice! This certification serves as a robust foundation for anyone aiming to build a career in networking. However, preparing for the exam can be a daunting task. The good news is that this guide covers the key topics… Read More »

Mastering Microsoft Azure Fundamentals AZ-900: Essential Study Materials

Ever wondered how businesses run these days without giant server rooms? That’s the magic of cloud computing, and Microsoft Azure is a leading cloud platform. Thinking about a career in this exciting field? If so, mastering the Microsoft Certified: Azure Fundamentals certification through passing the AZ-900 exam is the perfect starting point for you. This… Read More »

The Impact of Remote Work on IT Certification Exam Processes

With remote work becoming the new norm, it’s not just our daily routines that have changed but also how we tackle IT certification exams. Gone are the days of trekking to testing centers; now, your living room can double as an exam room. This shift has brought about some fascinating changes and challenges. Let’s dive… Read More »

IT Risk Management: CRISC Certification Exam Essentials

Do you ever feel like the IT world is moving at warp speed? New tech seems to pop up every day, leaving you wondering how to keep up and truly stand out in your field. Companies are increasingly concerned about online threats, data leaks, and meeting legal requirements. That’s where the CRISC (Certified in Risk… Read More »

The Ultimate Guide to Mastering Marketing Automation for Email Wizards

Hey there, email aficionados! Welcome to your new favorite read – the one that’s going to turbocharge your email marketing game. You’re about to dive into the captivating world of marketing automation, a place where efficiency meets effectiveness, letting you boost your campaigns without breaking a sweat. Get ready to discover how automation can not… Read More »

Master YouTube Marketing with These 10 Powerful Steps

Welcome to the dynamic world of YouTube marketing! Whether you’re a seasoned pro or just getting started, harnessing the power of YouTube can significantly boost your brand’s visibility and engagement. With over 2 billion monthly active users, YouTube offers a vast audience for your content. But how do you stand out in such a crowded… Read More »

sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |