简体   繁体   中英

Fork Concept in C#

Since C# supports threading, is there any way to implement fork concept in C#?

Thanks in advance....

This is more a matter of .NET / CLR than of C#. Generally, it's a matter of the underlying operating system. Windows do not support fork() -like semantics of spawning new processes. Also, fork() has nothing to do with multithreading support.

The semantics of fork() involves duplicating the contents of the original process's address space. My opinion is this is an obsolete approach to process creation and has barely any room in the Windows world, because it involves a lot of security and operating system architecture concerns.

From the .NET point of view, the fundamental problem with fork() would be the approach to duplicating and/or sharing unmanaged resources (file handles, synchronization objects, window handles (!), etc.) between the old and the new process. I think there is no serious reason to introduce such concept either to .NET or to the underlying Windows operating system.

For further discussion see saurabh's link.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM