Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Network & Security Expert

Lab will require you to create a client and a server that communicate over either message queues, sockets, or a well known fifo. The data passed will be a simple request/response in string format. Each of the 3 methods will need to answer the problem of rendezvous in their own way. Suggested algorithms:

Message Queues

Server will listen specifically to a single key and respond to clients based on a key that was passed in the message to the server.

Well Known FIFOs -

Since Well Known FIFOs are "file" based and will require a name (hence the "well known" part), you should create a common header that defines the server read / client write FIFO as a const string for both. The server will respond to the client based on data passed through the Well Known FIFO to the server.

Sockets-

Every socket requires a tuple on both sides. Tuple being the IP address / Port / Protocol. Since sockets require "root" access for ports less than 1024, choose a port greater than 1024 for the server. Just like the well known fifo, you should create a common header file with a const integer for the server port number. Unlike the other IPC methods, the client and server in a socket dynamically exchange the path back to the client, so there is no need to "pass" that data to the server. Once you have chosen your method of communication, then define a simple dataset that can be used in a request / response loop. Examples could be that you have an array of phone numbers, and when the phone number is sent to the server it will respond with the person's name associated with that phone number. Any simple dataset with at least a name=value pair will work as long as you can look up the value based on the name. Simple structures with a simple searching algorithm up to using hash maps or search tree libraries are all ok. This assignment is more about the IPC and the semaphore than the dataset. So even something as simple as the process environment is fine (doesn't get any easier than that...) Your server will listen to incoming requests and then respond according to the client connection algorithm. You will also be required to add 3 server threads that will all block and wait to receive the client request based on a semaphore. Although the 3 methods of IPC all are based on queues, we will be adding a semaphore to only allow 1 thread to pull/pop a request from the queue, and once the request is taken by one of the 3 server threads, then it will release the semaphore allowing the other threads to take the next request from the queue. Here is an example of how the semaphore will work... You see 3 server threads T1, T2, and T3. Only one can be receiving from the Server FIFO Queue at a time, so the semaphore will lock out the other 2. When the T2 thread takes the request off the Server queue, it will immediately unlock the semaphore so the other threads can block for the next request on the queue. Right after the T2 thread unlocks the semaphore it will then process the request and send the response back to the client via the Client FIFO queue and then go back to request the semaphore and block until it gets the unlock from the semaphore and then blocks for the next request from the Server FIFO QUEUE.

Pseudo code for the server would be the following

threadListener() {
 loopForever {
 requestSemaphore(); //Block until you get the green light
 lockSemaphore();
 readFromQueue(); // Another blocking call (maybe no clients yet)
 unlockSemaphore();
 doWork();
 resondToClient();
 }
}

Keep in mind that it is important to lock critical regions more often and in the smallest block of code otherwise you would diminish the value of threading and concurrency. This lab will help you understand synchronization through message passing as well as a form of preballocation where the server already has 3 "worker" threads ready to accept client connections without the cost of creating a thread or fork/exec. You will also understand the use of blocking vs. nonbblocking I/O due to the way servers and clients need to manage their reads and writes in a way that will not create a deadlock. Please zip/tar your source code, script output file and design doc into a single file for submitting.

Computer Network & Security, Computer Science

  • Category:- Computer Network & Security
  • Reference No.:- M9525770

Have any Question?


Related Questions in Computer Network & Security

Data model development and implementationpurpose of the

Data model development and implementation Purpose of the assessment The purpose of this assignment is to develop data models and map Database System into a standard development environment to gain understanding of data m ...

After reading this weeks materials please respond to two 2

After reading this week's materials, please respond to TWO (2) of the following questions. AND PROVIDE CITATION IN APA 1. Describe the differences between bus, ring, star and mesh topologies. 2. Explain the TCP/IP Model ...

1 a firms marginal rate of technical substitution at m p lm

1) A firm's marginal rate of technical substitution at M P L/M P = 3, and the ratio of prices of labor and capital ,w/r, is 4. a) Is the firm minimizing its cost? Why or Why not? b) What can it do to improve its situatio ...

You need to prepare packet tracer fileattached pdf contains

You need to prepare packet tracer file attached pdf contains topology and required configurations and assigned ip address. In packet tacer file you need to include banner, router and switches. 1. VLSM Design a) As first ...

Assignment descriptionproject scope a typical network

Assignment Description Project Scope: A typical network layout diagram of a firm is given below for illustrative purposes only. The service requirements are enclosed. Figure. Network layout of a firm Service requirements ...

Advanced network design assessment - human factors in

Advanced Network Design Assessment - Human factors in network analysis and design Purpose of the assessment - This assignment is designed to assess students' knowledge and skills related to the following learning outcome ...

Case study network design for ezy-booksezy-books is a

Case Study: Network Design for EZY-Books EZY-Books is a specialised publisher for customised book publication services based in Brisbane. The company has recently purchased a two-story building in a Brisbane suburb as it ...

Topic is impacts of data breaches the report will divide in

Topic is "Impacts of data breaches". the report will divide in to 5 section which is : "" 1-Abstract: comprehensive overview of the report in 150 to 200 words. 2- Introduction: Describe the topic and its issue in 250 to ...

Advanced network design assessment - human factors in

Advanced Network Design Assessment - Human factors in network analysis and design Purpose of the assessment - This assignment is designed to assess students' knowledge and skills related to the following learning outcome ...

Suppose that serendipity bank has excess reserves of 12000

Suppose that Serendipity Bank has excess reserves of $12,000 and check able deposits of $150,000. If the reserve ratio is 20 percent, what is the size of the bank's actual reserves?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As