Implement a Small-Scale Distributed System

Assignment Help Other Subject
Reference no: EM133185049

DDE602 Distributed Development - Torrens University Australia

Assessment - Implement a Small-Scale Distributed System

Learning Outcome 1: Prioritise and distinguish the core elements of distributed system technologies and trends in the industry.

Learning Outcome 2: Work independently with a distributed system-based problem and demonstrate knowledge of the core concepts of distributed development.

Learning Outcome 3: Reflect on research findings and demonstrate ability in developing large-scale distributed applications.

Learning Outcome 4: Critically evaluate distributed system development considering realistic planning.

Task Summary
In this assessment, you will implement a small-scale distributed system and accomplish the following:

• Demonstrate an understanding of multi-threading concepts and constructs;
• Practise synchronising multi-threaded applications;
• Gain an understanding of the advantages and disadvantages of multi-threaded applications;
• Gain knowledge of the client-server distributed model and application protocols; and
• Gain experience in writing multi-threaded servers.

Context
Multi-threaded applications promise better performance and concurrency. Notably, all of us use such applications in our everyday life. For example, a web browser can download multiple files while you continue browsing. If a particular web page does not respond, this will not prevent the web browser from downloading other files. You may be surprised to learn that many of the applications that you use are probably built around multi-threaded principles.

Your task is to write a multi-threaded (i.e., concurrent) client-server application that will perform the spell checking of text files using a standard operating system dictionary. You can use any programming language of your choice; however, Python is recommended for this project. The code must be well formatted and conform to Python naming conventions. You also need to provide sufficient comments in the code

After the file has been processed by the server, the client should display all misspelt words and any near words as suggested replacements. An example of such output can be seen below.

Line No. Misspelt word Suggestion
7 enogh enough
12 nothng nothing
230 happenned happened
234 glob globe
563 poeple people
1034 lathgter laughter
1455 kowing knowing
1788 wuold would
1951 quate quite
2145 javascript no suggestion
2344 winkle wrinkle

Total processing time = 3.723 seconds

File processing should be undertaken by the server on a line-by-line basis. Each time a line of text is read, it should be pre-processed by converting all uppercase letters to lowercase letters and removing leading or tailing punctuation characters. A word is to be defined as a sequence of alphabetic characters as well as the characters of an ' ' ' (apostrophe) and a '-'(hyphen). Thus, words like ‘co- operate' and ‘it's' will be processed as whole words. The total processing time encompasses the time from the commencement of the program (or client) until its termination. To search for words in the dictionary, just use a linear search.

To determine if two words are the same (or different) use the int WordCmp(char*,char*) function below. It will return 0 if the words are the same or a number > 0 if the words are different. (Note: The greater the return value, the greater the difference between the words). To obtain a suggestion word for a misspelt word, use the word with the minimum difference. (Note: If there is more than one word with the minimum difference for a misspelt word, then use the one found first as the suggestion word).

int WordCmp(char*Word1,char*Word2){

if(!strcmp(Word1,Word2))return 0;

if(Word1[0]!=Word2[0]))return 100;

float AveWordLen = (strlen(Word1) + strlen(Word2)) / 2.0;

return int(NumUniqueChars(Word1,Word2) / AveWordLen * 100);

}

where the NumUniqueChars() is the number of chars in Word1 that are not in Word2 plus the number of chars in Word2 that are not in Word1.

A sample text file (Sample_File_For_Assessment_4.txt - available for download from the Assessment 4 section in Blackboard) with spelling mistakes is provided for you to test your system. However, you do not have to use the sample file. Further, you are encouraged to test your code on multiple files that you have saved to your computer.

Task Instructions

You should complete this assignment by performing the following steps:

Step 1: Implement an iterative single-threaded process program without sockets. (See the algorithm below).

Step 2: Convert the program in Step 1 into a client-server application using TCP sockets. A multi- threaded server is appropriate.

Step 3: Convert the server program in Step 2 into a program capable of processing lines of input file data in parallel from an input queue and recording all misspelt words, their suggestion words and line numbers in a global linked list. When processing is complete, the contents of the linked list are sent to the client to display to the user.

Step 4: Implement mutexes and conditions in the server program in Step 3 to provide mutual exclusion to the shared global data to prevent the threaded processes updating it simultaneously.

Step 5: Add descriptive comments in your code that should not only explain the code but will also share your research findings demonstrating your ability to develop large-scale distributed applications. Through the comments exhibit your critical thinking for each of the criteria in the rubric.

