1. Homepage
  2. Coding
  3. CS-350 - Fundamentals of Computing Systems Homework Assignment #4 - BUILD

CS-350 - Fundamentals of Computing Systems Homework Assignment #4 - BUILD

Get in Touch with Our Experts
BUCS350Fundamentals of Computing SystemsCpthreads

CS-350 - Fundamentals of Computing Systems Homework Assignment #4 - BUILD Assignment Writing Service

Due on October 10, 2024 — Late deadline: October 11, 2024 EoD at 11:59 pm Assignment Writing Service

Prof. Renato Mancuso Assignment Writing Service

CS-350 - Fundamentals of Computing Systems::Homework Assignment #4 - BUILD Problem 1 Assignment Writing Service

BUILD Problem 1 Assignment Writing Service

To improve throughput and utilize system resources more efficiently, you’ll now modify your server to process requests using multiple worker threads. The new server will still allow to specify a maximum queue size to limit its maximum workload. Assignment Writing Service

Output File: server_multi.c Assignment Writing Service

Overview. Once again by building on top of what you have implemented so far, it is now time to add more workers to the system. The idea is quite simple: instead of launching 1 worker thread, launch N worker threads that can run the same logic and can fetch requests from a single, shared queue. This way, if a thread, say T0, is busy processing a request and another request is pending, then T1 can start working on it. Design. The design is relatively simple. You will reuse what you learned about pthreads in hw1. This time, instead of creating only one worker thread, you will create N of them. All of the workers will execute the same worker_main function, but might be passed slightly different parameters. For instance, the first thread you create might be passed a thread ID of 0, the second one a thread ID of 1 and so on. Assignment Writing Service

The important bit is to pass to all of them the same pointer to the same shared queue. The process that is the parent of all the worker threads will still be the only one responsible for performing recv(...) operation on the connection socket. It will also be responsible for enqueuing (or rejecting!) new incoming requests, just like in hw3. Assignment Writing Service

Number of Threads. Just like in hw3, the number of worker threads to activate will be passed as a command line parameter to your code. The new parameter will be -w <workers> where <workers> is a positive integer greater than 1 representing the number of worker threads to spawn. Their ID will go from 0 to (<workers> - 1). Assignment Writing Service

Overall your server will be launched from command line with the following parameters:
./server -q <size> -w <workers> <port_number>, where <size> is a positive integer representing the maximum number of requests that can be held in the queue; and <port_number>, just like before, is the port on which the server should bind its socket.
Desired Behavior. Apart from spawning worker threads, processing, and rejecting requests, three pieces of information will need to be produced in output by your server.
Two of these pieces of information, i.e., the queue status dumps and rejection notice are identical in format to Part 1. The only difference is that the queue dump status is printed when
any of the worker threads completes processing of any of the requests.
Unlike Part 1 and the previous assignments, when a request successfully completes service, the thread ID of the worker thread that has completed the request will need to be added at the beginning of the line following the format below.
Assignment Writing Service

T<thread ID> R<request ID>:<sent time>,<req. length>,<receipt time>,<start time>,<completion time>

Here, <thread ID> is the ID of the worker thread that completed the given request. Once again, these IDs must go from 0 to <workers> - 1. If multiple worker threads are available to process a pending request, any one of them (but only at most one!) can begin processing the request.
Once again, queue status dumps and rejection notices should NOT be prefixed with a thread ID. Thus, their format is identical to what you had in
hw3. Assignment Writing Service

联系辅导老师!
私密保护
WeChat 微信
BU代写,CS350代写,Fundamentals of Computing Systems代写,C代写,pthreads代写,BU代编,CS350代编,Fundamentals of Computing Systems代编,C代编,pthreads代编,BU代考,CS350代考,Fundamentals of Computing Systems代考,C代考,pthreads代考,BU代做,CS350代做,Fundamentals of Computing Systems代做,C代做,pthreads代做,BUhelp,CS350help,Fundamentals of Computing Systemshelp,Chelp,pthreadshelp,BU作业代写,CS350作业代写,Fundamentals of Computing Systems作业代写,C作业代写,pthreads作业代写,BU编程代写,CS350编程代写,Fundamentals of Computing Systems编程代写,C编程代写,pthreads编程代写,BU作业答案,CS350作业答案,Fundamentals of Computing Systems作业答案,C作业答案,pthreads作业答案,