Operating system-process similarities and differences between UNIX and Windows

Source: Internet
Author: User

In Unix systems, there is only one system call that can be used to create a new process: fork. This system call creates a copy of the same as the calling process.

After the fork is called. Both processes (parent and child processes) have the same storage image, the same environment string, and the same open file.

That's all the situation. In the same city, the child process then runs EXECVE or a similar system call to alter its storage image and run a new program. For example, when a user types a command in the shell, the shell creates a child process, and then the child process runs the sort.

The two-step process is planned to allow the child process to process its file descriptor after the fork, but before Execve, to complete the redirection of standard input, standard output, and standard error.

In Windows, the opposite is the case. A Win32 function call creatprocess processes both the creation of the process and the loading of the correct program into the new process.

The call has 10 parameters, which contains the program to run, the command line parameters entered for the program, various security properties, the control bits that are inherited from the open file, the priority information, the form specification that is required for the process (if any), and a pointer to a struct. Information about the newly created process in the structure is returned to the caller.

Except CreateProcess. There are about 100 other functions in WIN32 to handle the management, synchronization, and related things of a process.

In Unix and Windows. After the process is created, the parent and child processes have different address spaces.

Assuming that a process has changed a word in its address space, this change is not visible to other processes.

In Unix, the initial address of a child process is a copy of the parent process, but there are two different address spaces involved, and the non-writable memory is shared (some UNIX implementations make the program essay shared between the two because it cannot be altered). But. It is indeed possible for a newly created process to share other resources of its creator. such as open files. In Windows, the address space of the parent process and the child process from the beginning are different.


In Unix, the process and all of its children and descendants project compose a process group.

Instead, there is no process-level concept in Windows, and all processes are in the same position. The only hint that is similar to the process hierarchy is when the process is created. The parent process gets a special token (which becomes the handle handle) that can be used to control the child process. However, it has the right to pass this token to some other process. Thus there is no process hierarchy. In Unix, a process cannot deprive its children of "inheritance".

Operating system-process similarities and differences between UNIX and Windows

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.