Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6626315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:52:42+00:00 2026-05-25T21:52:42+00:00

I am writing a program that uses multiple worker processes (a pre-forking model) with

  • 0

I am writing a program that uses multiple worker processes (a pre-forking model) with the following code.

from  multiprocessing import Process
for i in range(0,3):
    Process(target=worker, args=(i,)).start()

I use Windows. I notice that they are run as separate processes when I wanted them to start as subprocesses instead. How do I make them subprocesses of the main process?

I am hesitant to use the subprocess module as it seems suited to run external processes (as far as I have used it).


An update: It seems Windows does not launch new processes as sub-processes. Python doesnt support getppid() (get parent’s PID) in Windows.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:52:42+00:00Added an answer on May 25, 2026 at 9:52 pm

    What do you wall subprocess ? To me they are subprocess of your main process. Here my example and returned output.

    import time, os
    from  multiprocessing import Process
    
    def worker():
        print "I'm process %s, my father is %s" % (os.getpid(), os.getppid())
    
    print "I'm the main process %s" % os.getpid()
    for i in range(0,3):
        Process(target=worker).start()
    

    The output is :

    I'm the main process 5897
    I'm process 5898, my father is 5897
    I'm process 5899, my father is 5897
    I'm process 5900, my father is 5897
    

    You have 3 subprocesses attached to a main process…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Overview I am writing a Ruby program that uses data from mysql queries to
I'm writing a program that uses SetWindowRgn to make transparent holes in a window
I am writing a program that uses prints a hex dump of its input.
I'm writing a program that uses regular expressions to make comparisons against the entire
I'm planning on writing a program for Linux that uses text to speech and
I'm writing a program that for performance reasons uses shared memory (sockets and pipes
I'm writing an MPI program (Visual Studio 2k8 + MSMPI) that uses Boost::thread to
If you are writing a program that is executable from the command line, you
I'm writing a program that uses java.net.URLDecoder.decode(String value, String encoding) . Apparently, this method
I'm writing a program that uses QUdpSocket for transmitting data over the network. This

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.