Find the answer to your Linux question:
Results 1 to 6 of 6
I have a few questions about Linux processes. 1. I'm confused because Linux obviously has the ability to run several processes/programs concurrently from the bash shell each being a separate ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2009
    Posts
    8

    Understanding Linux Processes question 1


    I have a few questions about Linux processes.

    1. I'm confused because Linux obviously has the ability to run several processes/programs concurrently from the bash shell each being a separate executable having it's own main function. Linux also has processes created from within a single executable, say a C program, with their own memory space, but these processes are arranged in a Parent/Child relationship. And then you have the multi-user capability of Linux which also refers to each user as a separate process with their own memory space. Are all of these processes equivalent? They don't seem to me to be the same thing.

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    1,167
    Quote Originally Posted by josephstein View Post
    I have a few questions about Linux processes.

    1. I'm confused because Linux obviously has the ability to run several processes/programs concurrently from the bash shell each being a separate executable having it's own main function. Linux also has processes created from within a single executable, say a C program, with their own memory space, but these processes are arranged in a Parent/Child relationship.
    The terms parent and child are used in manuals, but the processes are actually quite independent. Each has its own PID and virtual memory. Typically the child process will run exec() or one of its derivatives to switch to a different program, and parent and child will then run independently. In fact that's how the shell launches processes. It is the parent, the processes you launch with commands are its children.

    And then you have the multi-user capability of Linux which also refers to each user as a separate process with their own memory space. Are all of these processes equivalent? They don't seem to me to be the same thing.
    Users are not processes. One user can run many processes, and processes can be run by different users. You're right; they aren't the same thing at all.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

  3. #3
    Just Joined!
    Join Date
    Sep 2009
    Posts
    8
    [QUOTE=hazel;730467]The terms parent and child are used in manuals, but the processes are actually quite independent. Each has its own PID and virtual memory. Typically the child process will run exec() or one of its derivatives to switch to a different program, and parent and child will then run independently. In fact that's how the shell launches processes. It is the parent, the processes you launch with commands are its children.

    I need to study up on the exec() call. I've seen it mentioned in the sections on the fork() call several times in the books I've read, but so far they haven't explained the use of the exec() call.

  4. #4
    Just Joined!
    Join Date
    Sep 2009
    Posts
    8
    Quote Originally Posted by hazel View Post
    Users are not processes. One user can run many processes, and processes can be run by different users. You're right; they aren't the same thing at all.
    So the scheduling is done differently when allocating a time slice for different users vs allocating a time slice for multiple processes executed by a single user?

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    11,174
    Quote Originally Posted by josephstein View Post
    So the scheduling is done differently when allocating a time slice for different users vs allocating a time slice for multiple processes executed by a single user?
    No. All processes with the same priority and nice settings are scheduled equally without regard to who is running them. You can change the priority of a process with the renice system command, and you can change their niceness setting with the nice system command. There is also a real-time scheduler that can be used for time-critical processes. Some kernel processes use that as can properly written user processes but there are a lot of special issues to deal with (suitable for expert system programmers).
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #6
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    1,167
    Quote Originally Posted by josephstein View Post
    I need to study up on the exec() call. I've seen it mentioned in the sections on the fork() call several times in the books I've read, but so far they haven't explained the use of the exec() call.
    Exec just tells the process to kick out the current program that it is running and run a different one. btw I think this whole discussion is in the wrong forum; it should be in programming/scripting.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •