freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

計(jì)算機(jī)14實(shí)驗(yàn)報(bào)告模板(已改無錯(cuò)字)

2023-06-14 03:22:08 本頁面
  

【正文】 ese are values before fork:。 int local = 10。 printf(before fork * * *\n\n)。 if((pid = fork())0) err_exit(fork error)。 if(pid == 0){ string = I am child.。 printf(\nMy pid is %d,%s\n pid = %d\n global = %d\n local = %d\n, getpid(),string,pid,global,local)。 global++。 } else{ string = I am parent.。 printf(\nMy pid is %d,%s\n pid = %d\n global = %d\n local = %d\n, getpid(),string,pid,global,local)。 local++。 } printf(%s\n Now,global = %d,local = %d\n,string,global,local)。 exit(EXIT_SUCCESS)。}//清單42 管道程序 define STD_INPUT 0 // 定義標(biāo)準(zhǔn)輸入設(shè)備描述符 define STD_OUTPUT 1 // 定義標(biāo)準(zhǔn)輸出設(shè)備描述符int fd[2]。main(){static char process1[]=”father”,process2[]=”child”。 pipe(fd)。 // 定義管道 pipeline(process1,process2)。 // 調(diào)用自定義函數(shù)pipeline() exit(1)。 // 程序結(jié)束}pipeline(char* process1,char* process2){int i。 if ((i=fork())==1) // 創(chuàng)建進(jìn)程,失敗退出 { perror(“process fork error!”)。 exit(1); } if (i) { close(fd[0])。 // 關(guān)閉管道輸入描述符 close(STD_OUTPUT)。 // 關(guān)閉標(biāo)準(zhǔn)輸出描述符1 dup(fd[1])。 // 指定標(biāo)準(zhǔn)輸出描述符1為管道寫指針 close(fd[1])。 // 關(guān)閉原始管道寫指針 execl(process1, process1, 0)。 // 用程序father覆蓋當(dāng)前程序 printf(“ father failed.\n”)。 // execl()執(zhí)行失敗 } else { close(fd[1])。 // 關(guān)閉管道輸出描述符 close(STD_INPUT)。 // 關(guān)閉標(biāo)準(zhǔn)輸入描述符0 dup(fd[0])。 // 指定標(biāo)準(zhǔn)輸入描述符0為管道讀指針 close(fd[0])。 // 關(guān)閉原始管道讀指針 execl(process2,process2,0)。 // 用程序child覆蓋當(dāng)前程序 printf(“child failed.\n”)。 // execl()執(zhí)行失敗 } exit(2)。 // 程序結(jié)束}清單 43 main(){static char string[] = “Parent is using pipe write.” 。int len。 len = sizeof(string) 。 write(1, string, len) 。 /* 將string中的內(nèi)容寫入管道中 */ printf(“parent, parent, parent \n \n \n” ) exit(0) 。}清單44 main(){ char output[30] 。 read (0, output, 30) 。 /* 從管道中讀數(shù)據(jù)并存入output中 */ printf(“%s \n child, child. \n” , output) 。 return(0) 。} 實(shí) 驗(yàn) 報(bào) 告組別姓名高宇同組實(shí)驗(yàn)者實(shí)驗(yàn)項(xiàng)目名稱實(shí)驗(yàn)五線程練習(xí)實(shí)驗(yàn)日期第15周周四3,4節(jié)教師評語實(shí)驗(yàn)成績指導(dǎo)教師一、實(shí)驗(yàn)?zāi)康?. 掌握linux環(huán)境下線程的創(chuàng)建2. 掌握linux環(huán)境下線程編程的幾種常見模型3. 掌握信號量和互斥量的使用、線程同步二、實(shí)驗(yàn)準(zhǔn)備使用線程編程的幾種常見模型:1. 管理者/工作者(Manager/worker):一個(gè)單線程,作為管理器將工作分配給其它線程(工作者),典型的,管理器處理所有輸入和分配工作給其它任務(wù)。至少兩種形式的manager/worker模型比較常用:靜態(tài)worker池和動(dòng)態(tài)worker池。2. 管道(Pipeline):任務(wù)可以被劃分為一系列子操作,每一個(gè)被串行處理,且是被不同的線程并發(fā)處理。汽車裝配線可以很好的描述這個(gè)模型。比如IDM等下載軟件的文件分塊同時(shí)下載。3. Peer:Peer和manager/worker模型相似,但是主線程在創(chuàng)建了其它線程后,自己也參與工作。三、實(shí)驗(yàn)內(nèi)容1. 創(chuàng)建和結(jié)束線程函數(shù):int pthread_create(pthread_t *tidp,const pthread_attr_t *attr,(void*)(*start_rtn)(void*),void *arg)。void pthread_exit
點(diǎn)擊復(fù)制文檔內(nèi)容
黨政相關(guān)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1