Skip to main content

Command Palette

Search for a command to run...

Schedule a process during runtime via. renice

Published
2 min read
Schedule a process during runtime via. renice
M

Hi, How are you !! Hope you doing good....

I got introduced to Cloud initially. As I went ahead learning what is cloud and how it works, then got to know a field which is DevOps that makes Cloud model more effective.

So, as I started working & got good experience on AWS. I have been learning the DevOps tool and technologies on how to use it with the Cloud, which will give me good understanding on how Cloud and DevOps go hand in hand to deploy my applications.

Last Blog Review

In the last blog we understood, What are scheduling priorities of a process, Why this priority is important and how nice command is used to create user-defined process priorities.

What is the only disadvantage of using nice to schedule a process ?

The nice command can re-schedule a process during the launch of the process.

How to schedule a process during its running period ?

For this purpose we use renice command.

What’s a renice command ?

Its a command which helps to re-schedule one or more process in its runtime period.

Syntax

renice [-n] priority [-g|-p|-u] identifier

Here, the -g option considers succeeding an argument—that is, identifier as GIDs.

The -p option considers succeeding an argument—that is, identifier as PIDs.

The -u option considers succeeding an argument—that is, identifier as usernames or UIDs.

If none of the options—-g, -p, or -u—are provided, by default identifiers are considered as PIDs.

Ex.

1. Consider we have a user raj, running multiple process. We can check that using which will provide us all the process ran by raj-

$ top -u raj

2. Now say there are 10 process which are ran by raj, and the priority of firefox is 7. We want to schedule the running process again which is firefox to 1st. Make sure to check the PID of firefox in above o/p. Here the PID of firefox is 1001. We can achieve it by using rescheduling of running command via. renice command -

$ sudo renice -n 1 -p 1001

3. Check the process list again and you will see that the firefox is 1st process to be executed under raj.

$ top -u raj

Conclusion →

In this blog we understood, the process priority can scheduled manually during it’s launch process via. nice cmd. But if a running process’s priority has to be re-scheduled then it can done via. renice command.

💡
That’s a wrap for today’s post! I hope this has provided you some valuable insights. Be sure to explore more articles on our blog further advices. See ya in next post!