Server thread, Operating System

Assignment Help:

Extend task 1 so that the requests are issued by the clients instead of the server. The server now do not use the "all_requests.dat" file. Instead every client thread reads from a different input file called "client_requests_n.dat", where n is the thread id. Note this is not the thread id that is assigned by the system. Note thread id goes from 0 to N-1.
The client request files have the following format:


Apart from request no. field the other fields have the same meaning as in the "all_requests.dat" file in task 1.

Note request no. is a number starting from 1 2 3 ... to the total number of requests. You can assume that when you combine all the client request files that all request number starting from 1 to the total number of requests exists. Your job is to process all the requests in ascending request number order. Also note the request numbers within each client request file are always sorted in ascending order.
Here is a sample pair of client request files. In this example there are 2 clients.

client_requests_0.dat file:
1 read 20
4 write 21 hellohowareyou
5 read 21

client_requests_1.dat file:
2 read 21
3 write 20 petermaryjohn


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) Each thread reads from its own client_request_n.dat file to get the page read or write requests. The requests are sent to the server in the order that they appear in the file. The server must process these requests in ascending request number order.

4) The requests are blocking requests, that is if a request from client x is to read a page client x should not send the next request until the server has provided the requested page to the client x. Similarly for a write request the client x should not issue the next request until it has received confirmation from the server that its write has completed. Requests from different clients can be issued concurrently.

5) 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.

6)

a) The server must process the requests in ascending order according to request number specified in the client_requests_n.dat files. For example request number 2 must be processed before request number 3, although request number 3 arrived at the server before request number 2. This can happen since the thread issuing request number 3 may have executed before the thread issuing request number 2.

a) The server is NOT allowed to open the client_requests_n.dat file or the all_requests.dat file. The server must get the request number and all other request information from the client when the client sends its read or write request.

b) The clients are NOT allowed to send all their requests at once at the beginning. The client can only send a new request after its previous request has been processed. See point 4 for more details.

c) Not following the above rules will result in very significant reductions in your mark (you may loose up to 100% of the marks for task


Related Discussions:- Server thread

Explain concept of buffering, Buffering Messages exchanged by communica...

Buffering Messages exchanged by communication processes reside in a impermanent queue. Such a queue can be executed in three ways. Zero capacity: The queue length is 0.

Write a note on threads, Question 1 Explain (a) tightly coupled systems   ...

Question 1 Explain (a) tightly coupled systems                               (b) Loosely coupled system Question 2 Describe the RPC model Question 3 Write a note o

Cache replacement policies, The physical memory acts as a cache backed by t...

The physical memory acts as a cache backed by the disk. When the physical memory is full, and we want to read in another page from disk, we have to evict a page from physical memor

Explain process state with diagram, Question 1 Explain single Partition Al...

Question 1 Explain single Partition Allocation and Multiple Partition Question 2 What is PCB? What useful information is available in PCB? Question 3 Explain Preemptive and No

Operating system structure, Problem: (a) Modern operating systems are i...

Problem: (a) Modern operating systems are interrupt driven. If there are no processes to execute, no I/O devices to service, and no users to whom to respond, an operating syste

What is file allocation?, What is File Allocation? The structure that ...

What is File Allocation? The structure that offers the FAT file system its name is the file allocation table . In order to know what this important table does, you should fir

How program execute in operating system, Q. How Program execute in operatin...

Q. How Program execute in operating system? Program execution: Operating system loads a program in memory and executes the program. The program should be able to end its exec

Determine a processing that is not a part of synthesis phase, Determine a p...

Determine a processing that is not a part of Synthesis phase  Perform LC processing is not a part of Synthesis phase

Transportation, what are the factors influencing the choice of a mode of tr...

what are the factors influencing the choice of a mode of transportation?

Packets and time division multiplexing (tdm), Broken data into small packet...

Broken data into small packets allow time division multiplexing. In TDM every packet leaves the sender and is switched on the shared interaction channel through a multiplexer. At t

Write Your Message!

Captcha
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