In the world of computers, as in life, you may have a countless number of tasks (or programs) you want to run at the same time. However, you have only a limited amount of time (or central processing units) to put to work on the process. So how is it that any modern operating system manages to balance its priorities with ease? Finding out the answer to this question will be the central objective for today.
If you are a regular Codewalkers reader, you may already know that I've been covering related topics in a number of articles. In these I try to offer to you some insight into UNIX-based operating systems like Linux, FreeBSD and so on. I have already covered countless aspects of UNIX, like its terminal, file system and regular expressions. I also offered a quite detailed insight into the Born Again Shell script writing.
In this and the next few articles I will present the way UNIX works with processes. This will be from the point of view of the shell. I will occasionally refer to things I already presented in the articles mentioned earlier. Therefore, if you are not familiar with one of these expressions, I invite you to go back and read them.
As for today I will first explain what a process is. How is it possible to edit a Word document and listen to music with a single core processor under any modern operating system? Iíll also present a couple of basic commands inside the UNIX terminal with which you can easily see the status of these processes. Explaining what those commands show and how you can extract data from them is also on the agenda. So if you are interested, read on.
A single core can run a single process at a particular moment. A process is the example of a program running in the operating system. Whenever an operating system is running a particular program, besides the code, a couple of other pieces of information are also stored. This requires some sort of administration; therefore, an instance of a running program means more than just its code.
You can run multiple programs on a single CPU by giving every one of them a small amount of time to work. Then stop them and put them in the background. This is called multitasking. Do this fast enough, and the user will have the impression that all of them are running at the same time.