Question: Hello please I need help with the following question coding I need you to use Erlang only, here is the part asking to create some

Hello please I need help with the following question coding I need you to use Erlang only,

here is the part asking to create some function in Erlang coding. i a screenshot for it.

In Erlang only thanks

Hello please I need help with the following question coding I need

8. Create a function producer(Pid, N) that takes consumer's pid and an integer N as arguments. The function is to repeat N times. While the function is running, it generates random numbers and prints them along with its process id to the shell (as in process producing 5, process producing 1, ...):, and then sends these numbers as messages to the consumer process using consumer's pid. (Note: the producer function is set up to send messages but NOT to receive). When you spawn this function in go(), decide on the value of N you will want to pick some small N for testing purposes (e.g. 7) 9. Create a function consum umer() that consumes the numbers sent by the producer via the receive statement, and prints them with along with its process id to the shell (as in process consuming 5, process consuming 1, ...). (Note: the consumer function is set up to receive messages but NOT to send) After verifying everything works, extend the consumer() function by putting the process to sleep for 10 units and only then beginning to receive, timer:sleep (10). Finally, end the consumer process when no new message arrives for about 40 units of time (hint: use after primitive to do so) . 8. Create a function producer(Pid, N) that takes consumer's pid and an integer N as arguments. The function is to repeat N times. While the function is running, it generates random numbers and prints them along with its process id to the shell (as in process producing 5, process producing 1, ...):, and then sends these numbers as messages to the consumer process using consumer's pid. (Note: the producer function is set up to send messages but NOT to receive). When you spawn this function in go(), decide on the value of N you will want to pick some small N for testing purposes (e.g. 7) 9. Create a function consum umer() that consumes the numbers sent by the producer via the receive statement, and prints them with along with its process id to the shell (as in process consuming 5, process consuming 1, ...). (Note: the consumer function is set up to receive messages but NOT to send) After verifying everything works, extend the consumer() function by putting the process to sleep for 10 units and only then beginning to receive, timer:sleep (10). Finally, end the consumer process when no new message arrives for about 40 units of time (hint: use after primitive to do so)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!