In a UNIX system, each system and end user task is included in a process. The system always creates new processes, and the process terminates when the task ends or occurs unexpectedly. In this article, you will learn how to control processes and use commands to view your system.
I was fascinated by a single band at a recent street recreation. Indeed, it made me very happy and impressed me. The sole member of this single band used his mouth, thighs, knees and feet to control the harmonica, the banjo, the cymbals and the drums, and vividly played the "Stairway to Heaven" of the Zeppelin band, and his Beethoven "Symphony V" was quite moving. Compared with him, I can pat my head and feel the stomach is very good. (or touch the head while patting the stomach.) )
Fortunately for you, the UNIX® operating system is more like a single band than a clumsy columnist like me. UNIX is particularly adept at handling multiple tasks simultaneously and arranging them to access limited resources (memory, devices, and CPUs) in the system. UNIX, for example, can take a walk while chewing gum.
This month we're going to go deeper than usual and we'll see how UNIX can do so much at the same time. This time we will also explore the inside of the shell to see how the work control commands, such as CTRL + C (terminate) and ctrl+z (hang), are implemented.
A really multitasking system.
In UNIX (and most modern operating systems, including microsoft®windows®, Mac OS X, FreeBSD, and linux®), each computing task is represented by a single process. UNIX seems to be able to run many tasks at the same time, because each process takes turns (conceptually) to a small slice of CPU time.
A process is like a container that is bundled with a running application, environment variable, application input and output, and the state of the process, including its priority and cumulative resource usage. Figure 1 shows a process.
Figure 1. Conceptual model of UNIX process