Authorize: Jonathan Elgarisi
This project involves a series of C programs designed for matrix operations on Linux-Based machines. The base code handles fundamental matrix operations, while the other codes expand on this base using shared memory and threads to demonstrate different inter-process communication techniques.
- Perform basic matrix operations: addition, subtraction, multiplication, transpose, and logical operations (AND, OR, NOT).
- Handle matrices containing integers, floating-point numbers, and complex numbers.
- Utilize shared memory for inter-process communication.
- Use threads for concurrent matrix operations.
To compile the programs, use the following commands:
#Base Code
gcc -Wall MatricesCalculator.c -o MatricesCalculator
#Shared Memory Expansion
gcc -Wall MatricesCalc_Server.c -o MatricesCalc_Server -pthread
gcc -Wall MatricesCalc_Client.c -o MatricesCalc_Client -pthread
#Threads Expansion
gcc -Wall MatricesCalc_Threads.c -o MatricesCalc_Threads -pthreadOr by using the run_me files:
#Base Code
./run_me_1.sh
#Shared Memory Expansion
./run_me_2a.sh
./run_me_2b.sh
#Threads Expansion
./run_me_3.shIf you directly compiled them in the terminal, after successfully compiling the programs, you can run them using the following commands:
./MatricesCalculatorEnter matrix inputs and operations as specified. Supported operations are ADD, SUB, MUL, TRANSPOSE, AND, OR, and NOT.
- Run the server:
./MatricesCalc_Server
- Run the client in a separate terminal:
./MatricesCalc_Client
The server initializes shared memory and waits for matrix input. The client sends matrices and operations to the server via shared memory.
./MatricesCalc_ThreadsEnter matrix inputs followed by the desired operation (ADD, MUL, AND, OR). The program will perform the operations concurrently using threads.
Matrix input have to be in the following format:
(rows,columns:value1,value2,...,valueN)
whereas N = rows * columns.
notes regarding the inputs:
• The matrices must be squared (rows == columns).
• No spacing at all.
• For complex numbers - the imaginary part must have a prefix (i.e. if you want to enter a number+i, you have to write it as number+1i)
The output of the programs will display the results of the matrix operations. Error messages will provide information if any issues occur.
- Base Code Folder
- MatricesCalculator.c: The base code containing the main matrix operations.
- run_me_1.sh
- CMake files
- Shared Memory Expansion Folder
- MatricesCalc_Server.c: Server code for shared memory implementation.
- MatricesCalc_Client.c: Client code for shared memory implementation.
- run_me_2a.sh
- run_me_3a.sh
- CMake files
- Threads Expansion Folder
- MatricesCalc_Threads.c: Code for implementing matrix operations using threads.
- run_me_3.sh
- CMake files
- README.txt: The text file you're currently reading.