Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE HELP!!! Summary: The purpose of this assignment is to have processes (and threads) be responsible for servicing signals sent by other peer processes (threads).

PLEASE HELP!!!

Summary: The purpose of this assignment is to have processes (and threads) be responsible for servicing signals sent by other peer processes (threads). The processes (threads) must execute concurrently and performance of all process (thread) activities is to be monitored and analyzed. Write C program that requires developing a solution using a parent process, four signal handling processes, three signal generating processes and a reporting process (total 9 processes). For this program, the parent process creates the remaining 8 child processes, controls execution time of the child processes and waits for their completion. The program is to use two signals for communication: SIGUSR1 and SIGUSR2. Each of the signal generating processes will execute in a loop, and during each loop repetition will randomly select either SIGUSR1 or SIGUSR2 to send to the processes in its group (its peers). Each repetition through the signal generating loop will have a random time delay of between .01 and .1 second before moving to the next repetition. After generating a signal, the process will increment a shared signal sent counter for that signal type (i.e., a counter globally available to all processes in the program that need access to the counter). That is, each signal type has its own counter for signal sent. Each of the signal handling processes will process only one type of signal, either SIGUSR1 or SIGUSR2 and ignore servicing the other type. (Thus, two of the four processes are assigned to handle each type of signal). Each of the signal handling processes will also execute in a loop, waiting for its signal to occur. When the signal arrives, the process will increment a shared signal received counter for that signal type (i.e., a counter globally available to all processes in the program that need access to that counter). Each signal type has its own signal received counter. The process will then loop waiting for the next signal. The reporting process will execute in a loop, also waiting for signals. It will respond to both types of signals. Each time it handles 10 signals, it will report the system time and the count of the number of occurrences of each signal type counter as indicated in each of the shared memory counters (at the time of the report). The reporting process should also report the average time between receptions of each signal type during the interval in which the 10 signals are received. This will require the reporting process to remember the time of occurrence of each signal type. Access to the global counters in each program requires the use of a critical section control. You are to use a lock for the critical section control. Use the lock to provide each process (thread) access to each global counter.

Results to Report:

  1. You should run the program for 30 seconds and examine the performance; that is, the number of signals of each type sent and received. Also examine the average time between signal receptions of each type by the reporting thread. Be sure to investigate and discuss any signal losses.
  2. You should run the program for a total of 100,000 signals and look at the total time and counts for the signal types, as well as the average interval between signal receptions of each signal type by the reporting thread.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Accounting questions

Question

What are the purposes of promotion ?

Answered: 1 week ago