Golang Concurrent Socket Runtime implementation

Source: Internet
Author: User
Tags epoll
This is a created article in which the information may have evolved or changed.

Golang implementation of the concurrency socket is very simple, can take advantage of the channel concurrency of Go, each Chan holds a socket handle read and write, very direct, do not use their own EPOLL,IOCP implementation. But what about the efficiency of EPOLL,IOCP go processing sockets? I'm curious, because, EPOLL,IOCP is the standard form of dealing with concurrent sockets.

I followed the source code of Go, and finally found that the original at the bottom, go is also used Eoll KQUEUE,IOCP and other IO model read and write socket, so, efficiency God horse certainly no problem.

Specific analysis, from the Net.go read function to see, found before read is to Prepare (fd_poll_runtime.go), Prepare will call Runtime_pollreset, This function is a run-time function, in the NETPOLL.GOC, the specific implementation of the platform has a relationship, the implementation of win in NETPOLL_WINDOWS.C, can be found using IOCP implementation.

End!

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.