Answered step by step
Verified Expert Solution
Link Copied!

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

=+1 What null hypothesis were the researchers testing?

Answered: 1 week ago

Question

Can consultants replace outsourced activities? Why or why not?

Answered: 1 week ago