Question: Question 2 : In this question we will expand the question to a calculation using two programs The input and output format will be the

Question 2:
In this question we will expand the question to a calculation using two programs
The input and output format will be the same as that of question 1, but this time there will be two programs, one will read the input (in the format of question (1) and write it to the shared memory. The shared memory size is --2048 and a second program (the client) will read the data and calculate the operations and print them to the screen.
Requirements:
1. The program should create shared memory to store the matrices. The shared memory can be implemented using the functions shmdtshmet', 'shmat or any other way 2. The server process should create the matrices in the shared memory read from the user.
(in the format you determine for yourself) The server process should write the data to the shared memory in a synchronized manner and in any method
3 you choose - use semaphores or mutex locks for synchronization. 4. The program needs to handle several matrices in the shared memory. and variable size. It can be assumed
which are squares.
5. The server will exit and delete the shared memory when the user presses END, until then it will remain in an infinite loop that calls the user.
Hints:
1. Use structures to represent the matrices and their metadata, including the degree
and the coefficients. (In class we saw a data structure of countries - did something similar))
2. Use semaphores or mutex locks to synchronize memory access.
Can also be used in other ways. But remember - processes are not threads
3. Use appropriate synchronization mechanisms to avoid race-conditions
file names.
Ex3q2a.c .1
Ex3q2b.c .2

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!