Written Assignment 8

The following answer assumes printf() will print immediately in stdout with no buffering like sio_printf() as suggested in piazza.

Question 1

a. there are 2 possible outputs

  1. pikachu
  2. kapichu

b. there are 3 possible outputs

  1. kapichuchu
  2. pikachuchu
  3. pichukachu

Question 2

a. There are 8 different output sequence (signal might not receive before exit(0) for children)

A possible sequence can be:

count = 1
count = 2
count = 3

b. Will be different. An example can be:

count = 1
count = 1
count = 2
count = 2
count = 3
count = 3

Question 3

man sigprocmask, gives the following:

The behavior of the call is dependent on the value of how, as follows.

              The set of blocked signals is the union of the current  set  and
              the set argument.

              The  signals  in set are removed from the current set of blocked
              signals.  It is permissible to attempt to unblock a signal which
              is not blocked.

              The set of blocked signals is set to the argument set.

Therefore, three possible values and their corresponding behavior are:

Table of Content