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

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

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