Intro to Unix ECE 2524 Entry #8

I’ll go ahead and start off this blog by talking about the makefile assignment since I haven’t said anything about that yet.  At first, I thought making a makefile would be extremely difficult; I figured that since the process was often automated it must be very hard. I actually found it to be very intuitive for the most part. Each target will be re-created based on any dependencies that it has, so if any of its dependencies change then the target will be recreated based upon the commands listed for that target. I found especially beneficial that you can have multiple targets if they have the same dependencies and are created by the same commands, this came in handy for the parser.tab.hpp, and parser.tab.cpp files which were both dependent on parser.ypp and were created by the same bison command.

The most recent assignment was on forking processes and creating a pipe.  The first part of the assignment was to create a makefile which proved to be very easy after the last homework.  For the most part the homework was very straightforward and took nothing more than looking at examples and reading the man pages.  Of course I had a couple small bugs, but Darren pointed me in the right direction with these issues, and I got the homework finished without too much trouble.  I have a lot more experience in C++ so it is a lot easier for me to write C++ code then it was with writing Python which was a struggle especially through poor documentation.  I thought this was a cool assignment that showed how the beginnings of a shell may come together.

The most recent assignment in 3574 wasn’t too difficult after some guidance from Sean.  This goal of this homework was to use threads to perform matrix multiplication.  Reading from the input file actually proved to be more difficult than I had expected since Sean told me he would probably do a of error checking by supplying oddly formatted input files.  He showed me how to use QRegExp (regular expressions) to get a good pattern for determining if the input is an int or a float, and then if the input didn’t match either of those then you know that there is something wrong with the input. This eliminates the need to check for a multitude of different things such as if there are letters entered, or special characters, or who know’s what else. The regular expression catches it all with ease.  I read the input files into a QList of QStringLists, which gave me access to the matrix elements in a similar way to a 2-D array.  After that it was pretty easy just to run a for loop to make the correct number of threads, calculate the correct products then output it to the resultant matrix.  I found that there was no need for mutexes since there is no thread was going to access to the same memory location, so this made the assignment even easier.

Leave a Reply