[Python] Python multiprocessing Process PID is different from actual PID

Discussão em 'Python' iniciado por Stack, Fevereiro 21, 2025.

  1. Stack

    Stack Membro Participativo

    This is my code. I am trying to create n(=10 here) processes and just trying to see their PIDS. When I print them and verify the PID in terminal, they are not the same. EDIT : I am running this on a Mac (Yosemite) if that helps.

    for proc in xrange(10):
    worker_process = Process (name="worker_process", target=worker_code, args=(proc, tree_space, self.simulator, mgr_nms))
    process_q.append(worker_process)
    worker_process.start()
    print worker_process.pid


    My Output:

    60484
    60485
    60486
    60487
    60488
    60489
    60490
    60491
    60493
    60494


    Terminal Output (top):

    (IMAGE) -> http://postimg.org/image/kkiboom6l/

    Any pointers regarding why this is ? (sorry if I am missing something so obvious.)

    Continue reading...

Compartilhe esta Página