Path: ...!fu-berlin.de!uni-berlin.de!not-for-mail From: ram@zedat.fu-berlin.de (Stefan Ram) Newsgroups: comp.lang.python Subject: Re: Process.start Date: 3 Sep 2024 13:02:30 GMT Organization: Stefan Ram Lines: 43 Expires: 1 Jul 2025 11:59:58 GMT Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de TgmIFcF53xIdeeKyoRY3VAoErTXrGVU7Gq2KUzMQPN6FRR Cancel-Lock: sha1:oHuXnj+TKtCwgldHzZsEtNg7Jzk= sha256:ZosjGFSf5Ia3/Cao+aGuXlQ+FoD+88/TdjlMC5F1acg= X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved. Distribution through any means other than regular usenet channels is forbidden. It is forbidden to publish this article in the Web, to change URIs of this article into links, and to transfer the body without this notice, but quotations of parts in other Usenet posts are allowed. X-No-Archive: Yes Archive: no X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some services to mirror the article in the web. But the article may be kept on a Usenet archive server with only NNTP access. X-No-Html: yes Content-Language: en-US Bytes: 3096 marc nicole wrote or quoted: >Thanks for the reply, Here's the code I tested for the debug: >print("executed") >but neither "Hello World" or "Executed" are displayed in the console which It shouldn't spit out "Executed" 'cause there's a lowercase "e" in the mix. Talk about sweating the small stuff! That 'if __name__ == "__main__"' jazz? It's barking up the wrong tree here, just muddying the waters. I'd 86 that clause for now. In your start() function call, you're rockin' "do_something()", but the actual function's defined as "do_Something()" with a capital "S". Python's all about that case sensitivity. Dropping that "exit(0)" bomb right after firing up the process? That's like bailing on a gnarly wave before you even catch it. It might pull the plug on the main process before the kid process has a chance to strut its stuff. Those "ghello" and "fhello" functions? They're just chillin' there, not pulling their weight! >Now the question, when to use Process/Multiprocess and when to use >Threading in Python? When it comes to processes vs. threads, it's like choosing between a burrito and a taco. Use processes for those CPU-heavy tasks to get that real parallel action across multiple cores, dodging Python's GIL like it's rush hour on the 405. Processes are also tougher than a two-dollar steak and perfect for memory hogs. On the flip side, threading's your go-to for I/O-bound tasks where the GIL takes a breather during I/O ops, letting you multitask like a boss. Threads are as light as a surfer's board, play nice with shared memory, and are the bee's knees for juggling a ton of tasks without breaking a sweat.