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.

Make Comments

Even though I used make in ECE3574, I never really knew what was going inside of it. We compiled the programming in QT by typing

1) qmake -project

2) qmake

3) make

The three above commands compiled all the C++ and header files, and created an application which was run by ./(application name). After doing the homework for Unix, I finally learned what goes inside of a make file. Make might not be beneficial when compiling one or two files, but it is very helpful in real world problems where it is required to compile 100′s of files. It saves time and time is a big factor in large companies. I initially struggled doing the make file, but the exercise on make assisted a lot and made the whole concept look fairly easy.

I also finished my Tic-Tac-Toe game for ECE 3574. It took a considerable amount of time, but the functionality of the program was working fine. The project required us to save passwords as Sha1 encryption. I initially did not how to encrypt this message, but upon reading QT’s documents, it made the projects seem easy. Regardless, it took a considerable amount of time. In addition to that, we are also learning about process and threads. These concepts are fairly “alien” to me, since I have never used them.

Also, I believe that the format of this class is perfect. The fact that its a point based system  enables us to not work on all the projects, yet still get a good grade. I am just worried, because I haven’t even reached 300 points. These are my updates for this week.