做選擇網(wǎng)站手機(jī)網(wǎng)站建設(shè)平臺(tái)
Linux shell和R程序并行化執(zhí)行程序方法。
1. 使用do{…} &;done;wait語(yǔ)句并行執(zhí)行Shell
并行執(zhí)行總運(yùn)行時(shí)間不再是task數(shù)量*單個(gè)任務(wù)消耗時(shí)間,而是取決于單個(gè)耗時(shí)最長(zhǎng)的任務(wù)。
# while循環(huán),遍歷test.txt文件每行
cat test.txt|while read i;
dotime_stamp=$(date "+%Y/%m/%d %H-%M-%S"){ # 打印時(shí)間戳和當(dāng)前執(zhí)行任務(wù)編號(hào)