Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The process under Linux

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Where there are people, there are rivers and lakes.

The Linux process is no exception.

Where there is progress, there are also rivers and lakes.

In those years, the jianghu bosses who wanted to quit their lives.

According to the routines of martial arts novels: once a master decides to quit and retire, the end will often be miserable, and even cause the whole martial arts turmoil. For example, Liu Zhengfeng of the Hengshan School was tired of the rivers and lakes and planned to become a musician, so he had a meeting to wash his hands, and his family was destroyed by the Songshan School. For example, Lv Tengkong, the boss of the Flying Tiger Dart Bureau, took a big order at the scene of the golden basin meeting, and the magic piano reappeared, once again turning the rivers and lakes into bloodshed. When people are drifting in the rivers and lakes, how can they not get a knife? when they come out to hang out, they always have to pay back. Eat dry, wipe clean, it is difficult to get rid of the shopkeeper, as the saying goes: once you enter the rivers and lakes as deep as the sea, you will be a member of the game from then on.

Not only in the knight-errant world, but also in the long river of social history, everyone is basically threatened by the historical process, followed by ups and downs, and few people can get out perfectly. For example, Hu Xueyan and Shen Wansan, such as Shen Yishi, a businessman in the Ming Dynasty, and A Ren in Infernal Affairs, extricate themselves from a realistic version of the remaining sins:

"three years later, three years later, it's been almost 10 years, boss."

"it's your birthday, brat!"

In a game without an elegant exit mechanism, it takes great wisdom and execution to fight and get out perfectly: not only to resist the temptation not to earn the last penny, but also to be bold and quick in the implementation of the strategy. Never sloppy. However, most people do not have the luck and wisdom, always feel that they can control everything, always want to finish this vote and quit, and end up risking everything they have, even their lives. In order to think of obsession, people tend to become irrational, various weaknesses of human nature begin to leak, and it is easy to fall into all kinds of disputes and struggles, such as power, wealth and status.

This is true not only for human beings, but also for processes. Basically, all processes in a computer system are happy to seize control of CPU, talk to terminals, and run in the foreground.

Enter the world of Linux process

Type the top command in Linux's shell environment, and you can see all the processes running in the entire Linux system:

For example, in my Ubuntu environment, you can clearly see that the current system has a total of 195 processes, of which one is running on running and the other 194 are asleep. In addition, we can also see the memory, CPU utilization, and the running status of the process. If we want to see the relationship between these processes, we can type the pstree command in the shell environment:

Through the pstree command, we can view the whole process tree and the relationship between each process: parent process, child process, first process, control process. If we continue to analyze processes, we will find that each process does not exist in isolation, and most of the time they work together with other processes through various mechanisms to accomplish a task These processes that work together form a process group, which is somewhat similar to the various combinations in martial arts novels, such as Jiangnan Strange, Tiangang Beidou Array, Luohan Array, Xuanxian Erlai, Taogu Liuxian and so on. So how do they work together? Quite simply, each process should have its own role and positioning: parent process, child process, control process, first process, foreground process, background process, daemon process, orphan process, zombie process. In addition to the process mechanism, there are also inter-process communication, OS scheduling strategy and so on, just like human beings: where there are people, there are rivers and lakes, where there are processes, there are also rivers and lakes.

A golden quitting of the Linux process

When people are floating in the rivers and lakes, how can they not be cut off? If a process wants to quit and stop running, will it cause chaos in the whole Linux? The answer is no. Because the Linux system has a variety of perfect exit mechanism, hosting mechanism, cleaning mechanism. If a process wants to stop running, just call exit, which can elegantly break away from the process tree under pstree without affecting the stable operation of other processes in the whole Linux.

"Linux system programming" No. 04: the release of the second pulse course of getting through the process and terminal

Starting from this course, we will officially enter the study of multitasking concurrent programming. The main content of this course: how to create, control and run a process through Linux's system call interface fork/exec/wait/exit; what is the relationship between the process and the terminal? Why can we use an environment such as shell/SSH/xshell/putty/ serial port to run our program and print the results to the interface of these software? Why can we use ctrl+C to terminate the execution of a process? How do processes work together? What is the foreground process? Background process? Daemon? Orphan process? Zombie process? These are the key points of this course.

Course video learning home page: https://edu.51cto.com/sd/6e080

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report