Write a C program using the following 5 steps below 1 Write

Write a C program using the following 5 steps below:

1. Write a typedef statement that defines a structure type with:

i. an array, named data, of 30 integer type of elements

ii. an integer type of field named upper_low

2. Write c-statements to create and configure the size of a shared memory object with the type defined in a.

3. Declare a variable to store the pointer returned by mmap() function call, and call mmap() to map the shared memory object created in b to process\' logical space.

4. The parent process accepts a command line input, verifies that the input value is greater than zero and less than 30, and then stores the value in the upper_low field of the shared memory.

5. The parent process creates exactly two new processes:

i. The first child process stores its process id in the entries from index 0 to index upper_low - 1 of the array field data in the shared memory object.

ii. The second child stores its process id in the rest of the entries of the array field data in the shared memory object.

iii. The parent will wait for both child processes to complete, then display the contents of data to the screen

Solution

Answer for Question Number 1. #include #include #include typedef struct { int data[30]; int upper_low; } ;
Write a C program using the following 5 steps below: 1. Write a typedef statement that defines a structure type with: i. an array, named data, of 30 integer typ

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site