Write a program which has a base process which communicates

Assignment Help C/C++ Programming
Reference no: EM13347844

Write a program which has a "base process" which communicates with child processes acting as "bombers" that it creates.

· Handling processes by use of fork(), getpid()and wait()

· Handling signals by use of signal(),alarm()and kill()

· Opening and accessing a console window buffer

Operation

Before executing the program, the user should open four console (terminal) windows. The first terminal window will represent the base, and the other three will represent the three bombers.

The first action of the program's main loop is to discover how many terminals are open by trying to open all possible terminal number buffers (e.g. /dev/pts/1,/dev/pts/1 etc...) as a read only file. Those that are open should be stored so that the first four found can be written to.

The main function of the air base is use fork() to spawn three child bomber processes which are to execute the same exact code, and a fourth child (without an associated terminal window) to receive input and while monitoring and signaling the bombers.

Each bomber is to be initialized to contain 50 gallons of fuel, six bombs, and to be a distance of zero miles from the base. An alarm() timer is to be installed and used which:

· Decrements the fuel by two gallons each second.

· Increments the distance from base by one mile every two seconds if going toward target, and decrements the distance from base by one mile every two seconds if returning to base.

· Reports the fuel amount, ordinance left, and distance from base every three seconds in the appropriate terminal. e.g.

Bomber id to base, g gallons left, b bombs left, m miles from base.

If a bomber ever runs out of fuel it should be terminated by exiting with an unsuccessful code. If a bomber drops all of its payload, it should begin returning to base. If it makes it back to base without running out of fuel, it should terminate with a successfully code.

Reference no: EM13347844

Questions Cloud

Answer the following questionsnbspexplain your thinking to : answer the following questions.nbspexplain your thinking to demonstrate your understanding of economic terms and
Question 1 on september 1 roshek office supply had an : question 1 on september 1 roshek office supply had an inventory of 31 calculators at a cost of 17 each. the company
1 cbt has agreed to finance the needs of a stereo : 1 cbt has agreed to finance the needs of a stereo wholesaler for the next month. to complete the loan agreement the
The purpose of this two-part project is to compute the : the purpose of this two-part project is to compute the students ability to analyze security requirements and prepare a
Write a program which has a base process which communicates : write a program which has a base process which communicates with child processes acting as bombers that it
Part 1aig is often called the largest insurance entity in : part 1a.i.g. is often called the largest insurance entity in the world. a.i.g.s total assets were 860 billion on
You are working as a financial analyst for apple inc apple : you are working as a financial analyst for apple inc. apple inc. is one of the most innovative companies worldwide.
Memory location 2000h has the word 5000h stored in it what : memory location 2000h has the word 5000h stored in it. what does each location contain after inc byte ptr2000h. also
Current cost of a bond you know that the after-tax cost of : current cost of a bond you know that the after-tax cost of debt capital for bubbles champagne is aprox. to 7 percent.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program that calculates the user''s bmi

Write a program that calculates the user's body mass index (BMI) and categorizes it as underweight, normal, overweight, or obese, based on the following table from the United States Centers for Disease Control

  Write c program that will input two values from the user

write c program that will input two values from the user with a prompt ? that are a value and a base with which you

  C string and two int reference parameters

Write a complete function, not an entire program, that has a C string and two int reference parameters (call them a and b), returning nothing.

  Write a program to calculate a person''s net pay

Write a program to calculate a person's net pay after subtracting federal income tax.The program should ask the user to enter the person's name, social security number, gross pay, and the number of dependents.

  Prepare a program for a company named retail-martbullprompt

prepare a program for a company named retail-mart.bullprompt the user to enter an item name one word only a quantity

  Heights of the individual pupils

Make a C++ program that helps the health visitor making the statistics and heights of the individual pupils,

  Value referenced by the pointer.

Add 10 to the value referenced by pointer switch.Add 4 to the address stored in pointer switch.Subtract 5 from the value referenced by the pointer.

  The staffs need a program that can determine

The staffs need a program that can determine whether children have been naughty or nice. individual data files(can be any name) for each childred are available that consist of 368(365+3)integer number each.

  Design an algorithm to find the selling price

To make a profit, the prices of the items sold in a furniture store are marked up by 60%. Design an algorithm to find the selling price of an item sold at the furniture store. What information do you need to find the selling price?

  Reverses the characters in a character array

Write the function reverseit that reverses the characters in a character array. You must also write main that calls reverseit.

  Program to tell you how many months it will take to pay off

write a program to tell you how many months it will take to pay off any loan, as well as the total amount of interest paid over the life of the loan.

  Concept of object-oriented programming

Determine the manner in which each of the provided concepts relates to the concept of object-oriented programming. Justify your response - Analyze the fundamental manner in which they each relate to C++ coding of programs.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd