当前位置:网站首页>Multi mode concurrent implementation of tortoise and rabbit race in go language
Multi mode concurrent implementation of tortoise and rabbit race in go language
2022-06-29 17:17:00 【_ Qilixiang】
In the ocean of code , More than 70 or 80 kinds can be written , Here are three kinds of posts .
If help , Welcome to collect !
background
A race between the hare and the tortoise
Run at your own pace , Suppose the rabbit runs once 1.1 rice , The tortoise ran at once 0.2 rice ;
Start timing uniformly , The race will not be over until both of them finish running .
Catalog
posture 1
use WaitGroup
func main() {
var (
Total float64 = 5 // Because the tortoise runs slowly, it is not easy to observe and print , So make it smaller
RabbitAdd = 1.1
TurtleAdd = 0.2
)
start := time.Now().UnixNano()
wg := sync.WaitGroup{}
wg.Add(1)
// The rabbit
go func() {
defer wg.Done()
边栏推荐
- C comparison of the performance of dapper efcore sqlsugar FreeSQL hisql sqlserver, an ORM framework at home and abroad
- Master slave replication of MySQL
- 2022年软件评测师考试大纲
- Solid state storage manufacturer Yilian joins dragon dragon community to build a new open source ecosystem
- mysql数据库扫盲,你真的知道什么是数据库嘛
- Gradle下载慢或无法下载
- ICML 2022 | transferable imitation learning method based on decoupling gradient optimization
- @Difference between component and @configuration
- 基于汇编实现的流载体的LSB隐藏项目
- 如何在 PowerPoint 中向幻灯片添加 SmartArt?
猜你喜欢

Calibration of monocular camera and binocular camera with kalibr calibration tool

0基础自学STM32(野火)——使用寄存器点亮LED——GPIO功能框图讲解

可转债策略之---(摊饼玩法,溢价玩法,强赎玩法,下修玩法,双低玩法)

Why is informatization ≠ digitalization? Finally someone made it clear
![[R language data science]: Text Mining (taking Trump's tweet data as an example)](/img/4f/09b9885915bee50fb40976a5002730.png)
[R language data science]: Text Mining (taking Trump's tweet data as an example)

About xampp unable to start MySQL database

Naacl 2022 | distillation of machinetranslation SOTA model

“授权同意”落地压力大?隐私计算提供一种可能的合规“技术解”

controller、service、dao之间的关系

AI and creativity
随机推荐
Master slave replication of MySQL
AI and creativity
When MySQL RDS is collected using Flink CDC, the datetime type field will be compared with the source table after collection
KUKA子程序/函数怎么建立和使用方法
In depth analysis of Monai (I) data and transforms
反射
Summary of problems during xampp Apache installation
epoll分析
机器学习7-支持向量机
在供应链场景应用中,供应链管理系统扮演什么角色?
Tencent cloud released the upgraded version of CDW Clickhouse to provide a fast experience for massive data real-time analysis scenarios
基于深度学习的Wiki中文语料词word2vec向量模型
0基础自学STM32(野火)——寄存器点亮LED
KUKA机器人外部轴配置你一定要知道的那些知识
c# 国内外ORM 框架 dapper efcore sqlsugar freesql hisql sqlserver数据常规插入测试性能对比
在线文本数字识别列表求和工具
C language practice ---- pointer string and linked list
Bags of Binary Words for Fast Place Recognition in Image Sequenc
6.26CF模拟赛D:黑白条题题解
Collaborative development of epidemic home outsourcing project 𞓜 community essay solicitation