`Go 是一个并发语言`这是什么意思?

发布于 2024-10-16 20:48:42 字数 72 浏览 3 评论 0原文

Go 是并发语言 这是什么意思?

这是否意味着它是 C/C++/Java.. 的替代品?

Go is a concurrent lang What does this mean?

doesn't this mean that it is a C/C++/Java.. alternative?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

春夜浅 2024-10-23 20:48:42

并发语言是一种具有并发语言结构的语言。

Go 是一种并发语言,因为它有“goroutines”。

并发

Go 提供了 goroutine,小型轻量级线程;这个名字暗指协程。 Goroutine 是使用匿名或命名函数的 go 语句创建的。

Goroutine 与其他 goroutine 并行执行,包括它们的调用者。它们不一定在单独的线程中运行,但一组 goroutine 被复用到多个线程上——通过在通道上发送或接收消息时阻止它们,执行控制可以在它们之间移动。

A concurrent language is a language that has language constructs for concurrency.

Go is a concurrent language because it has "goroutines".

Concurrency

Go provides goroutines, small lightweight threads; the name alludes to coroutines. Goroutines are created with the go statement from anonymous or named functions.

Goroutines are executed in parallel with other goroutines, including their caller. They do not necessarily run in separate threads, but a group of goroutines are multiplexed onto multiple threads — execution control is moved between them by blocking them when sending or receiving messages over channels.

小苏打饼 2024-10-23 20:48:42

这意味着它是一种具有适合并发(并行、多线程等)编程特性的语言。它有特殊的语言结构来支持这种类型的编程。并发编程可以用其他语言(C/C++、Java 等)完成,但它(可以说)会更困难,并且可能会导致程序中出现更多错误。

It means that it is a language with features suitable for concurrent (parallel, multithreaded, etc) programming. It has special languge constructs to support this type of programming. Concurrent programming can be done in other languages (C/C++, Java, etc) but it will (arguably) be harder and will probably result in more errors in the programs.

死开点丶别碍眼 2024-10-23 20:48:42

以下是 Go 编程语言的一些主要作者提供的有关并发编程的一些资源。

并发编程简介

有关贝尔实验室 CSP 风格的线程编程的资源

Here are some resources about concurrent programming from some of the principal authors of the Go programming language.

Introduction to Concurrent Programming

Resources about threaded programming in the Bell Labs CSP style

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文