|
藍森林 http://www.lslnet.com 2006年6月6日 10:18
在RedHat Linux下編寫的多進程使用execl的問題!
RedHat Linux下編寫的多進程使用execl,源碼如下:
[b]pid=fork();
if(pid<0)
{
........
}
if(pid == 0)
{
/*執行子程序*/
if (execl("gather","gather",ini_array->;msc_name[i],shmid_buf,(char*)0)<0)
{
sprintf(buf,"error:調用%s子進程出錯!\n",ini_array->;msc_name[i]);
write_main_log_file(buf); }
}[/b]............
可是運行後ps -ef|grep gather
卻是三個gather進程
那位大俠知道怎麼回事嗎?
註:此程序在Solaris運行正常!!! :P :P :P |
在RedHat Linux下編寫的多進程使用execl的問題!
什麼會呢
是不是程序的其它部分有問題
execcl 與exec功能一樣
就是使用新進程代替當前進程
在這個代碼中只有父進程被gather代替 |
在RedHat Linux下編寫的多進程使用execl的問題!
無雙大哥,可以把介紹一些關於linux下多進程以及系統調用的編程資料麼? |
在RedHat Linux下編寫的多進程使用execl的問題!
http://www.lisoleg.net/lisoleg/applications/Linux%CF%C2%B5%C4%B6%E0%BD%F8%B3%CC%B1%E0%B3%CC.htm
http://www.chinalinuxpub.com/doc/pro/mpp.html
google關鍵字
fork 多進程 |
在RedHat Linux下編寫的多進程使用execl的問題!
-->
把你的ps -ef|grep gathen 的結果也貼出來. |
在RedHat Linux下編寫的多進程使用execl的問題!
和你的機器有關的
你可能看到的是sh gather
gather
而且你這樣啟動,因為execl的速度慢,會產生同步問題
這樣效果可能好點
if( fork()!=0)
{
return true
}
...execl()... |
| |