Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 :
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 but this time there will be two programs, one will read the input in the format of question and write it to the shared memory. The shared memory size is and a second program the client will read the data and calculate the operations and print them to the screen.
Requirements:
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 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
you choose use semaphores or mutex locks for synchronization. The program needs to handle several matrices in the shared memory. and variable size. It can be assumed
which are squares.
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:
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
Use semaphores or mutex locks to synchronize memory access.
Can also be used in other ways. But remember processes are not threads
Use appropriate synchronization mechanisms to avoid raceconditions
file names.
Exqac
Exqbc
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started