Thread is a natural OS object it’s have enough. Threads manipulations are expensive operations. They require switch to kernel return back, save and restore stack and so on. Many servers used threads but it’s unreal to keep a lot of threads and do not go out of resources. Also there’s a special task to synchronize them.

So new concept emerged - coroutine or coprogram. They could be imagined as parts of execution path between synchronization points: input-output, send-receive so on. They are very light and could be better orchestrated

So “threads but better”.

Answer from Eugene Lisitsky on Stack Overflow
🌐
Reddit
reddit.com › r/golang › should i migrate my multithreading python program to golang or other languages
r/golang on Reddit: Should I migrate my Multithreading Python program to Golang or other languages
March 15, 2024 -

Described in short my Python program has 290 Threads, in every Thread a while Loop sends a request for 20kb of data every 3 seconds. If the data changed in the last 3 seconds (If-Modified-Since is not always accurate unfortunatly) the Thread sends a request for a 550kb response. This response gets analyzed, that means basic arithmetics, accessing a large dict and sending another request to localhost for <1kb. This is very heavy on my CPU, so I thought of migrating to Golang.

Do You think Golang is the right choice? I'm a bit concerned, because time is important and the Golang Garbage Collector could waste some. I have absolutley no experience with Golang and university level C++(so mainly theoretical). Would Java be a better fit?

Discussions

python 3.x - Goroutines vs asyncio tasks + thread pool for CPU-bound calls - Stack Overflow
Are goroutines roughly equivalent to python's asyncio tasks, with an additional feature that any CPU-bound task is routed to a ThreadPoolExecutor instead of being added to the event loop (of course... More on stackoverflow.com
🌐 stackoverflow.com
Asyncio Coroutines Faster Than Threads!?
For your blocking IO example with asyncio, the correct way to sleep is to use asyncio.sleep instead of time.sleep. time.sleep doesn't yield to the event loop. So I am wondering how much that changes your benchmarks when using await asyncio.sleep(0) Edit: actually all of your async example should be using this More on reddit.com
🌐 r/Python
27
63
September 25, 2023
Should I migrate my Multithreading Python program to Golang or other languages
Described in short my Python program has 290 Threads, ... Do You think Golang is the right choice? I'm a bit concerned, because time is important and the Golang Garbage Collector... is this a joke? Python has a garbage collector and is much slower than Go (except for numpy type code implemented in C). Also, Java has a garbage collector. If your python program can do it, a well written Go program can do it more efficiently. More on reddit.com
🌐 r/golang
47
15
March 15, 2024
Asyncio vs threading
coroutines are much more lightweight than threads. They take less memory, and it takes much less time to switch between coroutines. However you need to program specifically for asyncio and use libraries that leverage asyncio as well. Threading is less scalable, but you get to keep your "old" libraries and style of programming. Generally if you're building something from scratch, I would recommend going with asyncio approach. They are different under the hood. threads are real OS threads, subject to OS preemption and scheduling, meaning any thread may yield the CPU to any other thread when the OS decides to do so. When programming with coroutines you try to "trick" your OS by telling it that you are running only one OS thread, only that thread just happens to be a sort of a scheduler of your own that runs your coroutines. One of the good parts about it is: your scheduler - your rules, meaning you can now decide when a coroutine yields the CPU to other coroutines (which is basically what await or its older uglier yield from brother do). To be clear, OS will still preemptively put the python interpreter "on hold" to give chance for other things on the same machine to run, but you now have guarantee that your thread will be resumed in the same state as before it was switched, leading to less likely race conditions. It is hard to go into more detail without knowing how much background you already have on concurrency/parallelism concepts, but I highly recommend watching this talk as it gives an excellent overview on different tools Python provides and their respective pros/cons More on reddit.com
🌐 r/learnpython
6
8
December 27, 2020
🌐
Python.org
discuss.python.org › python help
Have there some like Goroutines in Python 3.13 or maybe 3.14 - Python Help - Discussions on Python.org
May 15, 2024 - I’m referring to A Tour of Go and I’m not saying that we must use the go keyword but should be fine to have something to manage the multithreading automatically, but… which should be the approach?
🌐
Medium
medium.com › dev-bits › a-cup-of-gos-concurrent-programming-for-python-developers-a80e621c45ff
A cup of Go’s concurrent programming for Python developers | by Naren Yellavula | Dev bits | Medium
April 13, 2019 - Goroutines are similar to threads but they are lightweight co-routines. Unlike other programming languages, where a class or interface is provided to create a thread, here any valid function can be executed as a separate co-routine using go keyword.
🌐
LinkedIn
linkedin.com › pulse › battle-concurrency-python-vs-go-lang-muhammad-haseeb
Battle of Concurrency | Goroutines vs Threads.
November 10, 2022 - They are only a few kb in stack size and the stack can grow and shrink according to needs of the application whereas in the case of threads the stack size has to be specified and is fixed. The Goroutines are multiplexed to fewer number of OS threads...
🌐
DEV Community
dev.to › shrinidhi_prabhakar › goroutines-vs-threads-ean
Goroutines vs Threads - DEV Community
February 2, 2025 - So, the next time you're coding in Go and spinning up a few goroutines, just remember: You're not working with massive threads. You're using lightweight, fast-moving, and super-efficient goroutines that make your life easier and your code faster. ... I am a Software Developer with 2+ years of experience in design and developing applications using Golang and Python.
Top answer
1 of 2
12

