Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Operating System Expert

Operating Systems Concepts Project: Threads and semaphores

I. Project Organization

This project will implement a multi-threaded application using the POSIX threads and semaphores with the programming language of C/C++.  Your program will be tested on a machine (lab00.cs.ndsu.nodak.edu  --  lab20.cs.ndsu.nodak.edu) in the computer science lab QBB 244.

You should do the following pieces to complete your project.  Each piece is explained below:

  • Code
  • Output
  • Summary

Code

Your code should be nicely formatted with plenty of comments.  The code should be easy to read, properly indented, employ good naming standards, good structure, and should correctly implement the design.

Output

Output will be graded by running your program.

Summary: The summary includes the following two pieces.

1. Complete the following table in the summary. In the following table, you should list all semaphores used in the program, the function and initial value for each semaphore.

Semaphore

Function

Initial Value

 

 

 

 

 

 

2. Discuss any difficulties encountered, what was learned, and results. This piece should be at least one page in length (font size - 11 points, single column and single space).

II. Project Description

Data-Center Simulation

You must use POSIX threads and semaphores to complete this project.

This project creates a system to simulate a data center. The following rules apply:

1) 5 data-generator threads are created in the main thread at the start of simulation. Each data-generator thread has a unique index ranging from 1 to 5. Each data-generator thread generates 10 random numbers (no duplicate numbers) with the following requirement:

a) The random numbers generated by data-generator thread 1 are ranging from 100 to 199.

b) The random numbers generated by data-generator thread 2 are ranging from 200 to 299.

c) The random numbers generated by data-generator thread 3 are ranging from 300 to 399.

d) The random numbers generated by data-generator thread 4 are ranging from 400 to 499.

e) The random numbers generated by data-generator thread 5 are ranging from 500 to 599.

2) 2 data-server threads are created in the main thread at the start of simulation. Each data-server thread has a unique index, ranging from 1 to 2.

3) Every number datum has to be processed by a data-server thread. A total of 50 number-data are processed by two data-server threads.

4) If a data-generator thread has unprocessed data, the data-generator thread contacts a data server. A data-generator thread only sends one number datum each time. If data-generator thread i has n unprocessed numbers, data-generator thread i must contact the server thread n times. Each number can processed by the same or different servers. If both data-server threads are busy (i.e., processing data from another data-generator thread), the data-generator thread is waiting for the availability of a data server based on the FIFO order. If both data servers are available, simply choose one server to handle the number datum. Each data-server can only handle one number datum one time.

5) Server Connection. A data-generator thread contacts a data-server thread with the following handshaking procedure:

a) A data-generator thread connects to a data-server thread. (You must print out this activity in the data-generator thread, e.g., Data-generator thread 1 connects to data-server thread 2.)

b) The data-server thread accepts the connection from the data-generator thread. (You must print out this activity in the data-server thread, e.g., Data-server thread 2 accepts the connection from data-generator thread 1.)

c) The data-server thread sends a connection confirmation to the data-generator thread.  (You must print out this activity in the data-server thread, e.g., Data-server thread 2 sends the connection confirmation to data-generator thread 1.)

d) The data-generator thread receives the connection confirmation from the data-server thread. (You must print out this activity in the data-generator thread, e.g., Data-generator thread 1 receives the connection confirmation from data-server thread 2.)

6) A data-server thread sleeps random time (50-200 ms) to simulate the procedure of handling a number datum.

7) Server Completion. A data-server thread contacts a data-generator thread with the following handshaking:

a) The data-server thread sends the completion message to the data-generator thread. (You must print out this activity in the data-server thread, e.g., Data-server thread 2 completes processing number datum 135 and notifies data-generator thread 1.)

b) The data-generator thread receives the notification. (You must print out this activity in the data-generator thread, i.e., Data-generator thread 1 acknowledges the completion of the number datum 135 from data-server thread 2).

8) Repeat the steps 4-7 if any data are not processed. In the server connection (Step 5), you must print out the indices of the data-generator thread and the data-server thread. In the server completion (Step 7), you must print out the number datum in addition to the indices of the data-generator thread and the data-server thread.

9) In the end of the simulation, a report is printed by each data-generator thread. See the following sample. Reports from different data-generator threads should not be interleaving.

Report Of Data-generator Thread 1

135 processed by data-server 2

142 processed by data-server 1

162 processed by data-server 1

115 processed by data-server 2

122 processed by data-server 1

152 processed by data-server 1

112 processed by data-server 1

134 processed by data-server 2

189 processed by data-server 1

184 processed by data-server 1

End of Report of Data-generator Thread 1

Attachment:- Assignment File.rar

Operating System, Computer Science

  • Category:- Operating System
  • Reference No.:- M92552183
  • Price:- $110

Guranteed 48 Hours Delivery, In Price:- $110

Have any Question?


Related Questions in Operating System

Research types of operating systems that are currently

Research types of operating systems that are currently available and provide a scenario in which the operating system you chose would be appropriate to be used in this situation. Explain why you think the choice you made ...

Question topic computerized operating systems os are almost

Question: Topic: Computerized Operating Systems (OS) are almost everywhere. We encounter them when we use out laptop or desktop computer. We use them when we use our phone or tablet. Find articles that describes the diff ...

Question you are a security administrator responsible for

Question: You are a security administrator responsible for providing secure configuration requirements for new laptop deployments. After reading Module 2 of Certified Secure Computer User v2exercises, apply the configura ...

Discussion question this research assignment will give

Discussion Question : This research assignment will give further information on the nature and workings of multi-tasking and multi-processing operating systems. All information reported in this assignment is to be in the ...

Catalog course descriptionin this course students carry out

Catalog Course Description In this course students carry out independent research in a significant technical area of information, network, and computer security. The student is to investigate a technical area, research i ...

Question state the required answer precisely and then

Question : State the required answer precisely and then provide proper explanation. It is not enough to provide one- word or one-line answers. What is the purpose of the command interpreter? Why is it usually separate fr ...

Question 1answer the following questions 10 marks a

Question 1 Answer the following questions: 10 marks a. Consider the following page reference string: 3, 1, 4, 1, 2, 3, 5, 3, 2, 1, 2,5, 4, 3, 5, 2, 4,2, 5,3 Using the above page reference string display the contents of t ...

Taskyour job in this assignment is to create two virtual

Task Your job in this assignment is to create two Virtual machines each running a different but the latest distribution of Linux e.g. Ubuntu Server and CentOS. Each of these VM's is to offer services to a user base. The ...

Question description of lasa in this assignment you will

Question: Description of LASA: In this assignment, you will select a real-world operating system (can be for a PC, server, tablet, handheld, or embedded device). You will introduce the operating system and its components ...

Question note apa format 250 words and three reference

Question: Note: APA format 250 words and three reference without plagarism Computerized Operating Systems (OS) are almost everywhere. We encounter them when we use out laptop or desktop computer. We use them when we use ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As