Go backward to Distributed Environment Go up to Top Go forward to Result |
Write a server that schedules some resource among C clients such that no more than R clients operate on it at the same time.
void Client(Channel server, Channel client)
{
while (true)
{
...
send(server, REQUEST);
grant = receive(client);
...
send(server, RELEASE);
}
}
Channel[C] server, client;
parallel
{
Server(server, client);
parallel(int i=0; i < C; i++)
Client(server, client);
}
Implement Server
such that it meets the specification.