Question
Write a C/C++ code but read notes before you start: 1- YOU MUST USE LINUX/UNIX. 2- YOU MUST USE LIBRARY 3- YOU MUST KNOW HOW
Write a C/C++ code but read notes before you start: 1- YOU MUST USE LINUX/UNIX.
2- YOU MUST USE
3- YOU MUST KNOW HOW TO PROGRAM USING THREADS ( CREATING,DESTROYING AND SYNCING)
THE REQUIREMENTS:
ASSUME YOU HAVE A MATRIX AND THREADS YOU MUST DO A LOAD BALANCING AS MUCH AS POSSIBLE SO THAT EVERY THREAD WILL TAKE SPECIFIC ELEMENTS IN THE MATRIX AND IT WILL FIND THE SUM OF THEM.
FOR EXAMPLE IF N = 5 AND T = 3 (NOTE IT MUST BE N > T && N%T !=0) THE NUMBER OF ELEMENTS WILL BE 25 AND THERE WILL BE ONLY 3 THREADS SO YOU SHOULD LOAD THE BALANCE OF WORK THROUGH THE 3 THREADS YOU CAN USE IN THE ABOVE EXAMPLE THE FOLLOWING:
T0 WILL WORK IN 8 ELEMENTS AND FINS THE SUM OF THEM AND T1 WILL WORK IN 8 AND FIND THE SUM OF THEM AND T2 WILL WORK IN 9 AND FIND THE SUM OF THEM (LOAD AS MUCH AS POSSIBLE).
SHOW DIFFERENT TEST CASES e.g. ( N = 107 , T = 9 )
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