LINUX Process Programming, Linux Process

Updated on technology 2024-04-09
6 answers
  1. Anonymous users2024-02-07

    A vfork is used to create a new process, and the purpose of the new process is to exec, if the child process does not execute the exec or exit function, there will be many unknown problems.

    The result I did on ubuntu is as follows:

    the child id is 28831the parent id is 28830vfork: cxa_:99:

    new_exitfn: assertion `l != ((void *)0)' failed.

    aborted

    After executing the exit in the subprocess, the result is as follows:

    the child id is 28842the parent id is 28841

  2. Anonymous users2024-02-06

    You have a problem with the function writing, and you forgot to add return 0 at the end. It's a bad habit. vfork is a controversial function that is best not used and rarely used, and was originally designed to run fast for the exec() family of functions.

    As for why there are two sub-process numbers, you need to learn the elf process and the orphan admission mechanism to understand.

  3. Anonymous users2024-02-05

    Don't know much about C's multi-process (multi-threaded?) Programming, I didn't understand this program, I guess the reason may be:

    Processes (threads) are out of order.

    printf has an output cache (i.e. using printf output, not necessarily immediately).

  4. Anonymous users2024-02-04

    top: This command is used to display the current CPU process.

  5. Anonymous users2024-02-03

    Technical term: A command that manages a Linux system.

  6. Anonymous users2024-02-02

    What is a process

    In a narrow senseA process is a program that runs on an operating system

    Broadly speakingA process is a program with some independent function that runs on a collection of data. It is the basic unit of dynamic execution of the operating system, and in the traditional operating system, the process is both the basic allocation unit and the basic execution unit.

    Process control is the most basic function in process management. It is used to create a new process, terminate a completed process, or terminate a process that has been rendered unrunny due to an event, and is also responsible for state transitions in the running of the process.

    Several states of a process on a Linux system:

    The process is created by the operating systemThe second is created by the parent process

    What is a daemon? This is a description from Wikipedia.

    exit() and ecit().

    The difference between exit and return

    exitparametersThe normal exit parameter is as followsThe Exception Exit parameter is a non-zero value

Related questions
3 answers2024-04-09

First: Pipeline communication.

When two processes communicate through a pipeline, the process that sends the information is called the write process; The process that receives the information is called the read process. The intermediate medium of the pipeline communication mode is the file, which is usually called the pipe file, which connects a write process and a read process together like a pipe to achieve communication between the two processes. The write process writes information to the pipeline file through the write end; The read process reads information from the pipeline file through the readout. >>>More

6 answers2024-04-09

What is a thread?It is a path executed in a process and is the smallest unit of system scheduling. >>>More

3 answers2024-04-09

Linux process scheduling uses preemptive multitasking, so there is no need for processes to suspend and resume running without the need for collaboration between them. >>>More

6 answers2024-04-09

You can take a look at "Learn Linux O&M Web Cluster Practice with Old Boys", "Learn Linux O&M Shell Programming Practices with Old Boys", "Learn Linux O&M Core System Command Practices with Old Boys", "Learn Linux Core Basics with Old Boys (Part I)", and Learn Linux O&M MySQL Introduction and Improvement Practice with Old Boys, from beginner to proficient.

7 answers2024-04-09

Use the pstree command to see the relationship between the processes, all processes are created by the initial init, and the parent process creates child processes one by one. >>>More