Linux is a multitask Operating System, meaning that it can do many things at the same time. Well, not quite so, as the CPU will do just one thing at a time, but the OS will keep swapping processes into the CPU at high speed, and it will look to humans like the computer is doing many things at a time.
So a process, loosely speaking, is a task that the machine is doing at certain time (I will assume that the computer is doing many things, not getting into which one is actually being executed in the CPU). If you want to check processes you can use the ps command. For example, to see all processes run by you in your terminal (the place where you type your commands) you shold do
Some processes, task, programs, whatever you want to call it, are not started in the command line. What I mean is that you might have started a command with a mouse or some other method, rather than typing it in the terminal. Those processes will not show with just ps. So if you have a browser started with a mouse click, and want to see it in the processes list you have to do the following:
Ths way ps was called will show you only processes started by you. If you want to see all processes running in the system you will have to do the following:
The ps command gives very simple output, which I will explain in some other post. If you want to see how the commands "fight" for resources you can use the top command (use the key q to quit).
All processes are competing for the system resources, as you can see in the output of top, their priorities set up by the Operating System based on a bunch of algorithms and certain hardware constrains. But you can be nice and start a process with low priority, if you are not in a hurry to get the output. That can be done with a command like the following:
where command means exactly that, the command you want to execute.
As explained in my previous post, in a Linux computer many processes can run at the same time. I wrote how to use the nice command to start a process with priority lower than usual. This simple means that the Operating System will consider that process as something that can wait for execution, in case several processes are competing for resources (memory, CPU, hard disk writing/reading, etc).
But suppose you have started a process (a command) and you want to make it run with lower priority than the current one. How do you do that? Well, first of all, why would you want to do that? One reasons could be because you want another process to finish fast, so you need to put other processes in low priority. Well, one possible way to do it is by using the top command. Start it as follows, so you see only your processes:
top -u your-use-name
Look for the name of the process you want to slow down in the last column, then type r; the computer will ask you for the PID of the process, which is the first column in the output; type it. Then the computer will ask for the priority you want to give to that process. Here you have to give a positive integer. The bigger the integer the slower the process will run.
Another way of making a process slow down is with a command as this:
renice integer process-number
Here integer is again the priority. To get the process number use ps x as explained in the previous post.
What about making processes run faster? You would think that is natural, and giving a negative integer to top or renice will do that. Unfortunately only the superuser (root account) can do that.