Implement multi-threaded application using the POSIX threads

Assignment Help Operating System
Reference no: EM131743499

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

Reference no: EM131743499

Questions Cloud

Edmundson characterization of the contemporary university : How does Edmundson's characterization of the contemporary university compare with your own college experience?
Data comprehensiveness and data relevancy in healthcare : Compare and contrast data comprehensiveness and data relevancy in healthcare. Give an example that shows how they are different.
Explain the concept of management by objectives : Explain the concept of management by objectives and explain how it is used in organizations
Explain how the priority is determined : Show how the arbitration logic of Fig. can be modified to provide a rotating daisy chain arbitration procedure. Explain how the priority is determined.
Implement multi-threaded application using the POSIX threads : CSci 474 Operating Systems Concepts Project: Threads and semaphores. This project will implement a multi-threaded application using the POSIX threads
Planning as a function of management : What is the importance of an organization's mission, values, and objectives to planning as a function of management?
How does marketing help brands develop stakeholders : How does marketing help brands develop an identity to customers and other stakeholders?
Please research and find an article on the social theory : Then in a paragraph or two, please explain what this theory states about the reason an organization is a social entity.
What are amazon policies-internal and external environments : What are Amazon's policies? Are they consistent with each other with the mission, objectivies, and strategies, and with the internal and external environments.

Reviews

len1743499

11/30/2017 12:10:04 AM

Detailed Question: Please follow all requirements and don't worry about the write up portion of assignment. Submitting - Submit your project on Blackboard. Include in your submission the following files: A Word document for the written pieces of the project And Your source files. All work must be your own. If cheating is detected, all parties involved will be given a zero for the project and the penalty will be documented on a form that you must sign. You may be referred to the Dean’s office for further discussion. If you refer to any online resource, you must cite the source in both the comments and the summary document.

len1743499

11/30/2017 12:09:56 AM

The written portions will be graded subjectively based on completeness and quality. The code will be graded based on points allocated for each key part of the processing as determined by the instructor. The output will be graded based on expected results for the runs.

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