1 Develop A Program To Do The Follows A Create A Pipe B Fork A Child Process C Let The Parent Process Write 20 1 (58.54 KiB) Viewed 51 times
1. Develop a program to do the follows. a) Create a pipe. b) Fork() a child process. c) Let the parent process write 20 integers between [1, 50] to the pipe. Use random() function to generate the integers. d) Let the child process read the 20 integers from the pipe and write them to a message queue. Let the child process create the message queue, and then do the writing. Assign type 1 to odd integer, and assign type 2 to even integer when writing them to the message queue.
2. Develop a program to do the follows. a) Read even numbers one by one from the message queue used in Question 1. b) After reading an even number, write the even number +1 back to the message queue. For example, if the read even number is 8, write 9 (8+1) back to the message queue. c) Repeat a) and b) until no more even number in the message queue. Use IPC_NOWAIT to control the loop. */ I
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!