Daily Go Language Bible-goroutines and threading

Source: Internet
Author: User

Goroutines and Threads:


1. Dynamic stack:


1) Threads have a fixed-size block of memory (typically 2MB) to stack
2) A goroutine will start its life cycle with a very small stack, usually only 2KB, not fixed; the stack size will dynamically scale as needed


2.Goroutine Dispatch:


1) threads are scheduled with a hardware timer, slow
2) Go is using its own scheduler, scheduling on the thread basis, does not need to enter the kernel context


3.GOMAXPROCS environment variables can determine how many threads are started to execute the go code at the same time
4.goroutine No concept of identity (ID) that can be acquired by the programmer

Daily Go Language Bible-goroutines and threading

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.