C linux Program homework need help, dont give the wrong answer please, show the result and output plz.
also if you have definition that will help a lot
Transcribed Image Text: Instructions
Write a C program that will start a race between 4 processes to get a number from the user inputs. The user will enter
4 numbers (1 to 4), the process that receives the first number (1) will be the winner, and in the first place, processes
afterward will get second, third, and fourth place depending on the number they get from the user.
The program will start using the fork() System call to create 4 child processes; each process created is identified by a
number from 1 to 4. This number indicates its creation sequence. For example, the first child process created gets ID =
1 and so on.
After all child processes are created, each process will request a number from the user. Each process will print the
number it got from the user and also print its ID number. The parent does not participate in the race and waits for all
child processes to finish before it exits.
Notice: The numbers and the order of processes on your computer might be different. This is an example of a Race
condition. Processes race for input and output resources.
Sample Output
vocstartsoft:~/environment/test 5 gcc ForkGame.c -o FG
vocstartsoft:~/environment/test $
vocstartsoft:~/environment/test $
vocstartsoft:~/environment/test $ ./FG
Enter nubmers for processes to race for >>>>
I am a process with pid 11790 and I am process number 3 in the race.
I am a process with pid 11791 and I am process number 4 in the race.
I am a process with pid 11789 and I am process number 2 in the race.
I am a process with pid 11788 and I am process number 1 in the race.
1
I am a process with pid 11790 and I am process number 3 in the race and I am in the 1st place.
2
I am a process with pid 11791 and I am process number 4 in the race and I am in the 2nd place.
I am a process with pid 11789 and I am process number 2 in the race and I am in the 3rd place.
4
I am a process with pid 11788 and I am process number 1 in the race and I am in the 4th place.
vocstartsoft:~/environment/test $I