please help?

can anyone help me with my project please having trouble getting familiar with the UNIX commands together with IPC and c programming..

the following is my assignment problem , all im asking is for someone to give me some good ideas on how to start the program not write the whole program for me, thats my job..
Basically i want to get familiar with this topic

any ideas??????

kind regards,

Due date: Friday, 31st May, 2002. (6:00 p.m.)

A particular distributed service is envisaged for implementation by means of a program which will run on each of the hosts on which the service is to be available.

This program is divided conceptually into the application and the protocol entity (PE). The task of the PE is to provide a simple locking service invoked by the application side.

Your task is to develop sufficient of the PE logic to provide for consistent operation of the lock according to the protocol rules given below. There are other issues, such as failure detection and recovery, which you aren't required to address.

The locking mechanism is based on token passing, i.e. all participating PE's form a logical ring, sending/receiving messages to/from just one other PE in such a way that a message from any one PE can reach any other PE; being forwarded as necessary by any intervening PE's. A distinguished message represents the token, and the PE at present holding the token, and only that PE, can grant the lock to its application.

To prevent the token from "buzzing" and thereby consuming communications capacity, it will be held at some PE if there are no outstanding lock requests. A PE requested for the lock may send a demand message around the ring to notify the token holding PE that the token is required.

The PE's observe the following rules:

on lock request: if holding token unset holding token; grant lock

on unlock: unset demand flag; forward token

on lock needed: circulate demand if demand flag is unset

on receiving demand message: set demand flag; forward token if holding token

on receiving token: if waiting for lock then grant lock;
if demand flag set then unset demand flag; forward token {else hold token}

demand flag, holding token, etc. are boolean local variables for each participating PE.


It is not necessary to develop the solution on a network: a single host will be all that's required. Any testing which involves more than a single PE should use additional processes on the one host.

You may make assumptions to complete the above set of protocol rules if you deem it necessary.

You are advised to structure your solution logic as an event loop, i.e. using the

case wait-event ( ... ) of

structure dealt with in lectures.

You are required to produce a complete program, but note that the above specification is silent on the application side of the program, so you therefore need to supply only sufficient logic to exercise the PE side. However the application side must have an independent thread of execution capable of interacting with its environment asynchronously with the PE. In other words, the application side and the PE must run as separate processes.

Black box testing will be insufficent for this exercise, so you will need to include trace statements in your development code to verify that the PE responds correctly to events.

The PE is make function calls to send/receive messages to/from the ring; these functions must necessarily be stubs in your implementation. You may consider using message queues within these stubs to simulate interaction with the ring.

You are to assume that the message passing on the ring is asynchronous.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!