Scheduler Fairness and Real-Time Performance: Golang vs Erlang
Overview
This codebase contains a comparative analysis of scheduling fairness and real-time performance between Golang and Erlang. Tests indicate that the performance of Golang’s goroutine scheduler is subpar — it is coarse, unfair, and lacks good real-time capabilities. In contrast, Erlang’s scheduler excels in both fairness and real-time performance!
Experimental Conclusions
Based on our rigorous testing:
- Golang’s scheduler is implemented in a coarse manner, is clearly unfair, and has poor real-time performance
- Erlang’s scheduler outperforms Golang significantly, demonstrating excellent fairness and real-time performance
Testing Methodology
Core Principles
The essence of scheduler evaluation lies in testing whether concurrent processes/goroutines are treated fairly, even when some routines are consuming significant CPU resources. Other routines should have equal execution opportunities, rather than being forced to delay or block.
Implementation Method
We designed two identical functions in both languages (<span>work1</span> and <span>work2</span>), and then launched multiple resource-intensive routines (<span>work_busy</span>) to compete for system resources.
Explaining Performance Differences
While Golang (as a static language) naturally offers higher performance, we appropriately adjusted the number of routines for each language, <span>work_busy</span> to ensure:
- Both implementations maintained a similar execution rate (approximately 60-80 executions per second)
<span>work1</span>and<span>work2</span>achieved roughly the same number of executions within the same time frame- The comparison primarily focused on scheduler behavior rather than raw language performance
Testing Environment and Versions
The tests were conducted using the following runtime versions:
- Erlang/OTP: Version 27 [erts-15.0.1] [64-bit] [smp:16:16]
- Golang: Version go1.25.0 windows/amd64
Platform Hardware and Operating System Environment:
- Device: LAPTOP-H670TST5
- Processor: 13th Gen Intel® Core™ i5-1340P (1.90 GHz)
- Memory: 16.0 GB RAM
- Operating System: Windows 11 Home Chinese Version (24H2)
- OS Version: 26100.4946
- Architecture: 64-bit operating system, x64-based processor
Starting Golang: 

Results Analysis
After running approximately 10,000 iterations:
- Golang Results:
<span>work1</span>executed<span>work2</span>with a difference of over 100 executions - Erlang Results: only differing by 1 execution of – an astonishing result!
<span>work2</span>
Golang results:
Erlang results:

Key Insights
Erlang’s scheduler demonstrates true soft real-time capabilities and achieves genuinely fair preemptive scheduling — aspects where Golang clearly falls short. The longer Golang runs in CPU-intensive environments, <span>work1</span> and <span>work2</span> diverge even more.
Conclusion
This comparison reveals fundamental differences in scheduler design philosophies. Erlang’s proven process scheduler is designed for telecom-grade reliability, showcasing superior fairness and real-time performance compared to Golang’s newer goroutine scheduler, especially under sustained CPU pressure.