|
|
1.1 root 1:
2: Queue Example Description:
3: --------------------------
4: A cafeteria has a headwaiter. He creates a queue into which requests are
5: placed by the cafeteria's gatekeeper.
6:
7: The cafeteria has a number for each table meant for seating cutomers.
8: The gatekeeper receives customers in groups, assigns each group a table.
9: Corresponding to each table assignment, he places a request (indicating the
10: table at which the customer group is seated) on a queue.
11: When he decides that it is time for closing the cafeteria, he places
12: the last request on the queue indicating that there will be no more
13: customers.
14:
15: The headwaiter reads each request from the queue (for FIFO : according to
16: first come, first serve. For LIFO, last in gets first table, and for PRIOrity,
17: according to each customers priority) and dispatches a waiter to the table
18: where the customer group is seated. The headwaiter closes the queue as soon
19: as he reads a request that has the RequestID set to NOMORE (i.e, there will
20: be no more customers).
21:
22: The file serv.c emulates the headwaiter. The file cust.c emulates
23: the gatekeeper.
24:
25: Running this example:
26: The customer and server processes need to be running at the same
27: time. Hence, do the following:
28:
29:
30: o At prompt, type
31: fifoque <CR> for FIFO queues example
32: or lifoque <CR> for LIFO queues example
33: or prioque <CR> for PRIOrity queues example
34:
35: ------------------------------------------------------------------------------
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.