How many worker threads do you need

Assignment Help Operating System
Reference no: EM131092565

Operating Systems Assignment-

Question 1 - Using pthreads, add multi-threading to the server in the sample solution for assignment 1 question 2. The server will use a thread pool (as discussed in class) to support the handling of multiple concurrent requests. In other words, you will have a thread (main) that's doing a blocking read on the FIFO and will hand off each message to a worker thread for processing.

Note that to terminate all of the worker threads, the main thread will need to provide the threads with data (such as a -1) to indicate that it is time for the threads to finish. Further, the main thread must ensure that all worker threads are done before it terminates the server.

Be careful with what needs to be protected! All shared resources are subject to access by multiple threads. This includes shared (file scope) variables and any file handles (you never know which threads may access the same file). But, to make things a little simpler, remove support for the HUP signal. That way we can treat the template as read only and free from any protection issues.
The number of worker threads can have a noticeable effect on throughput. Experiment with having thread counts that are less than and greater than the number of clients. How many worker threads do you need? Do you need more than the maximum number of clients? The same number? Will less do? Why? Include your answer (in the form of a paragraph) in your assignment's readme file.

Finally, note that all you need to hand in is server.c. The marker will be using the rest of the assignment 1 sample solution to test your solution.

Question 2 - Using pthreads, implement a bounded buffer. Use condition variables for full and empty and a lock on the entire buffer (and our condition variables). Each producer will take the string "Now is the time for all good people to come to the aid of their country" and write it to the shared buffer, one character at a time. Your consumer will read a character from the buffer and write it to standard output (one at a time). Be careful: the consumer must finish when all of the producers are done. How can the consumer know when a producer is finished?

To test a variety of configurations, vary the buffer size between 2 and 128, incrementing by powers of 2. For each of these sizes, vary the number of producer threads between 2 and 128, incrementing by powers of 2. Note that you'll need to wait for all threads to finish before starting the next round. In your readme, include a paragraph discussing how the output changes as you vary the buffer size and number of producers. Run your program a number of times. How does the output change?

Attachment:- Assignment.zip

Reference no: EM131092565

Questions Cloud

Discuss errors in perception and selection : Write a 2000 words on Untrained interviewers can make mistakes that are very costly to the organization.” Discuss errors in perception and selection that interviewers can make and how to avoid them.
Detail the steps in a secret ballot representation election : 1. Identify and discuss in detail the steps in a secret ballot representation election. Who initiates this process? Explain.
Calculate the maximum resultant stress in the beam : Calculate the maximum resultant stress in the beam and plot the stress distribution diagram for this section
Develop one application using jtabbedpanes and jframes : Develop one application using JTabbedPanes and JFrames and another application that connects to a MySQL database.
How many worker threads do you need : COMP 3430 Operating Systems Assignment. How many worker threads do you need? Do you need more than the maximum number of clients? The same number? Will less do? Why
What conditions is the equilibrium stable or not stable : The contact between cube and sphere is perfectly rough. Under what conditions is the equilibrium stable or not stable?
Leather goods manufacturing unit : The success and final outcome of this Final Report required a lot of guidance and assistance from many people and me extremely fortunate to have got this all along the completion of our project work.
Enter omit in the answer area : The Terms will be designated as "Short Answer" questions. There are twelve of these from which you will select and answer ten. You will enter "OMIT" in the answer area of the two you do not wish me to grade. If you make no designation, I will grad..
How climate change impact on global businesse : Write an article:-Give critics on how climate change impact on global businesses. Introduction(a)Damage to property and infrastructure(b)Reduction in productivity

Reviews

Write a Review

Operating System Questions & Answers

  Discuss the purpose of operating systems

Discuss the purpose of operating systems and Describe the components that comprise operating systems and the functions of each of these components

  Program to calculate numeric grades for a course

Create a program to calculate numeric grades for a course. The course records are in a document that will serve as the input document.

  Clients correctly submit integer and fifo name to serve

Accepts connections from 3 clients each in a separate window - Clients correctly submit integer and FIFO name to serve

  Encoding the data using the generator polynomial

Encode the data bit sequence 10011011100 using the generator polynomial and provide the code word.

  Project that uses interactions to develop the system

on a project that uses interactions to develop the system, in which interation does systems design begin? explain why

  A- please answeronly two ofnbsp the following questions

a- please answeronly two ofnbsp the following questions that are related to the file

  Compare windows operating system with mac os

Compare windows Operating system with mac OS. write advantages and disadvantages of both (400 words). 2. Briefly discuss the usage of the following Microsoft office software (800 words)

  Compute the cost of 1 mbyte of main memory

Describe the meaning of Tc, Cc, Tm and Cm and compute the cost of 1 MByte of main memory using the above parameters.

  What is the os? what are the machines?

What is the OS? What are the machines?

  Estimate maximum aggregate i/o transfer rate

A 32-bit computer has two selector channels and one multiplexor channel. Each selector channel supports two magnetic disk and two magnetic tape units.

  Propose the computing and data communications elements

Propose the computing and data communications elements needed to satisfy the system requirements defined in the given case. You must specify the criteria for evaluating the hardware, software and data communications requirements of your system.

  How they are selected and prioritized by management

how they are selected and prioritized by management, at a strategic level?

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