Find Jobs
Hire Freelancers

Multi-thread web server in C

$250-750 USD

Anulowano
Opublikowano około 8 lat temu

$250-750 USD

Płatne przy odbiorze
you will be developing a network application program that illustrates the client-server computing model. You are asked to write a real, working web server under the Linux operating system. To simplify your work, we have provided you with the C code for a very basic web server. This basic web server uses a single-threaded architecture to perform the required work, where the web server process will receive one user request at a time and serve it before accepting any new requests. Your job in this project is to make the web server more efficient by changing the way it handles the received requests. Your new web server shall use a multi-threaded architecture where the main thread receives new requests and inserts them into a waiting list, and a scheduling thread removes a request from the list and assigns it to a worker thread. The provided basic web server can handle some type of files HTML, GIF, JPEG, TXT, etc. It can also handle a limited portion of the HTTP web protocol (namely, the GET command to fetch a web page). You are not required to change that. The provided pieces of code are designed to help you concentrate on the required changes only. The parts of code that handle the interpretation of the text string(s) received in the request, logging functions, sending back the response string(s) and the requested target are provided to you in a compiled object file, while the parts that require change are provided to you in source files. Objectives: A web server has many of the problems you studied in the operating systems course, but it is easier to understand, modify and test a web server code than modifying and testing the code of a real operating system. In this project you are going to gain hands-on experience in the following areas: • Modifying an existing code base. • Creating and synchronizing cooperating processes and threads in Linux. • Setting up client-server inter-process communication using Internet sockets. • Applying some scheduling and overload handling strategies to improve system performance. • Using a benchmarking tool to measure the system performance. Multi-threaded Design: A better approach is to create a new worker thread for each client to serve his/her request. With this approach, each request can be responded-to, independently and once it is finished, that thread is terminated. If new worker threads could not be created for the incoming HTTP requests, then those requests will need to be buffered until new threads are created. In your implementation, you must have a master thread, a scheduling thread and worker threads. Master Thread: 1. The master thread is responsible for accepting new HTTP connections over the network and placing their descriptors in a fixed-size buffer. 2. The master thread should not read from any connection, it must immediately return to accepting more connections. 3. If the buffer is full, the master thread must follow the specified overload handling policy. Scheduling Thread: 1. It acts as a consumer from the buffer. 2. The scheduling thread, repeatedly, attempts to create a new worker thread. 3. If it succeeded, then it applies the specified scheduling policy, described below, to select the HTTP request that should be removed from the buffer and sent to the new worker thread. Worker Thread: 1. Each worker thread must be able to handle only static requests. 2. Once a worker thread is activated, it should call the serve() function with the network descriptor it gets from the scheduling thread. 3. The worker thread terminates after it finishes serving the HTTP request. Note that the master thread and the scheduling thread are in a producer-consumer relationship and require that their accesses to the shared buffer be synchronized. Specifically, the master thread may block and wait if the buffer is full; the scheduling thread must block and wait if the buffer is empty. In this project, you are required to use semaphores for synchronization.
Identyfikator projektu: 10264269

Informację o projekcie

Zdalny projekt
Aktywny 8 lat temu

Szukasz sposobu na zarobienie pieniędzy?

Korzyści ze składania ofert na Freelancer.com

Ustal budżet i ramy czasowe
Otrzymuj wynagrodzenie za swoją pracę
Przedstaw swoją propozycję
Rejestracja i składanie ofert jest bezpłatne

O kliencie

Flaga SAUDI ARABIA
Jeddah, Saudi Arabia
5,0
1
Członek od kwi 19, 2016

Weryfikacja Klienta

Dziękujemy! Przesłaliśmy Ci e-mailem link do odebrania darmowego bonusu.
Coś poszło nie tak podczas wysyłania wiadomości e-mail. Proszę spróbować ponownie.
Zarejestrowani Użytkownicy Całkowita Liczba Opublikowanych Projektów
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Wczytywanie podglądu
Udzielono pozwolenia na Geolokalizację.
Twoja sesja logowania wygasła i zostałeś wylogowany. Proszę, zalogować się ponownie.