Base process which communicate with child processes

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

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: EM131777

Questions Cloud

Discuss one of the ingredients of growth pertinent to todays : Discuss one of the ingredients of growth  pertinent to today's economy
Determine merchandise inventory : Determine merchandise inventory
Construct a computer simulation model to track of cash flow : Construct a computer simulation model to keep track of the cash flow
Analyze security requirements and prepare a security policy : Analyze security requirements and prepare a security policy.
Base process which communicate with child processes : Write a program which has a "base process" which communicates with child processes acting as "bombers" that it creates.
Describe how moral hazard and adverse selection materialized : Describe how moral hazard and adverse selection materialized during the financial failure of A.I.G
Perform horizontal financial analysis : Perform horizontal financial analysis
What are the contents of given register : Memory location 2000H has the word 5000H stored in it. What does each location contain after INC BYTE PTR[2000H]. Also after DEC WORD PTR[2000H]
Current cost of a bond : Pre-tax cost of debt capital  and Current price of the bonds.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Computer programming using c language lab

Computer programming using c language lab

  Assessment system of a university

Write a program for Assessment system of a University

  Implementation of sorting technique

Implementation of sorting technique

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Write a program that converts between app and ppm values

Write a simple program that converts between APP and PPM values

  Write a program to crypt its input accordingly

Write a program to crypt its input according to a specified transformation scheme

  Write a program to read a data file and extract parameters

Write a C/C++ program to read a data file and extract parameters. The program must obtain the filename via a command-line argument.

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  C++ programming uml diagrams

The goal of this lab is to better familiarize you with polymorphism and the factory design pattern, two key components in Assignment

  Create a program for a company named retail-mart

Prompt the user to enter an item name (one word only), a quantity and a price. For this step, in addition to functionality, I'll be looking at: location of the variable declarations; appropriateness of data types selected; appropriateness of the va..

  Describe the probability of the moves

Write a program in C++ to describe the Probability of the moves

  Calculation of mortgage interest rates

Instruction of pointers and the calculation of mortgage interest rates.

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