Pipelines and Forks

After working on the homework that was due the past week, I learned a lot about what Unix can do. In order to finish the homework, I had to learn about pipelines and being able to fork a command so that it could do multiple things. This was necessary in our homework because there were two child processes that needed to be executed. I needed to read from the pipe and then write to the pipe as well which were new commands. I thought it was really interesting that there were multiple ways to create a pipe as opposed to just one way. It allows for some differences in peoples coding styles depending on what they like to do.

We had to print messages to the standard error showing that each child process had been successfully executed and closed. Then we had to implement a wait function so that there was a pause between the closing of the two child processes.

There was also a makefile that had to be made for this assignment in order to run the program correctly. It took a lot less time to make then it did when I first tried writing one, and I’m getting much better at it. I have learned the format and structure so I no longer need a guide to help me. I still need to work on the finer details of makefiles though.

Confusion with Makefiles

After finally finishing the makefile homework, I breathed a sigh of relief. I probably made it much more complicated than it actually was, but I seemed to have a lot of trouble with it. I went online to try and figure out what I was doing wrong, but I couldn’t quite grasp the concept. When I was looking at targets and dependencies, it all kind of got jumbled together. So when I was trying to figure out which .cpp and .o files were supposed to go where, it took me a while to understand the pattern. I kept putting the wrong files with the outputs or outputs in files they weren’t supposed to be with.

After a while of working on this, I finally had a breakthrough with it. The way the homework was worded had really thrown me off, but once I understood it and got one of the lines correct, the others fell into place. I’m still not quite sure I have the whole concept mastered, but I think that I’m getting a better understanding of what a makefile’s purpose is and how it is used for output and .cpp files. I definitely either need to do some more research or get some more practice with creating makefiles.