Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Make a client-server type of C program using system commands fork() and pipe() that simulates the operation of an electronic ticketing system for a train
Make a client-server type of C program using system commands fork() and pipe() that simulates the operation of an electronic ticketing system for a train company.
The (server) will maintain a list of available trains for which there will be a limited number of available seats. For each available train the information to be retained will relate to a unique code for each train (a serial number), the city of departure, the destination city, the number of available seats as well as the cost of the train ticket.
Clients will submit a request to book one or more tickets for one or more trains, and if seats are available for applicants trains, then the system will inform the customer of the successful booking as well as the total cost and will reserve a seat on the requested trains. In different case it will inform the customer about the unsuccessful completion of the reservation. The system will have a specific booking time (at least 0.5 seconds). At this time, it will not accept any more requests until it has finished service.
Once all ticket booking requests have been processed, the booking system will issue a summary report describing for each train trip the following information: 1) Trip (from, to) 2) Number of reservation requests 3) Number of requests for which the reservation was successful 4) Number of requests for which the reservation was unsuccessful
At the end of the report a summary message will be printed which will contain: 1) The total number of requests for booking tickets 2) The total number of successful bookings 3) The total profits of the train company
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started