Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

There should be 1 server thread and N client threads, where N is supplied by the user as a command line argument. The server opens a file called "all_requests.dat", the file has the following format:



...
...

client id - refers to the id of the client thread which is between 0 and N - 1. Note this is not the thread id that is assigned by the system.

read/write - refers to whether the request is a read or write request.

page id - refers to id of the page being requested.

contents of page - this field only exists if the request is a write request. It contains the contents of a page that is to be written into the server which is a sequence of alphabet characters (a-z, A-Z) with no spaces or anything else in between and has a maximum size of 4096 characters (size of page for most machines).

Here is a sample "all_requests.dat" file. In this example there are 2 clients with ids of 0 and 1 respectively. Note the read requests do not have any associated page contents.

All_requests.dat file:
0 read 20
1 write 20 helloKKAAA
0 read 1
1 read 21
0 read 20
0 write 8 peter

The server thread also reads from the file called "init_buffer_pages.dat" which contains the initial contents of ALL the buffer pages (you can be sure read and write requests are to pages existing in this file). It has the following format:



.....
.....
.....

Here is a sample init_buffer_pages.dat file:

1 abcdefghigkhhLLK
2 ABjjjjjsskskskskksk
20 hellohowareyou
21 HHBGHH
8 JHjhjjsjjkwje

The program should do the following:

1) The server thread starts and reads in the init_buffer_pages.dat file to initialise the memory buffer.

2) Create N client threads, where the number N is taken from the command line.

3) The server thread reads from all_requests.dat file to get the page read or write requests. The server must process these requests in order from the 1st to the last. For example the 2nd request on the list must be processed before the 3rd request.

4) Each client thread should keep a log of the pages that it has read inside a file called "client_log_n" where n is its thread id. The pages read must be written into the log file in the order that they are received from the server. Please note you only need to log read requests. In the case of a write request the server does not need to contact any of the clients. This will let us know if server is processing the requests in the correct order. The beginning of each entry should contain the page id followed by the page contents. Here is the format:



.....
.....
Here is an example (note in the example below the page 20 has changed between the first and last reads):

20 hellohowareyou
1 abcdefghigkhhLLK
20 helloKKAAA

5) Please note that the server must wait for the current client thread to have finished writing its log entry before getting the next thread to log its read request.

6) When all the clients finish their requests the server thread must end and cause the entire process to end.

Please note we will be testing your program based on if client log files contain the correct data.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9529247

Have any Question?


Related Questions in Computer Engineering

On the swamp county railroad system there are 6 types of

On the Swamp County Railroad system there are 6 types of train P1 P2 F1 F2 F3 F4 They occur with the following probabilities P1 0.10 P2 0.10 F1 0.20 F2 0.30 F3 0.15 F4 0.15 A trackside device transmits the type of train ...

What is 4g and its benefits how fast is your internet

What is 4G and its benefits. How fast is your Internet service supposed to be for stationary users?

Anbspthe reaction of an aqueous monoprotic strong acid such

a: The reaction of an aqueous monoprotic strong acid (such as HBr (aq)) with an aqueous alkali strong base (such as LiOH (aq)) always has the same heat of reaction regardless of which strong acids and strong base were us ...

Question suppose that the head of a disk with 256 tracks

Question : Suppose that the head of a disk with 256 tracks, numbered 0 to 255, is currently serving a request at track 58. The previously served request was at a lower-numbered track (i.e., the head is currently moving f ...

How do you make a java program that reads two diagonal

How do you make a Java program that reads two diagonal points, say p1 and p2, of an up-right rectangle and finds both the smallest circle containing the rectangle and the largest circle that can be contained in the recta ...

A study was conducted of pleas made by 1032 criminals among

A study was conducted of pleas made by 1,032 criminals. Among those criminals, 954 pled guilty, and 394 of them were sentenced to prison. Among the 78 of the other criminals, who pled not quilty, 58 were sentenced to pri ...

Objectiveto apply object-oriented methodology for analysis

Objective To apply object-oriented methodology for analysis of information systems development in a case study. Case Study -Chemist ServiceGroup Chemist Service group is a chainof chemiststores. It employs more than8,000 ...

Give an example of a binary relation which is not

Give an example of a binary relation which is not transitive, and then give an example of a binary relation which is reflexive and transitive but not connected.

Dog up franks is looking at a new sausage system with an

Dog Up! Franks is looking at a new sausage system with an initial cost of $440,000 that will last for five years. The fixed asset will qualify for 100 percent bonus depreciation in the first year, at the end of which the ...

A diprotic acid solution h2a has a molarity of 065 mthe

A diprotic acid solution H 2 A has a molarity of 0.65 M.The concentrations of the species present at equilibrium are asfollows: [H + ]=0.25 M [HA - ]=0.25 [A 2- ]=4.6 x 10 -4  M The second ionization constant (K a2 ) for ...

  • 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