Instuctions/Suggestions for Use

This exercise presents students with one of our process "ask me another" runestone components from the Chapter 13 textbook exercises. This exercise version of the component has been set up with a common starting point question and includes instructions for students to follow. The component question consists of code with fork and printf calls. The exercise starts with a fixed question that every student sees, with guided steps for the students to follow along to solve it. After solving the initial question, the instructions ask students to click the “Generate another question” button, which randomly generates a new question for them to solve.

Note these features of this component as students work on this exercise:

  • The “Generate another question” feature procedurally generates new questions that are different across users.

  • The configuration options allow a user to generate more complicated code sequences.

  • T "View the process hiearchy" button displays an interactive process hiearchy that students can use to help them answer the question (or to explain the answer). By clicking on individual code statments from the question, it displays the process hieararchy at that point in the execution.

When to Use

This is an exercise that is best suited for coverage with section 13.2 of the textbook. It reinforces:

  • the behavior of the fork function

  • concurrent process execution

  • the process hierarchy

  • tracing programs with a combination of multiple fork and printf statements

How to use

You can deliver this exercise without demo’ing the component first, the preferred way, or you can demo the component to the students first, and then have them try out the exercise. If you demo the component, please demo the version with the Chapter 13 textbook exercises rather than demo’ing this exercise version one, as the starting exercise question and its instructions to students are fixed in the provided exercise. The "generate another question" feature will then generate new unique instances after this common starting question.

One suggestion is to have students:

  • Read through (or you can read through) the exercise instructions before starting.

  • Try the activity.

The link to the exercise for students: Fork and Concurrent Processes Exercise

Contact us

Please contact the Dive into Systems authors at authors@diveintosystems.org, with any typos, feedback, or questions about exercise.