Solved-Mutexes, Threads — Project 3- Solution

$35.00 $24.00

Motivation: Topics covered by this project; Mutexes, Threads Chapter 5 in Stallings Overview std::cout is not threadsafe, if you try to send output to it from many different threads the output can get garbled. Especially if you do something like this; std::cout<<data1<<data2<<data3<<data4<<std::endl; Your task, gentle reader, is to remedy this situation and produce a tool…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

5/5 – (2 votes)

Motivation: Topics covered by this project; Mutexes, Threads

Chapter 5 in Stallings

Overview

std::cout is not threadsafe, if you try to send output to it from many different threads the output can get garbled. Especially if you do something like this; std::cout<<data1<<data2<<data3<<data4<<std::endl;

Your task, gentle reader, is to remedy this situation and produce a tool that will ease the considerable burden of developing and debugging your upcoming project 4.

Requirements:

Please provide me with

tester.cpp – file that launches many threads, each of which output strings to the console using above syntax.

output.cpp and .h – Contain a series of functions that are threadsafe and easy to use from anywhere in a project, here are their declarations:

void PRINT1(std::string &txt);

void PRINT2(std::string &txt, std::string &txt1);

void PRINT3(std::string &txt, std::string &txt1, std::string &txt2);

void PRINT4(std::string &txt, std::string &txt1,std:: string &txt2, std::string &txt3);

void PRINT5(std::string &txt, std::string &txt1, std::string &txt2, std::string &txt3, std::string &txt4);

Sample use

std::string s1=”some”;

std::string s2=”data”;

PRINT2(s1,s2);

Teams

Please work 2 to a team. Please include a description of what each team member did as part of your submission. Percentage responsibility for the final product is fine.

Grading

I will drop your tester.cpp and into the appropriate places in my project. Therefore these are the only files that I need from you.

40% tester.cpp works correctly

60% output.cpp and .h work correctly

This assignment is relatively easy so it is weighted 1.0 times the weight of project 1