I think I know part of the answer. I tried to summarize my understanding of the differences, in order of importance, between asyncio tasks and goroutines:

1) Unlike under asyncio, one rarely needs to worry that their goroutine will block for too long. OTOH, memory sharing across goroutines is akin to memory sharing across threads rather than asyncio tasks since goroutine execution order guarantees are much weaker (even if the hardware has only a single core).

asyncio will only switch context on explicit await, yield and certain event loop methods, while Go runtime may switch on far more subtle triggers (such as certain function calls). So asyncio is perfectly cooperative, while goroutines are only mostly cooperative (and the roadmap suggests they will become even less cooperative over time).

A really tight loop (such as with numeric computation) could still block Go runtime (well, the thread it's running on). If it happens, it's going to have less of an impact than in python - unless it occurs in mutliple threads.

2) Goroutines are have off-the-shelf support for parallel computation, which would require a more sophisticated approach under asyncio.

Go runtime can run threads in parallel (if multiple cores are available), and so it's somewhat similar to running multiple asyncio event loops in a thread pool under a GIL-less python runtime, with a language-aware load balancer in front.

3) Go runtime will automatically handle blocking syscalls in a separate thread; this needs to be done explicitly under asyncio (e.g., using run_in_executor).

That said, in terms of memory cost, goroutines are very much like asyncio tasks rather than threads.

2 of 2
1

I suppose you could think of it working that way underneath, sure. It's not really accurate, but, close enough.

But there is a big difference: in Go you can write straight line code, and all the I/O blocking is handled for you automatically. You can call Read, then Write, then Read, in simple straight line code. With Python asyncio, as I understand it, you need to queue up a function to handle the reads, rather than just calling Read.

