Submit the following folders in a ZIP file named <9-digit ID #>_me7.zip (e.g. 201123456_me7.zip)

1) number

Create a program that gives the user 5 seconds to give a number. After 5 seconds, the program will terminate with or without a user input.

HINT: Use fork to spawn a child process, then sleep to pause the parent before killing the child process

2) wordtype

Create a program that gives the user 30 seconds to type the word "Supercalifragilisticexpialidocious" (case sensitive). The user can try again as long as the timer hasn't expired. Unlike #1, the program should end when the user enters the correct word.

A possible way to implement this is described below:

a) Like #1, the parent will the kill the child process when the time expires.

b) Use wait instead of sleep so that the parent will resume when the child ends (i.e. correct string)

c) Setup an alarm that signals after 30 seconds before wait. The signal handler will be the one to kill the child process (you can use a global variable for the child PID)

d) You can clear the alarm using alarm(0) (i.e. if child ends before alarm)

3) intercom

The lecture example demonstrates how to use FIFO for one-way communication. Create a similar program with the following changes:

a) Use one C file. If the FIFO exists, run as a receiver

b) Establish two way communication by creating 2 FIFOs (created by the sender)

- You need to fork a new process to be able to send and receive simultaneously

c) Terminate communication by typing "exit"

HINT: send and receive methods will be common, just change what FIFO to send/receive from