Skip to content

TCSS422 - Computer Operating Systems - Project 4 - C Program to simulate Multi Threading and allow us to understand how multi processing works

Notifications You must be signed in to change notification settings

raymondluu/MultiThreading

Repository files navigation

Raymond Luu

My program is broken up into Main, Producer and Consumer. Both the producer and consumer are subroutines within the program and run on their own threads by using the pthread library functions. I utilize mutexes and pthreads to simulate HW 3 and it works correctly. Producer processes the file and puts it into the data storage when it goes through all the mutexes and stores the contents into the structure. While all this is happening consumer is waiting on the unlock from producer on read so that it can start doing its work. When it starts it takes the structure contents and outputs it into the file.

This time I paid good attention to the professor and did my reading before I went into coding it so I had a better idea of how things work and how to code it. I looked at the pthread tutorials and looked up several examples on youtube and got a good idea of how mutexes and pthreads worked. When I went to coding it I didn't run into very much problems. I initially did it on Cygwin due to laziness of pulling out the pi and it would run without compling with -pthread but then the mutexes didn't work but it would compile. Then i switched over to the pi and compiled it and it gave me errors on initializing the mutexes. I had to take everything out into the global area versus me declaring it in global with empty parameters and then initializing them in main. That didn't work and the compiler didn't like it so I took everything out of main and into the global initialization and it worked perfectly fine. Once I got the output to print correctly I then transposed the code to make it print onto a file and then I was done. Overall this has been a fun assignment and I did learn a lot about my study and homework habits and will continue to do my pre research work before I attempt assignments.

About

TCSS422 - Computer Operating Systems - Project 4 - C Program to simulate Multi Threading and allow us to understand how multi processing works

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages