Operations on Processes

    • What exactly happens inside the OS when a process is created? That depends on the operating system:
      1. On Windows, when a process calls the spawn() system call, the OS will load a program into memory by copying its code and initializing the process control block of the new process.
      2. On Linux, the above is done in 2 separate steps:
        1. First, by issuing the fork() system call, the OS creates a child that is identical to the parent process.
        2. Then, by calling exec(), one of which arguments is a path to a program (binary) file, the child process asks the OS to replace its current binary code with the code of another program so that it might NOT be identical to the parent anymore.
    • The diagram on the following slide shows how Windows (left) and Linux (right) let a process create a child.