Implement a memory management system , Computer Engineering

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.

Posted Date: 3/16/2013 3:35:55 AM | Location : United States







Related Discussions:- Implement a memory management system , Assignment Help, Ask Question on Implement a memory management system , Get Answer, Expert's Help, Implement a memory management system Discussions

Write discussion on Implement a memory management system
Your posts are moderated
Related Questions
is a technique of improving the priority of process waiting in Queue for CPU allocation? Ageing is a technique of enhancing the priority of process waiting in Queue for CPU all

Write a pseudocode for a program that reads a temperature as a whole number from a user and outputs a "probable" season (winter, sprint, summer, or fall) depending on the temperatu

A breakthrough in the AI intelligence the development of natural interfaces is a prerequisite to the optimal use of computers by human beings. It incorporates: a. Natural La

The following branch prediction algorithms are suggested: 1) Guess that the branch will be taken if the previous one was taken; predict not taken otherwise. 2) Guess that the

Q. Explain Assembly program execution? An assembly program is written according to a strict set of rules. A word processor or editor is used for keying an assembly program in t

Your task is to implement a memory manager that manages page reads and writes from multiple client threads. In the first programming task the memory manager keeps all the pages in

Name the two operations of stack A stack has only two operations and they are insertion and deletion of items. The operation insertion is called push (or push-down) as it can b

Packet switching is used for (A)  Credit card verification (B)  Automated Teller Machine (C)  The internet and the World Wide Web (D)  All of the above  Ans

Problem: a) Most RMI and RPC systems expect to be supported by the "Request-Reply Protocol". Describe what "Request-Reply Protocol" is. b) Describe the invocation semantics

INTEL ARCHITECTURE - 64 ( IA-64) IA-64 (Intel Architecture-64) is a 64-bit processor architecture developed in cooperation by Intel and Hewlett-Packard, executed by processors s