Program puts prompt "How many" on the standard input. The user types an inter,NN at the [url removed, login to view] your program types a prompt "SLEEP". The user then gives the argument to be put in the sleep command (start with 0) in your program. use 0 to start with.
The program should generate two processes, PRODUCER and CONSUMER.
PRODUCER should generate expressions of the form n1+n2, where n1 and n2 are [url removed, login to view] integers should be produced by a rodom number generator and should be in the range 1-99. After it produces such an expression it should write it to file SHAREFILE. The program should produce a total of NN such expressions writing each to SHAREFILE. After the write to SHAREFILE place a "sleep(SLEEP)" command in the PRODUCER program.
COnsumer should read an expression from file SHAREFILE concatenate = n3 to it. The entire resulting expression is n1+n2 =n3, where n3 is the correct sum 0f n1 and n2. CONSUMER then puts [THE INFORMATION NECESSARY TO PRINT THAT RESULT IN THAT FORM] in its own memory, CONSOWN, location. It should process NN such expressions. CONSUMER also keeps a counter, COUNT,EACH time that CONSUMER looks for the next item in SHAREFILE and it is not there CONSUMER increments COUNTER [AND TRIES AGAIN]. When consumer has finished putting NN expressions in CONSOWN it should print them out in readable form , one expression per line. It should print out COUNT. After this printout, both processes should terminate gracefully.
In program, "12+7" -> use (fscanf and fgets) to get string
Syntax is like:
example PRODUCER generated expressions
corresponding CONSUMER printout expressions
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bid request.
3) Exclusive and complete copyrights to all work purchased. (No GPL, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site).
4) use system call sleep(), fork(), + another if you need.
unix sun os 5.8 , C,
gcc command to compile.