IPC Programme Need Help !
The “Dating Game” is an IPC problem which illustrates the sorts of problems that processes
might face if they must try to blindly locate one another. The model uses two sets of processes: males
and females, and the objective is to arrange couples of one male and one female each.
It is guaranteed that:
• each process knows their own sex;
• each process knows their own process ID;
• each process cannot tell the sex of a process simply by examining its process ID; and
• there may be an arbitrary number of males and females in the system at any given moment.
A process has found a mate if they know (by say, storing it in their memory space) the process ID of
a process of the opposite sex, but also if the same condition holds for the opposing process as well.
In other words, m is the mate of f when f knows m and m knows f. At this point, they can start
chatting, sending love letters, buying each other gifts and doing all the things that couples tend to do.
All of this cannot come about without the special intervention of the dating server. The purpose of the
dating server is to find mates for the many fish in the sea. The dating server [process] is well known
by all of the processes in the system, and so consider its process ID to be a universal system constant.
Your primary job in this question will be to solve the dating game using the family of message-passing
IPC primitives: nonblocking send and blocking receive.
(a) Using the messaging system calls, you will simulate the interaction described above.
• msgget(...) which either: creates a message queue in the case of the dating server; or
identifies a queue, in the case of a male process or a female process.
• msgrcv(...), which will be used as a blocking call for this implementation. All messages will
have a nonzero message type: the unique number associated with each receiver. Messages to
be sent to the dating server will be of type 1; messages to be sent to a process with process
ID n will be of type n.
• msgsnd(...), which will be used as a nonblocking call for this implementation. All messages
sent will have a nonzero message type.
• msgctl(...), which will be used to dismantle the queue.
Your job will be to write the programs for dserver.c, male.c, and female.c, using the message-
passing primitives described above. Mated couples should pass some messages back and forth
Messages are sent to and received from a single queue whose key is the last 5 digits of your student
number. Be sure to update global.h before you begin!
The program dispatcher.c will create males and females at some arbitrary times. You may
modify dispatcher.c, within reason. When testing your code, we will replace dispatcher.c with
our own custom-built version that creates males and females according to our favorite distribution.
In all other aspects, dispatcher.c will be the same as the sample.
(b) [10 marks] Draw a process diagram that illustrates the interaction between the dating server, male
processes, female processes, and the dispatcher. Show any process creation, send or receive.
(c) [5 marks] An analog to the dating server exists in most systems. It is called a nameserver. Explain
what might happen in a client-server system in which there was no nameserver.
(d) [15 marks] It is possible to solve the dating game problem without messages and a dating server.
Instead, we used a shared memory space, some semaphores and two global variables. Write some
pseudocode for functions male() and female() that accomplishes this.
I have to answer all these a,b,c,d answers can you tell how can I develop sucha IPC application.
Some hints: If anybody has come across such IPC development can you give me some hints to develop an IPC program in VC++ in C language !
Any help would be appreciated
Re: IPC Programme Need Help !
Why do you have to develop this application? Are you on a course? If so then you should know how to get started.
The assignment gives you some hints already. What help do you want?
|All times are GMT +5.5. The time now is 20:57.|