Since I haven't found any solution to my problem, I would like to ask for help myself.
I've got a task like this:
- A program consists of 2 processes, first process shuffles N numbers in a range of 1...100 and writes them to file. N is passed as a parameter while starting the program
- Process 1, before shuffling numbers, starts the 2 process, which waits for a file to be available (spinlock)
- Process 2, once it has access to file, read the numbers from the file, calculates the avarage and prints it on the screen, Process 2 ends
- Process 1 ends after process 2 (WaitForSingleObject)
The whole thing needs to be done on one main.exe file. How do I create 2 processes, both starting the same file? Is there any efficient way of approaching this task?
NOTE: I don't need any help on shuffling the numbers, creating file or reading from it, I wanted to present the whole task so that you could think of it as a whole. I only want to know the way those 2 processes should be started.
Aucun commentaire:
Enregistrer un commentaire