• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
孙龙 程序员
少时总觉为人易,华年方知立业难
博客园    首页    新随笔    联系   管理    订阅  订阅
04 2022 档案
gobing并行编程3-sync

摘要:传统的线程模型(通常在编写 Java、C++ 和Python 程序时使用)程序员在线程之间通信需要使用共享内存。通常,共享数据结构由锁保护,线程将争用这些锁来访问数据。 在某些情况下,通过使用线程安全的数据结构(如 Python 的Queue),这会变得更容易。 Go 的并发原语 goroutine 阅读全文
posted @ 2022-04-13 18:17 孙龙-程序员 阅读(176) 评论(0) 推荐(0)
Go Concurrency Patterns: Pipelines and cancellation

摘要:Sameer Ajmani13 March 2014 Introduction Go’s concurrency primitives make it easy to construct streaming data pipelines that make efficient use of I/O 阅读全文
posted @ 2022-04-12 14:40 孙龙-程序员 阅读(39) 评论(0) 推荐(0)
Go Concurrency Patterns: Timing out, moving on

摘要:Andrew Gerrand23 September 2010 Concurrent programming has its own idioms. A good example is timeouts. Although Go’s channels do not support them dire 阅读全文
posted @ 2022-04-12 14:37 孙龙-程序员 阅读(54) 评论(0) 推荐(0)
golang 详解协程——errgroup

摘要:我们把一个复杂的任务,尤其是依赖多个微服务 rpc 需要聚合数据的任务,分解为依赖和并行,依赖的意思为: 需要上游 a 的数据才能访问下游 b 的数据进行组合。但是并行的意思为: 分解为多个小任务并行执行,最终等全部执行完毕。 https://pkg.go.dev/golang.org/x/sync 阅读全文
posted @ 2022-04-08 17:43 孙龙-程序员 阅读(1155) 评论(0) 推荐(0)

博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3