Você está na página 1de 3

CSE 5306 Lab # 2 Spring 2007

Simulating Bully Algorithm using Named Pipes


Objectives
1. Simulating Bully Algorithm
2. Inter-process programming using Named Pipes on Windows platform

Due: March 29, 2007, 11:59 P.M. Difficulty: Easy

Project Specification

1. You are to simulate the Bully election algorithm using named pipes. More specifically,
your program needs to simulate the following scenarios:
a. Initially, all processes start up and communication between each pair of
processes in a normal way. Processes are numbered as in the textbook. Each
process should hear from the current coordinator at some predetermined interval,
say one second.

b. When a process does not hear from the current coordinator in some time interval
it will initiate an election process. This will obviously happen as processes are
brought up initially. During this process you need to show:
i. Current coordinator will be manually shut down.
ii. Elections will be initiated by processes that do not receive messages from
coordinator (more than one process will probably initiate elections once
the coordinator goes down).
iii. Elections initiated by processes with lower numbers will be stopped by
processes with higher numbers.
iv. Eventually the process with the highest number wins an election.
v. The winning process will notify all the other running processes that it is
the coordinator.

c. The crashed process comes back up and initiates an election. If it has the
highest number, it wins the election.

2. You need to show the communication between processes except on processes that
have been shut down. Messages received at processes should be displayed with a
receiving time stamps, the process number at which the message originated, and the
type of the message (ELECTION, OK, COORDINATOR, etc.).

3. You should be able to shut down and bring up a process at any time.

Other Specification

1. This is an individual project.


2. Your program should simulate the network as in Figure 6-20 of textbook.
3. Your program will be tested on Windows XP.
4. You may write the program in C, C++, VB, or C# using Visual Studio 6.0 or up. You
can also use Windows platform SDK, as long as you provide instructions how to
compile, link and run it. Any exceptions must be improved in advance.
5. Either a console or GUI program is acceptable.

page 1 of 3
CSE 5306 Lab # 2 Spring 2007
Simulating Bully Algorithm using Named Pipes
Reference

1. MSDN http://msdn2.microsoft.com/en-us/library/aa365590.aspx

Writeup

Your write-up should include instructions on how to compile and run your program. Ideally it
should be complete enough that the TA can test your program without your being there. Your
writeup should include any known bugs and limitations in your programs. If you made any
assumptions you should document what you decided and why. This writeup should be in text
format and should be submitted along with your code.

Submission Guidelines

E-mail your program source code to our class TA, Mr. Roy, e-mail address:
nxr7157@omega.uta.edu. Make the subject of the e-mail “CSE5306: Lab 2”. You should zip
your source files and other necessary items like project definitions, classes, special controls,
DLLs, etc. and your writeup into a single file and email it. The name of this file should be your
campus login_ID.zip. Be sure that you include everything necessary to unzip this file on another
machine and compile and run it. This might include forms, modules, classes, config. files, etc.
DO NOT INCLUDE ANY RUNNABLE EXECUTABLE (binary) program. The email servers have
limited storage space & we will be recompiling your programs anyway.

Make sure your name and your student ID are listed in your write-up, and in comments in your
source code. You may resubmit the project at any time. Late submissions will be accepted at a
penalty of 10 points per day. This penalty will apply regardless of whether you have other
excuses. In other words, it may pay you to submit this project early. If the TA can not run your
program based on the information in your write-up then he will email you to schedule a demo.
The TA may optionally decide to require all students to demonstrate their labs. In that case we
will announce it to the class.

If your program is not working by the deadline, send it anyway and review it with the TA for
partial credit. Do not take a zero or excessive late penalties just because it isn't working yet. We
will make an effort to grade you on the work you have done.

Grading

10 – using Named Pipes for inter-process communication


15 – all processes start up correctly
10 – shut down/bring up a process at run time
10 – elections initiated when the coordinator goes down or when system first starts
15 – elections initiated by lower-numbered processes stopped by higher-numbered processes
15 – highest-numbered process wins the election
15 – correct messages communicated and shown on each process
10 – required documentation including comments - see lab for information on comments

page 2 of 3
CSE 5306 Lab # 2 Spring 2007
Simulating Bully Algorithm using Named Pipes
Extra Credit

05 – use a GUI interface on each process


05 – place settings for each process (such as the window screen position, timeout length,
polling interval, etc.) in a .ini file. (http://www.developer.com/net/asp/article.php/3287991). To
claim credit for this function you must document in a separate section of your writeup what you
have included in the .ini files so the TA will know what to check for.

Deductions for failing to follow directions:

-2 Including absolute/ binary/ executable module in submission


-2 Submitting writeup in other than plain ASCII text format
-2 Submitted file has a name other than as described in the Submission Guidelines

Important Note:

You may discuss the problem definition and tools with other students. You may discuss
the lab requirements. You may discuss or share project designs. All coding work must be
your own. You may use any book, WWW reference or other people’s programs (but not
those of other students in the class) as a reference as long as you cite that reference in
the comments. If you use parts of other programs or code from web sites or books YOU
MUST CITE THOSE REFERENCES. If we detect that portions of your program match
portions of any other student’s program it will be presumed that you have collaborated
unless you both cite some other source for the code. You must not violate UTA, state of
Texas or US laws or professional ethics. Any violations, however small, will not be
tolerated. Students who do not submit anything get a grade of 0. Therefore students who
break the rules may receive a negative grade – most likely a -50 on this lab assignment.

page 3 of 3

Você também pode gostar