fork on Windows

Asked 2 years ago, Updated 2 years ago, 30 views

How do I fork processes in Windows?
There is a Python GUI application that runs on Unix operating systems, and it seems to be using fork(multiprocessing.set_start_method("fork")).
This is supported only on Unix-like operating systems and not on Windows.

Is there any way I can run this application in Windows without changing the code?

Instead of just running it, I would like to use Pyinstaller to turn it into an executable .exe so that it can start with just one click like a normal application.

How can I do these things?

Cygwin, Mingw, and so on. Which one should I use?

Python 3.6.4, Windows 10

python windows

2022-09-30 11:37

2 Answers

Cygwin and MinGW are mentioned, but this is exactly where the difference between the two lies.

Cygwin aims to provide a complete POSIX layer on Windows, as seen in Linux and other UNIX systems, and sacrifices performance if necessary for compatibility.
MinGW only offers free compilers and a variety of tools, focusing on performance.

Therefore, emulation also supports fork() system calls for Cygwin.


2022-09-30 11:37

I'm sorry.The questioner's past question stated "Exclude Windows Subsystem for Linux", so in a similar environment, the following are not applicable:
I will save it for those who search with similar requests.

With Windows 10, if Windows Subsystem for Linux is enabled, wouldn't it be possible to use the same binary as Ubuntu without any strange ingenuity?

The beta version of Windows Subsystem for Linux (beta) also seemed to support fork().
Is Windows Subsystem for Linux fast?

The purpose is different, but the benchmark test software for Unix seems to work with a recompilation of options.
(yet another) UnixBench on Bash on Ubuntu on Windows

References
Python on Windows
What is Windows Subsystem for Linux?Installation and Use

However, there is a high possibility that the GUI is not supported.
It's a problem to modify the GUI by using a different process to communicate with socket.

When I continued to look into it, many people seemed to think the same way, and there was an article like this.
The X-Window Server is procured separately and the GUI is left to you.
Wouldn't this be able to follow the normal Unix programming method?
How to use Windows Subsystem for Linux+X Window by 1.024 times


2022-09-30 11:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.