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

  Implementation of algorithms for process management

The Shortest Job Next (SJN) algorithm queues processes in a way that the ones that use the shortest CPU cycle will be selected for running rst.

  Develop a user mode command interpreter

Develop a user mode command interpreter which support list-short.

  Memory allocation in operating system

Analysis and implementation of algorithms for memory allocation in operating system, Explain First- t and best- t methods are used in memory allocation in operating systems.

  Stand alone child process

Forking the child process

  Write a multi-threaded program

Write a multi-threaded program to solve producer and consumer problem

  Marginal and average cost curves

n a competitive market place (pure competition) is it possible to continually sell your product at a price above the average cost of production.

  Simulating operating systems scheduling

Simulate the long-term scheduler, the short-term scheduler and the I/O scheduler of the computer using the First-Come-First-Serve algorithm.

  Issues with trusted platform module

Research paper discussing the issues with Trusted Platform Module (TPM)

  Threads

Explain a complication that concurrent processing adds to an operating system.

  Design and programming

Use the semaphore methods to control the concurrency of the solution

  Virtual machines

Virtual machines supported by a host operating system

  Discuss an application that benefits barrier synchronization

Discuss an application that would benefit from the use of barrier synchronization

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