Operating Systems, CSCE 4413

Homework Assignment 1

This homework assignment has two parts. Both parts of Homework Assignment 1 are due at the start of class on Thursday, September 13.

Part 1: For the first part of this assignment I would like for you to answer some exercises from the text. These should be computer-processed and submitted to the TA via the Homework Submission Page. This part of the assignment is to be done on your own, and with the help of the textbook or other legitimate resources. For example, it is cheating on this part to read through web pages in search of specific answers to these exercises, or to share your answers with another person in the class. Your score on these questions will depend on how complete and well-thought out your answers are, and will be graded relative to the answers of other students in the class.

Do exercises 1.11, 2.10, 4.1, 4.4, 4.5, and 4.6 from Silberschatz, Galvin, and Gagne.

Part 2: For the second part of this assignment I want you to write a short program using C or C++. This should also be submitted to the TA via the Homework Submission Page. This part of the assignment is to be done on your own. However, you are allowed to use additional reading materials, including web and man or info pages. This is not a long program, so be honest and don’t search the web or other literature for specific solutions to this problem, and don’t share your answer with others in the class!

The first objective of this part of the assignment is to familiarize you with the Linux programming environment, if you are not already familiar with it. The second objective of this part of the assignment is to understand how software interrupts work in the Linux operating system. You will write a program for Linux using either C or C++ that uses the signal system call to set up and catch a signal. Your program must execute on the Linux machines in the Engineering room 337 lab.

To prepare: If you are not familiar with Linux, you will probably want to read the brief introduction to Unix. Also, you should read the man pages on signal.  You can access the necessary man pages on signal by typing “man signal” at the command prompt in Linux. Other man pages that are referenced by this one may also be useful. If you have not used Linux before, I recommend the pico editor. You can compile a program using either gcc or g++ for C or C++, respectively.

Exercise: If you write a program in Linux that has an infinite loop in it, you can stop it by typing control-C at the keyboard. The normal behavior of the program is to terminate and to return you to a command prompt. I would like you to write a program containing an infinite loop that catches the control-C command that is typed by the user, and before terminating, prints out a message such as “I caught a signal!”. To do this, you need to write a main program that sets up the signal handler, and then enters an infinite loop. The signal handler that you write will print a message, and then exit. Your final program may not be very long, but should use good programming practice (e.g., put in a sufficient number of comments to explain what your program does, use good formatting, and so on).

Submit: Your source file only to the homework submission page. Be sure that your source file compiles and executes on Linux.