pseudo-code or algorithm

There are two processes that could take place even at the same time. One process helps in getting amount from the ATM and the second helps in depositing the money in the bank account through a cheque. You ensure mutual exclusiveness by using semaphore with wait and signal operations.
Write pseudo-code or algorithm for these two processes.

Answer that i porpose is:
Solution:

do

{

…………….

Deposit money in nextp

…………..

Wait (getting);

Wait(mutex);

………….

Deposit nextp to ATM

………

Signal(mutex);

Signal(deposit);

}

While(1);

Code for getting money process

do

{

Wait (deposit);

Wait(mutex);

………….

get money from ATM to nextc

………

Signal(mutex);

Signal(getting);

Get the money in nextc

………….

}

While(1);

(please tell me)
Topic archived. No new replies allowed.