🌐
Tleyden
tleyden.github.io › blog › 2014 › 10 › 30 › goroutines-vs-threads
Goroutines vs Threads - Seven Story Rabbit Hole
In other words, if two goroutines need to share data, they can do so safely over a channel. Go handles all of the synchronization for you, and it’s much harder to run into things like deadlocks. There are other approaches to achieving high concurrency with a small number of threads. Python ...
Find elsewhere
🌐
Words from Shane
shane.ai › posts › threads-and-goroutines
Threads and Goroutines :: Words from Shane
June 12, 2023 - Node.js for example uses libuv under the hood to do efficient non-blocking evented I/O. Go also transparently uses non-blocking I/O everywhere and it integrates that I/O scheduling with goroutines. non-blocking I/O where possible plus integration of the event loop into the go scheduler is, to answer our earlier question, the manner in which goroutines can be more efficient than threads and it’s how go manages to be pretty good at fast networking. It’s possible for a call to .Read() to submit a non-blocking I/O request and then cooperatively switch to the next goroutine much like a async Rust function but without having the colored function problem that often leads to library bufurication. Javascript avoids this by essentially making everything async and non-blocking. Python & Rust have to juggle async/non-async separately.
🌐
GeeksforGeeks
geeksforgeeks.org › go language › golang-goroutine-vs-thread
Golang | Goroutine vs Thread - GeeksforGeeks
July 12, 2025 - Goroutine: A Goroutine is a function or method which executes independently and simultaneously in connection with any other Goroutines present in your program. Or in other words, every concurrently executing activity in Go language is known ...
🌐
Pure Storage Blog
blog.purestorage.com › home › concurrent programming case study: comparing python, go, and rust
Concurrent Programming Case Study: Comparing Python, Go, and Rust |
November 16, 2025 - The complete Python multiprocessing code can be found here. The two Go primitives that enable “easy mode” concurrent programming are goroutines and channels. “A goroutine is a lightweight thread of execution.”
🌐
Jayconrod
jayconrod.com › posts › 128 › goroutines-the-concurrency-model-we-wanted-all-along
Goroutines: the concurrency model we wanted all along — jayconrod.com
July 2, 2023 - A goroutine is Go's version of a thread. Like threads in other languages, each goroutine has its own stack. Goroutines may execute in parallel, concurrently with other goroutines.
🌐
GoLinuxCloud
golinuxcloud.com › home › programming › goroutine vs threads in golang [8 differences]
Goroutine vs Threads in Golang [8 Differences] | GoLinuxCloud
January 4, 2024 - A quick and simplistic way to differentiate a thread from a process is to consider a process as the running binary file and a thread as a subset of a process. Agoroutineis the minimum Go entity that can be executed concurrently. The use of the word "minimum" is very important here, as goroutines are not autonomous entities like UNIX processes – goroutines live in UNIX threads that live in UNIX processes.
🌐
Hacker News
news.ycombinator.com › item
Goroutines and Async-Await are two very different takes on the same problem. In ... | Hacker News
May 7, 2019 - In C# or Python 3, each function is colored as either sync or async. You can quite easily call an async function from a sync context, but doing a blocking sync call from an async context is forbidden (although possible) · In Go there is no such distinction: you just write your functions in ...
🌐
Quora
quora.com › Are-Python-coroutines-and-Go-goroutines-the-same
Are Python coroutines and Go goroutines the same? - Quora
The Python coroutines operate within an async/await programming model. Go goroutines use a synchronous channel based programming model. Python coroutines are still limited in concurrency by the Global interpreter lock.
🌐
TechTarget
techtarget.com › searchitoperations › tip › Compare-Go-vs-Python-What-are-the-differences
Compare Go vs. Python: What are the differences? | TechTarget
December 27, 2022 - Python does support multithreaded execution, but it doesn't feel as polished and cleanly integrated as Go's goroutines. In Python, a thread uses the OS' threads, which results in greater overhead per thread compared with goroutines.
🌐
Lobsters
lobste.rs › s › jr48n1 › threads_goroutines
Threads and Goroutines | Lobsters
July 21, 2023 - Practically, this (along with context switching costs) means the p90 response times for a server can be in the seconds (and even hit timeouts) for 10k threads per conn while only milliseconds for 10k goroutines per conn. ... Javascript avoids this by essentially making everything async and non-blocking. Python & Rust have to juggle async/non-async separately.
🌐
Medium
daminibansal.medium.com › os-threads-vs-goroutines-understanding-the-concurrency-model-in-go-bad187372c89
OS Threads vs Goroutines: Understanding the Concurrency Model in Go | by Damini Bansal | Medium
November 13, 2024 - Python (using the threading module, but Python also uses the Global Interpreter Lock, or GIL, which complicates multi-threading in CPython) ... A goroutine is a concurrency primitive in the Go programming language (Golang).
🌐
Google Groups
groups.google.com › g › golang-nuts › c › 0Szdmmy22pk
[go-nuts] Goroutines vs. Threads vs. Processes
But they can be moved between operating system threads if needed.(eg. when an operating system thread is going to be blocked by an syscall made by one of the go-routines you can move the other go-routines running on that operating system thread to another thread so they can keep running) wikipedia can provide more information. - jessta -- ===================== http://jessta.id.au ... Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message ... Some additional questions on Goroutines, I don't know if there is already a document answering this somewhere.
🌐
Madeddu
madeddu.xyz › posts › golang vs python: deep dive into the concurrency
GoLang vs Python: deep dive into the concurrency | madeddu.xyz
January 17, 2018 - It’s an independently executing function, launched by a go statement. It has its own call stack, which grows and shrinks as required and it’s very cheap. It’s practical to have thousands, even hundreds of thousands of goroutines, but it’s not a thread.