--%>

A program to handle Hotel Reservations in UNIX

Operating Systems

In this assignment, you will implement a program to handle hotel reservations requested by customers at different locations connected to the \Fall-OS" hotel's database.

Suppose each customer is represented by a process and the body of the process consists of all the reservations made by that customer. A customer can make reservations, payments cancellation of reservations/payments. Two or more customers may be doing the same transactions at around the same time. Obviously, reservations/payments to the same room/time period must be performed atomically (mutual exclusively). If a customer tries to reserve a room that has already been taken, then disallow this action and print a "room taken" message. If a transaction tries to operate a non-existent room, print an error message. A customer can reserve a contiguous or non-contiguous block of two or more rooms at the same time.

To ensure these concurrent operations yield correct results, you are to use Unix semaphores to control access to rooms/stay periods, which are stored in shared variables.

To simulate (1) the transmission delay between the hotel's central computer and a customer's computer, and (2) the processing of each transaction, the rest four lines in the body of each customer specify the required total execution time (in milliseconds) for each of the three operations performed at that customer. In your implementation, each specialized time is the length of the critical section for the corresponding transaction.

Valid transactions are:

reserve (room_number) begin_date number_of_days name_of_customer

cancel (room_number) begin_date number_of_days name_of_customer

reserve (room_number1,...,room_numberK) begin_date number_of_days name_of_customer

/* non-contiguous block */

cancel (room_number1,...,room_numberK) begin_date number_of_days name_of_customer

reserve (room_number1-room_numberM) begin_date number_of_days name_of_customer

/* contiguous block */

cancel (room_number1-room_numberM) begin_date number_of_days name_of_customer

check customer_name /* show rooms and stay periods reserved */

Example{reserving a non-contiguous block of rooms:

reserve (2,5,58) ...

Example{reserving a contiguous block of rooms:

reserve (8-15) ...

You can cancel a room reservation only after you have reserved it. The input is as follows:

n /* number of rooms, numbered from 1 to n */

m /* number of customers */

customer_1:

reserve reserve_time (in milliseconds)

cancel cancel_time (in milliseconds)

check check_time (in milliseconds)

:

valid operations

:

end.

:

:

customer_m:

reserve reserve_time (in milliseconds)

cancel cancel_time (in milliseconds)

check check_time (in milliseconds)

:

valid operations

:

end.

The output after completing all transactions is: a report showing the transactions and resulting

room assignments with customer names.

2

   Related Questions in Science

  • Q : Define Filter-Based Methods

    Filter-Based Methods: After the universal environments are generated, they are combined with the code of the unit and then a model checker such as JPF can be used to verify unit properties (e.g., that there are no runtime exceptions). In many cases, b

  • Q : Operating systems Alice, an engineer at

    Alice, an engineer at MackCorp has asked your advice on how she should access her address book in a file. Please recommend the optimal strategy for Alice. Defend your choice.

  • Q : Motherboard Components Normal 0 false

    Normal 0 false false

  • Q : Stack in 8085 Normal 0 false false

    Normal 0 false false

  • Q : Kotters Step Change Model What are the

    What are the Kotter’s Step Change Model? Explain Briefly.

  • Q : Define Model Extraction Model

    Model Extraction: Several program model checkers are based on automated model extraction, where program is translated into an input notation of an existing model checker (Corbett 1998; Havelund and Pressburger 2000; Corbett et al. 2000; Ball et al. 20

  • Q : Black Coalition for AIDS Prevention

    Hi, I send this Assessment( case study), please read it carefully and do it as the ATTACHEMENT FILE POINTS. According to university roles it must be provide citation for each paragraph, so have make sure and you have to write the citation for each paragraph as Chicago (16th Edition) referencing st

  • Q : Difference between PLC and CNC

    Difference between PLC and CNC:CNC (abbreviated as Computer Numerical Control) is a specific application generally used to control a multi axis machine tool like a milling machine or a lathe however as well could be a tube bending machine punch

  • Q : What is Domino theory Domino theory:

    Domino theory: The reason for war during 1950s to 1980s started by US, that kept a look on states coming under the influence of communism. In any case some country came under communism influence then all other countries surrounding it would follow the

  • Q : Command to start installation without

    Normal 0 false false