ECS150 Course Website

last updated
Programming Assignment #1

Lab 1 Clarifications

The due date for lab 1 has been extended to Monday, Febuary 2nd. Interactive grading will start on the 5th.

Be prepared to answer questions during the interactive grading session. I'll expect you to not just come up with a solution to the questions, but to also understand the solution.

Program 1(b): You should attempt to fill up main memory and see how many processes can be accommodated by Minix.

Glass Exercises

4. Glass text, Exercise 13.1, page 559. Write a program that catches all signals sent to it and prints out which signal was sent. Then issue a "kill -9" command to the process. How is SIGKILL different from the other signals? [level: easy]

5. Glass text, Exercise 13.2, page 559. Write a program that takes a single integer argument n from the command line and creates a binary tree of processes of depth n. When the tree is created, each process should display the phrase "I am process x" and then terminate. The nodes of the process tree should be numbered according to a breadth-first traversal. For example, if the user enters:

$ tree 4

then the process tree would look like this:

The output would be:

I am process 1
I am process 2
      .
      .
      .
I am process 15

Make sure that the original parent process does not terminate until all of its children have died. This is so that you can terminate the parent and its children from your terminal with Control-C. [level: medium]

6. Glass text, Exercise 13.3, page 560. write a program that creates a ring of three processes connected by pipes. The first process should prompt the user for a string and then send it to the second process. The second process should reverse the string and send it to the third process. The third process should convert the string to uppercase and send it back to the first process. When the first process gets the processed string, it should display it to the terminal. When this is done, all three processes should terminate. Here's an illustration of the process ring:

Here's an example of the program in action:

$ ring
Please enter a string: ole
Processed string is: ELO
$ _

[level: medium]