Sample Algorithms SINGLE THREADED
open input file while !eof
read line from file preprocess line

for each word in line
open dictionary
for each word in dictionary compare words
if same found=true; break;
if word difference is minimum
keep dictionary word as a suggestion word

end for close input file

close dictionary if !found
print line no. word and suggestion on screen

print processing time

CLIENT
• get filename and number of slaves etc. from command line
• gethostbyname (to obtain IP_Address of the Server)
• contact Server (using connect + IP_Address from above)
• send filename and number of threads to server & wait for misspelt words to return
• take miss-spelt words from Server and print them
• close socket

SERVER
• setup socket
• server socket object initialisation
• accept client connection (2)
• read filename and number of threaded slaves
• open file
• create threaded slaves
• keep filling input buffer with preprocessed lines of text. (See Producer below)
• wait for threads to complete
• send miss-spelt words to client
• close socket & file, goto 2

PRODUCER
while(1)
read line from file if no data left
set data_finished & break; if queue full
pthread_cond_wait else
put item in input queue
. . .

CONSUMER THREAD
while(1)
if data_finished
break;
if input queue empty
pthread_cond_wait else
take item from queue process item
. . .

Referencing
It is essential that you use APA style to cite and reference your research.

Attachment:- Distributed Development.rar

Reference no: EM133185049

Questions Cloud

How much would you pay for the stock : At the end of the sixth year it will pay a dividend of $35 and cease operations. How much would you pay for the stock if you require a 10% rate of return
How goals-constraints-incentives and market rivalry : Describe how goals, constraints, incentives, and market rivalry affect economic decisions.
What is the intrinsic value of the put option for ares : Question - Use the following information for Ares stock: What is the intrinsic value of the put option for Ares
Calculate the net present value of both projects : SBM Companyuses a discount rate of 9% to evaluate both projects. Calculate the net present value (NPV) of both projects
Implement a Small-Scale Distributed System : Implement a Small-Scale Distributed System - Work independently with a distributed system-based problem and demonstrate knowledge of the core concepts
Working in the Office of Future : Watch the following video, Working in the Office of the Future. Choose at least two trends to discuss. Propose solutions to those dilemmas.
What total amount should be reported as shareholders equity : S agreed to personally take certain furniture having a P3,600 book value. What total amount should be reported as shareholders equity
How much of ryne wages are taxable for federal withholding : He has $100 deducted from his check for medial insurance premiums, $200 for his 401K, How much of Ryne wages are taxable for Federal Withholding
What will be your annual income : You invest in 200 shares of Lerner windows stock and receive a semiannual dividend of $0.78 a share. At that rate, what will be your Annual income

Reviews

Write a Review

Other Subject Questions & Answers

  What is the situation in developing countries in africa

What is the situation in developing countries in Africa like Nigeria? How strict are people in applying (any of) the ways?

  Complete risk stratification

You will then need to take that information and prescribe an appropriate exercise program using the testing results to set intensity and loads that will achieve the determined goals.

  In which ways organizations and customers have been affected

Describe how globalization has changed the way American companies are doing business. In what ways do you believe this change has benefited American.

  Scanlon foundations - mapping social cohesion

These findings remind us that racism occurs in everyday places, to everyday people. Casual racism appears to be the new face of prejudice and discrimination.

  Why the presenter was able to make such a strong connection

Think about a situation in which a presenter had a significant impact on you. Describe the situation and analyze why the presenter was able to make such.

  Discuss about the apprehension and nervousness

Child abuse reporting can take its toll on the therapist, particularly if the family or client involved is volatile. Discuss how one's own apprehension.

  Discuss type of direct reading instrument that you would use

Discuss the type of direct reading instrument that you would need to use as part of an OSHA compliant confined space atmospheric testing program.

  Determining probable cause to arrest

Why is time a more important factor in determining probable cause to search than it is in determining probable cause to arrest? Name three kinds of property that are likely to remain in a particular place for longer than a week

  Assignment - Integration Problem

Assignment - Integration Problem. Prove by using complex analysis

  A serious critical assessment of the gilgamesh story must

a serious critical assessment of the gilgamesh story must include consideration of both the offensive gilgamesh

  Who is the current serving president of equatorial guinea

Who is the current serving president of Equatorial Guinea.

  Neurotransmitters and brain diseases

Describe the importance of biology for understanding the behavior.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd