当前位置:网站首页>Shell script multi process concurrent writing method example (high level cultivation)
Shell script multi process concurrent writing method example (high level cultivation)
2022-06-26 15:09:00 【BOGO】
There are many real work scenarios to achieve rapid processing , And use concurrent execution . Other languages are very easy to implement concurrency .
that shell Script most linux The most friendly scripting language above can achieve concurrency ?
The answer is yes !~
So, BOGO, here is an example to share with you !~
#!/bin/bash
# Concurrency number
pnum=6
# The function you want to execute
task () {
echo "$u start"
sleep 5
echo "$u done"
}
FifoFile="$$.fifo"
mkfifo $FifoFile
exec 6<>$FifoFile
rm $FifoFile
for ((i=0;i<=$pnum;i++));do echo;done >&6
# perform 20 Time
for u in `seq 1 20`
do
read -u6
{
# Call function
task
# Print result log of concurrent execution function
[ $? -eq 0 ] && echo "${u} Success " || echo "${u} Secondary failure "
echo >&6
} &
done
wait
exec 6>&-Apply the above example to realize concurrent processing !~
边栏推荐
- 北京银行x华为:网络智能运维夯实数字化转型服务底座
- shell脚本多进程并发写法实例(高阶修炼)
- cluster addslots建立集群
- ETL过程中数据精度不准确问题
- MongoDB系列之适用场景和不适用场景
- C语言刷题随记 —— 乒乓球比赛
- R language uses the aggregate function of epidisplay package to split numerical variables into different subsets based on factor variables, calculate the summary statistics of each subset, and use agg
- Restcloud ETL extracting dynamic library table data
- R language GLM function logistic regression model, using epidisplay package logistic The display function obtains the summary statistical information of the model (initial and adjusted odds ratio and
- 数据库-序列
猜你喜欢

刷题笔记(十九)--二叉树:二叉搜索树的修改与构造

The engine "node" is inconsistent with this module

RestCloud ETL与Kettle对比分析

获取两个dataframe的交并差集

15 bs对象.节点名称.节点名称.string 获取嵌套节点内容

TS常用数据类型总结

The JVM outputs GC logs, causing the JVM to get stuck. I am stupid

重磅白皮书发布,华为持续引领未来智慧园区建设新模式

Mark: unity3d cannot select resources in the inspector, that is, project locking

【TcaplusDB知识库】TcaplusDB系统管理介绍
随机推荐
Unity C# 网络学习(九)——WWWFrom
shell脚本多进程并发写法实例(高阶修炼)
R language dplyr package bind_ The rows function merges the rows of the two dataframes vertically. The final number of rows is the sum of the rows of the original two dataframes (combine data frames)
1.会计基础--会计的几大要素(会计总论、会计科目和账户)
编译配置in文件
Pod scheduling of kubernetes
【TcaplusDB知识库】TcaplusDB系统管理介绍
TS常用数据类型总结
Unity uses skybox panoramic shader to make panorama preview. There is a gap. Solution
The heavyweight white paper was released. Huawei continues to lead the new model of smart park construction in the future
Unity C# 网络学习(十)——UnityWebRequest(一)
Practical website recommendations worth collecting for College Students
Attention meets geometry: geometry guided spatiotemporal attention consistency self supervised monocular depth estimation
Is the QR code for account opening given by the manager of the securities firm safe? Who can I open an account with?
Is it safe to open an online stock account? Somebody give me an answer
Restcloud ETL extraction de données de table de base de données dynamique
SAP 销售数据 实际发货数据导出 销量
About selenium common. exceptions. Webdriverexception: message: an unknown server side error solution (resolved)
Pod of kubernetes
Redis-集群