You are provided with a text file containing randomized integers from 1-10000 called randomNum.txt. Write a program to sort these integers. You will have to create 5 separate processes for this, which will work in parallel to sort the integers. This means Process 1 will sort integers from 1-2000. Process 2 will sort integers from 2001-4000, and so on. Parse the text file line by line and assign each integer to its corresponding process. Create a 6th process that will put all the individual outputs together into one big file. Your output will be another text file called sorted.txt which will have all the integers sorted.

Input: As stated, for the input, read a file called randomNum.txt. This contains integers from
1-10000.

Besides the fact we don't do your homework it matters which OS this runs on. The code to fork varies from Windows, Linux, BSD, Android, MacOS, AmigaOS and all the rest. My advice is to share what platform this is on and supply the code passage you are having trouble with along with what you think is wrong.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.