- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference between Goroutine and Thread in Golang.
Goroutine
Goroutine is method/function which can be executed independently along with other goroutines. Every concurrent activity in Go language is generally terms as gorountine.
Thread
Thread is a lightweight process. It can be treated as a unit to execute a piece of code. Operating system manages the thread.
Following are the important differences between Goroutine and Thread.
Sr. No. | Key | Goroutine | Thread |
---|---|---|---|
1 | Managed By | Goroutine methods are managed by golang runtime. | Thread are managed by operating systems. |
2 | Hardware dependency | Goroutine are independent to hardware. | Thread are dependent on hardware. |
3 | Communication Medium | Goroutines uses channels as communication medium. | Thread have no easy communication medium. |
4 | Latency | Goroutines can commuicate with other routines with low latency. | Thread as have no communication medium, communicate with other thread with high latency. |
5 | ID | Goroutine does not have any thread local storage and no unique id. | Thread have thread local storage and have unique id. |
6 | Scheduling | Goroutines are co-operatively scheduled. | Threads are preemptively scheduled. |
7 | Startup | Goroutines have faster startup time. | Threads have slower startup time. |
8 | Stack | Goroutines have growable segmented stacks. | Threads do not have growable segmented stacks. |
- Related Articles
- Difference between Process and Thread
- Difference between Fixed thread pool and cached thread pool.
- Difference between Thread and Runnable in Java
- Difference between green and native thread
- How to wait for a goroutine to finish in Golang?
- Difference Between Thread Class and Runnable Interface in Java
- Difference between scheduledThread pool and Single Thread Executor.
- Golang program to calculate difference between two slices
- Golang Program to Calculate Difference Between Two Time Periods
- What are the differences between yarn and thread?
- What's the difference between a context switch, a process switch and a thread switch in Linux?
- Golang program to calculate the symmetric difference between two slices
- Difference Between & and &&
- Threads and Thread Synchronization in C#
- Background and foreground thread in C#

Advertisements