Starting from:

$20

CS314- Operating Systems: Lab 5 Solved

Part I
Write a simple image processing application in C/C++.

The input to the application should be a ​ppm​ image file. There are many free utilities to convert from ​jpeg​ images to ​ppm​
Your application must read this file and store the pixel information in a matrix.
Then, it must perform two transformations to the image, ​one after the other​. Choose some simple transformations such as “RGB to grayscale”, “edge detection”, “image blur”, etc. Let us call the two transformations ​T1​ and ​T2​.
Write the resultant pixel matrix to a new ​ppm​
Usage: ./a.out <path-to-original-image> <path-to-transformed-image>
Part II
Now suppose you have a processor with two cores. You want your application to finish faster. You can do this by having the file read and ​T1​ done on the first core, passing the transformed pixels to the other core, where ​T2​ is performed on them, and then written to the output image file. Do this in the following ways:

T1​ and ​T2​ are performed by 2 different threads of the same process. They communicate through the process’ address space itself.Synchronization using atomic operations
Synchronization using semaphores
T1​ and ​T2​ are performed by 2 different processes that communicate via shared memory.
Synchronization using semaphores.

T1​ and ​T2​ are performed by 2 different processes that communicate via pipes.
Briefly describe the chosen image transformations in your report.
Devise a method to prove in each case that the pixels were received as sent, in the sent order. Describe the method in your report.
Study the run-time and speed-up of each of the approaches and discuss.
Discuss the relative ease/ difficulty of implementing/ debugging each approach.
Submit a single zip file with the source code, a makefile, an input ​ppm​ image, and a report.

make part1​ should compile the Part I version of the code and run it, creating the file ppm
make part2_1a​ should compile the multi-thread, atomic operation version of the code and run it, creating the file ​ppm
make part2_1b​ should compile the multi-thread, semaphore version of the code and run it, creating the file ​ppm
make part2_2​ should compile the shared memory version of the code and run it, creating the file ​ppm
make part2_3​ should compile the pipe version of the code and run it, creating the file ppm

More products