Write a C program which will fork 11 children. The original process and the firs
ID: 3836669 • Letter: W
Question
Write a C program which will fork 11 children. The original process and the first child will be readers while the remaining children will be the writers. There should be two pipes, one for the writers to read from and one for the readers (parent and first child) to read from. The parent will write 1000 integers, 1 to 1000, to the writers' pipe. The writers will each read as many integers as they can, counting the number read. When the pipe is empty each writer will write to the readers his and the number of integers read. The readers will read individual writers' reports and print on stdout a line similar to Process0: Child 47836 read 132 integers Note that the original process should call itself Process0 while the first child will call itself Process1.Explanation / Answer
Understanding the problem statement I have written the program with the usage of semaphores
Please find the below-working code
***************
**************
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.