Question: This programming task is to be done in C. Programming Task: You will have a main process, let us name it a Server process for

This programming task is to be done in C.

Programming Task: You will have a main process, let us name it a Server process for ease of explanation. The Server process is going to read the input file items.txt and it is going to create a shared memory, where its keeps all of the information about the gift items reads from the file, using structure. The items.txt file contains 100 lines, each line has following 3 columns description about the gift item: first column represents the serial number, used to indicate the item number, second column represents the gift item, third column represents the price of the gift and the store where it is available.

You need to store this information about each product in 4 fields within the structure: serial number gift name price store

The Server process then asks the user to enter the value for N and then creates N number of Customer processes and 1 Helper process. The Server process also asks the user to enter an order for these N processes and passes this information to the Helper process. Each of these processes (both Customer and Helper) will be running in parallel. Each of these Customer processes will ask user to enter one integer number (lets say M), which will represent the number of gifts to be selected from the collection of gift items available in the shared memory. Then, each of these N number of Customer processes will read the items list from the shared memory (created by the Server process) and randomly picks the M number of items. Helper process uses the order to get the number of gift items from each of these N processes. For this communication, it is required to use message queue. For example if N = 3, then each there will be 3 Customer processes: Customer process A: if M = 2, then it will select 2 gift items Customer process B: if M = 5, then it will select 5 gift items Customer process C: if M = 4, then it will select 4 gift items

If the order selected is B, C and A, then the Helper process will get the collected item list from process B first, followed by process C and finally process A.

The Helper process then computes the cost of all gift items for each process and displays the summary result to the console. The summary result should include: Customer process ID, all list of gift items selected by that process (each line should be for one gift), and finally the total price for that process. Once the Helper process displays the summary result and saves all the result in the output files: one for each process, it then signals the Server process that all the task is done and the program exits by Server process printing Thank you.

Programming requirements: Your program should extensively use the following concepts: 1) Files are used for both reading and writing. Use appropriate output name for each process. 2) Two types of IPC mechanisms are to be used: a. Memory sharing between the Server process and the Customer processes as well as to Helper process. b. Message passing between the Customer process and the Helper process. 3) Structure arrays need to be used for gift items. 4) The Server process should wait till the Helper process signals it that all task is done. 5) There should be no zombie or orphan processes The grading will be as follows: Correct use of memory sharing among Server process and the Customer processes and Helper process . [30 Points] Correct use of message queue among the Customer processes and Helper process [30 Points] Correct use of fork() system call. [15 Points] Correct functioning of Server process [7 Points] Correct functioning of Customer processes [10 Points] Correct functioning of Helper process [8 Points]

Below is the items.txt file;

1. Skyrocket Blume Doll $7.59 at Amazon 2. Diamond Dazzle Stik $8.77 at Amazon 3. Milani Highly Rated 10-in-1 Volume Mascara $8.97 at Amazon 4. Ontel Veggetti Spiralizer $9.99 at Amazon 5. Popsockets $9.99 at Amazon 6. TheraFlow Foot Massager $9.99 at Amazon 7. Wet-n-Wild Liquid Catsuit Lipstick $4.34 at Amazon 8. Invisibobble (3-pack) $7.50 at Amazon 9. WowWee Lucky Fortune Blind Collectible Bracelets $8.99 at Amazon 10. BodyGlide $9.99 at Amazon 11. Scratch Art Box of Rainbow Mini Notes $7.76 at Amazon 12. Make-up Removing Cloths, 4 Count $9.99 at Amazon 13. Duncan Imperial Yo-Yo $3 at Amazon 14. Dash Mini Maker $9.99 at Bed Bath & Beyond 15. WikkiStix Rainbow Pak at Amazon $8.94 at Amazon 16. Rabbit Wine and Beverage Bottle Stoppers $8 at Amazon 17. AhaStyle AirPods Case Cover $5.39 at Amazon 18. Tweexy Wearable Nail Polish Bottle Holder $9.99 at Amazon 19. Fred & Friends Manatea Silicone Tea Infuser $14.79 at Amazon 20. Codenames $14.88 at Amazon 21. Takeya Cold Brew Coffee Maker $16.99 at Amazon 22. Tile Mate $24.99 at Amazon 23. Deweisn Tri-Fold Lighted Vanity Makeup Mirror $19.98 at Amazon 24. Nidra Sleep Mask $11.95 at Amazon 25. FinalStraw $19.95 at Amazon 26. InnoGear Upgraded Diffuser $11.99 at Amazon 27. Echo Dot (3rd Generation) $18.99 at Amazon 28. Dash Rapid Egg Cooker $19.99 at Amazon 29. Rachael Ray Yum-o! Oven Lovin' Loaf Pan $11.99 at Amazon 30. Bananagrams $14.94 at Amazon

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!