線程_初識線程

 從圖1 我們應該能夠推測出,同一進程中的所有線程所對應的進程ID將會是一樣的,而各個線程ID是不同的。做一個小實驗來驗證一下吧。 圖1 進程與線程關係示意圖 代碼驗證  #include<stdio.h> //printf() #include<pthread.h> #include<unistd.h> //sleep() void* thr_fun1(void* arg) {
相關文章
相關標籤/搜索