在hp-unix上,有大文件40G需要读其内容并做相应处理。为提高其处理效率,更好利用多个CPU,特设计如下: 启动CPU数量的线程,每个线程互斥读文件一行fgets,交给处理函数处理(耗费CPU操作),处理结束,读下一行,...,...一直到文件结束... 但使用cc -D_REENTRAN -O2 -lpthread thread4.c -o thread4.exe 编译成功后,执行时候报“Memory fault(coredump)”,不知到为何呢?,此程序执行需要指定环境变量:AUTO_DATA_FILE,请指定...
by apexg - HP-UX - 2006-09-05 15:35:02 阅读(1051) 回复(0)
hp unix下面 执行pthread_create(tTid, &attr, tEntry, lpArgv); 就有信号SIGBUS产生,因而产生异常,同样的程序在 solaris ,aix下则正常,各位大虾,请问是什么问题阿?
我在hp unix上, 以多线程(pthread)的模式操作数据库,使用OCI接口,但我的程序在运行时,莫名其妙的崩溃,我查了半天也没有找到原因,后来我不使用pthread而使用fork的方式就好了,所以我想知道是否OCI和Pthread在共同使用时是否存在BUG!?望高人指点!谢谢了,先,呵呵!~
void * child(void *args) { printf("child thread start\n"); int tid = pthread_self(); printf("thread %d enter\n", tid); printf("child thread end\n"); } int main(void) { printf("main thread start\n"); for(;;) { pthread_t pt; int ret = pthread_create(&pt, NULL, child, NULL ); printf("main thread create thread the ret =%d...
rc=pthread_create(&thread1,&tattr,&WatchdogThread,(void*)&MyPID ); Here the call of pthread_create() fails with a return code of -1 but errno is 0 so that I don't have an idea what the problem could be. Does anybody have an idea?
看到有人在问线程编程,我转贴几篇我以前收集的入门教程,希望能够有所帮助。 ===================================================================== Linux下的多线程编程 作者: 姚继锋 (2001-08-11 09:05:00) 1 引言 线程(thread)技术早在60年代就被提出,但真正应用多线程到操作系统中去,是在80年代中期,solaris是这方面的佼佼者。传统的unix也支持线程的概念,但是在一个进程(process)中只允许有一个线程,这样多...
Windonw系统下有个sysmon工具(控制面板中的管理工具里面)可以监视某个进程中的所有线程占用CPU资源情况。 请问各位专家: 在unix中有没有类似的工具用来监视进程中的线程占用CPU资源??? 我的unix是SunOs。