[SOLVED] python socket Part 2: Implementing a Multithreaded Getfile Server

$25

File Name: python_socket_Part_2:_Implementing_a_Multithreaded_Getfile_Server.zip
File Size: 612.3 KB

5/5 - (1 vote)

Part 2: Implementing a Multithreaded Getfile Server
Note: For both the client and the server, your code should follow a boss-worker thread pattern. This will be graded. Also keep in mind this is a multi-threading exercise. You
are NOT supposed to use fork() to spawn child processes, but instead you should be using the pthreads library to create/manage threads. You will have points removed if you dont follow this instruction.
In Part 1, the Getfile server can only handle a single request at a time. To overcome this limitation, you will make your Getfile server multi-threaded by implementing your own version of the handler in handler.c and updating gfserver_main.c as needed. The main, i.e. boss, thread will continue listening to the socket and accepting new connection requests. New connections will, however, be fully handled by worker threads. The pool of worker threads should be initialized to the number of threads specified as a command line argument. You may need to add additional initialization or worker functions in handler.c. Use extern keyword to make functions from handler.c available to gfserver_main.c. For instance, the main file will need a way to set the number of threads.
Similarly on the client side, the Getfile workload generator can only download a single file at a time. In general for clients, when server latencies are large, this is a major disadvantage. You will make your client multithreaded by modifying gfclient_download.c. This will also make testing your getfile server easier.
In the client, a pool of worker threads should be initialized based on number of client worker threads specified with a command line argument. Once the worker threads have been started, the boss should enqueue the specified number of requests (from the command line argument) to them. They should continue to run. Once the boss confirms all requests have been completed, it should terminate the worker threads and exit. We will be looking for your code to use a work queue (from steque.[ch]), at least one mutex (pthread_mutex_t), and at least one condition variable (pthread_cond_t) to coordinate these activities. Bonnie will confirm that your implementation meets these requirements. The folder mtgf includes both source and object files The object files gfclient.o and gfserver.o may be used in-place of your own implementations. Source code is not provided because these files implement the protocol for Part 1. Note: these are the binary files used by Bonnie. They are known not to work on Ubuntu versions other than 18.04. They are 64 bit binaries (only). If you are working on other platforms, you should be able to use your protocol implementation files from Part 1.
Makefile (do not modify) used for compiling the project components

content.[ch] (do not modify) a library that abstracts away the task of fetching content from disk.
content.txt (modify to help test) a data file for the content library
gfclient.o (do not modify) implementation of the gfclient interface.
gfclient.h (do not modify) header file for the gfclient library
gfclient-student.h (modify and submit) header file for students to modify submitted for client only
gfclient_download.c (modify and submit) the main file for the client workload generator. Illustrates use of gfclient library.
gfserver.o (do not modify) implementation of the gfserver interface.
gfserver.h (do not modify) header file for the gfserver library.
gfserver-student.h (modify and submit) header file for students to modify submitted for server only
gfserver_main.c (modify and submit) the main file for the Getfile server. Illustrates the use of the gfserver library.
gf-student.h (modify and submit) header file for students to modify submitted for both client and server
handler.c (modify and submit) contains an implementation of the handler callback that is registered with the gfserver library.
steque.[ch] (do not modify) a library you must use for implementing your boss/worker queue.
workload.[ch] (do not modify) a library used by workload generator
workload.txt (modify to help test) a data file indicating what paths should be requested and where the results should be stored.
Submission
Read the documentation carefully for the requirements. When you are ready to turn in your code, use the command
$ python submit.py gfclient_mt
to turn in your gfclient_download.c file and
$ python submit.py gfserver_mt
to turn in your handler.c and gfserver_main.c files.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] python socket Part 2: Implementing a Multithreaded Getfile Server
$25