Assignment 3
Assignment 3
ISLAMABAD
OPERATING SYSTEMS SPRING 2019
ASSIGNMENT 03
Instructions:
The value 8 is calculated using only one thread so; you have to
calculate each value of resultant matrix using a thread. Take two matrices
(A and B of size 3x3 both) from user your resultant matrix is of size
3x3 you have to create 9 threads for calculation of each value of
resultant matrix.
Question 2: Submit three .cpp files and three .txt files.
Input.txt file is given with this assignment. You have to
use this input.txt file in this question. You have to read your inpu.txt file
line by line in main thread, create a thread against your each line of file
and pass that line to your created thread. Each thread has to capitalize
the line pass to it and write it on output.txt your writing should be done
char by char. First you have to implement this without using any lock or
join, and then you have to do it using Mutex and generate output.txt, in
last you have to implement it using Binary Semaphore and generate
output.txt.
You have to use input.txt file in this question also. There are total
12 lines in the input.txt. You have to read this file using multiple threads
each line should be read by only one thread. But only three threads are
allowed to read from file at a time. Each thread will output its read line.
You have to use semaphore.