merge sorting usnig process

Hello all...
how can i implement merge sort using process in linux? i know fork should be used to create process.but how can i control the child process to work with array passing some kinds(actually i don't know)parameter to it?
Thanks in advance
closed account (S6k9GNh0)
Why are italics needed on every word...

Anyways, I suggest you google the exact heading you used for this topic. You'll get results.
Last edited on
Why do you want to use child processes to do the merge?
will a thread do rather than creating a process??
Actually a process will create two child processes each having half of the array element...recursively a function will be called to do this..after completion of recursion two child process will return the array element to their mother process and it will sort those two arrays....is it possible??how??
what you want to do can be effectively done by threads.. but if you want to create process for that then you need a way for communication between the processes..like shared memory, memory mapped files or IPC. read about them.
I think you are looking for this:

std::stable_sort(my_data.begin(), my_data.end());


Then you just have to trust the compiler to do right think.

For gcc and libstdc++ you can use parallel mode: http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt12ch31s03.html
Topic archived. No new replies allowed.