CSCI4730 Operating Systems Assignment

Assignment Help C/C++ Programming
Reference no: EM133094208

CSCI4730 Operating Systems - University of Georgia

Project: Multi-threaded Web Server

Description
In this project, you will design and implement a multi-threaded web server. The code of the single-threaded version1 is provided, and you will convert it into a multi-threaded architecture.

Part 1. Thread Pool
The main problem of a single-threaded web server is the poor scalability. It cannot scale up to large numbers of clients. To address the problem, you will convert the web server into the multi-threaded model. The multi-threaded model has a much better performance to handle multiple clients simultaneously.

One way to implement this is to create a child thread for each request. However, it causes unnecessary thread creation and termination overhead. To minimize such overheads, you will design and implement a thread-pool model.

Thread-pool: When the server launches, we create [N+1] child threads: [N] worker threads, and one listener thread. The main thread only monitors the child threads.

We will use producer-consumer solution in this problem. The synchronizations will include two semaphores (sem_full, sem_empty), and one mutex lock (mutex).

1. Listener thread keeps listening for client connections. When a request arrives (i.e., new item), accepts it and puts the request information (file descriptor) into the shared buffer, and starts to listen for a new request again. If the buffer is full, the listener should wait.

2. Each worker thread initially waits for the signal from the listener thread because the buffer is initially empty. When the listener inserts a new request into the buffer, any available child thread pulls a request information from the buffer and handles it (call process() function).

You will need to carefully use semaphores and lock methods to avoid concurrency problems such as race conditions or deadlocks.
• You will modify "webserver.c" to build a multi-threaded server.
• The number of worker thread(N) is given by the user via command-line argument. Your program will accept 2 command line arguments, "port number" and "number of threads".
o ./webserver 4000 10 // port 4000, create 10 child threads
• You can use client2 (html client) to test of your server program.
o ./client [host_ip or dns] [port] <# of threads>
o ex) ./client 127.0.0.1 4001 10
o <# of threads> is optional. The default is 10.
• Partial credit will be given to correct but not efficient solutions (e.g., busy-waiting).

Part 2. Crash Handling
If one or more child threads crash, we need to create new child threads to keep the same number of threads in the thread pool. Like the first programming project, you will use the command-line argument to simulate the thread crash. However, you do not need to repeat the failed request in the server side. The client re-sends the request when it detects the failure.

• You can use 3rd command-line arguments (integer between 1 and 50) to trigger a crash. 50 means each child thread has 50% chance to be killed abnormally by calling "pthread_exit(NULL)". 1 means 1% chance to crash.
o ./webserver 4000 10 50 // port 4000, create 10 child threads, each thread has 50% chance to crash
• Hint: You can use "pthread_tryjoin_np()" to perform a non-blocking join.
o Details can be found in the man page: "$man pthread_tryjoin_np"

Attachment:- Multi-threaded Web Server.rar

Reference no: EM133094208

Questions Cloud

What would the company desired inventory balance be : Anders Co. Projected the following sales information and details for the next Quarter below: What would the company desired inventory balance be
What is human resource management : What is Human Resource Management and why is it relevant to understand?
Recommendation for professional development : Professional development is truly the key to professional growth both for the Fire Officer II and his or her personnel.
What is a recommendation document in business class : What is a recommendation document in business class
CSCI4730 Operating Systems Assignment : CSCI4730 Operating Systems Assignment Help and Solution, University of Georgia - Assessment Writing Service - Multi-threaded Web Server Project
Recovery is the process of returning to normalcy : Recovery is the process of returning to normalcy or even abetter condition prior to the incident/disaster. Explain with examples the short-term and long-term re
Peers and organizational performance : How can each individual influence his/her peers and organizational performance?
What is the company weighted average cost of capital : If shareholders require a return of 25% and the pre-tax cost of debt is 10.5%, then what is the company's weighted average cost of capital
Describe how you might consult with relevant stakeholders : Describe how you might consult with relevant stakeholders in regards to resource management.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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