Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

code for multiprocessing

Status
Not open for further replies.

kingraja84

Newbie level 6
Joined
Aug 11, 2006
Messages
11
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,341
hi,
i am learning programming in linux environment ,i will be very thankful if any one can sent me some CODE on how to do multithreading,in the sense what system calls we need for any application

regards,
raja.
 

I can help you in right direction.
read the following man pages
fork, system, exec, pid and close
then later you can look into sigaction and signal to control
different behaviour of threads.
 

multi-thread code:

#include <pthread.h>

int do_exchange_bound1()
{
sleep(3);
return;
}



int ret;
pthread_t pid;
ret = pthread_create(&pid, NULL, (void*)do_exchange_bound1, NULL);
if (ret != 0) {
printf("create thread failed\n");
return -1;
}
pthread_detach(pid);



multi-process code:
int main()
{
int cldid;

cldid = fork();
if (cldid == 0) {
printf("child\n");
sleep(1);
exit(0);
}

printf("parent\n");

}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top