Question: Using C programming, write a program with the following requirements.- ---------Inter process communication using shared memory----------- 1. Write a typedef statement that defines a structure
Using C programming, write a program with the following requirements.-
---------Inter process communication using shared memory----------- 1. Write a typedef statement that defines a structure type with a. an array, named data, of 30 integer type of elements b. two integer type of fields named s and m
2. Write c-statements to a.create a shared memory object b. configure the size of a shared memory object with the size of the type defined in a.
3. Write c-statement to call mmap() to map the shared memory object created in b to process logical space. Make sure to declare a variable to store the pointer returned by mmap().
4. Write c statements to initialize the field s to 30 and field m to12 in the shared memory object mapped in c.
5. Write c-statements to create exactly two new processes. a. The first child process assigns 100 in the array field data in the shared memory object for the entries from index 0 to index m 1. b. The second child assigns 200 in the array field data in the shared memory object for the entries from index m to index s 1. c. The parent process will wait for both child processes to complete.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
