Write a non-threaded program to simulation heat dissipation

Assignment Help Operating System
Reference no: EM131261376

Operating Systems Assignment

Problem A: Sieve of Eratosthenes

Implement a multithreaded version of the Sieve of Eratosthenes. The Sieve of Eratosthenes is an ancient algorithm to compute prime numbers, attributed to the Greek mathematician Eratosthenes of Cyrene (276 BC - 194 BC). You can read and view an animation of the Sieve here:

https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes.

Here's an outline of a multithreaded version of the Sieve of Eratosthenes:

- the main thread generates an unbounded sequence of natural numbers starting at 2

- the main thread generates a SINGLE filter thread for the natural number 2 and then sends all subsequent numbers (3 to N) this filter thread via a SafeQueue data structure

- any number that is not a multiple of 2 is discarded by this filter thread

- any other number is a potential prime, so this filter thread passes the number onto the NEXT filter thread for processing, in this case the next filter thread will be for the prime number 3

- there will be a filter thread for each prime number that your Sieve uncovers so there's a filter thread for 2, 3, 5, 7, etc...

- when a new prime number is encountered, a filter thread is created for the prime number and it is connected to the previous filter thread via the SafeQueue data structure

- the first time a filter thread is created it will display the prime number that it is filtering

- the user specifies the NUMBER of prime numbers desired on the command line when executing the main program and the program terminates once that number of primes has been discovered

38_Figure.png

Problem B: Scientific Simulation I

Write a non-threaded program to simulation heat dissipation on the surface of a cylinder. You can model a cylinder using a 2D HxC array of cells. H represents the height of the cylinder and C represents the circumference of the cylinder (position cylinder[x][0] is adjacent to position [x][C-1]).

Each cell has a temperature (a double) that is initialized to tinit.

Select N cells at random (hard code the number of cells and their locations for testing) and set these cells to temperatures that are higher or lower than tinit. The temperature can be different for each of these cells (use the same temperature for testing). The temperature at each of these cells will remain FIXED for the duration of the simulation.

For each iteration of the simulation the temperature of each cell is recomputed as the weighted average of:

- the previous iteration's temperature (X) using weighted coefficient C0

- the previous iteration temperatures of the 4 direct neighbor cells (N0, N1, N2, N3) using weighted coefficient C1

- the previous iteration's temperature of the 4 diagonal neighbor cells (D0, D1, D2, D3) using weighted coefficient C2

325_Figure1.png

NOTE: There are three boundary conditions to consider:

- cylinder[x][0] and cylinder[x][C-1]

- cylinder[0][y] (no D0, N0, D1 available for weighted average)

- cylinder[H-1][y] (no D2, N3, D3 available for weighted average)

The simulation is complete when:

- max iterations have passed OR

- the simulation has converged on delta.

Convergence means that the difference between the previous iteration's cell temperature and the recomputed cell temperature is less than or equal to delta for all cells in the cylinder.

At the end of the simulation print out:

- the cylinder cells

- the maximum delta across the cells

- the average temperature across the cells

- the program execution time (actual cpu time used by the program not wall clock time)

- an estimate of the number of floating point operations per second (FLOPS)

To facilitate experiments, the simulator should accept H, C, tinit, c0, c1, c2, delta, max as command line arguments.

Report the output of running your program with these values in a file results.txt:

- H = C = 10, 100, 1000 (meaning 3 separate runs with 10x10, 100x100, 1000x1000)

- tinit=20C

- c0 = 0.5, c1=.1, c2=.025

- put a 40C heat source @ H/2,C/2

- put a 0C heat source @ H/4,C/4

- put a 0C heat source @ H-3, C-3

- experiment with delta and max

Here are some sample runs of the program:

923_Figure2.png

Problem C: Scientific Simulation II

Parallelize your program for the simulation of heat dissipation on the surface of a cylinder developed in Problem B using threads by adding the number of threads to be used to the list of command line arguments... assume the user won't ask you for more than 100 threads.

There are a wide range of design choices in the parallelization of your code and you should experiment with them. You to strive for "fast" code that aims at keeping the overhead from multithreaded execution small. For example, avoid repeated creation and termination of threads and have an eye on balancing the workload reasonably among the cooperating threads.

Some hints for implementation:

- Keep the threading solutions simple to avoid race conditions and synchronization problems.

- Compare the running time of your solution to problem B with your solution to problem C. Which solution takes less time and why?

Here is a sample run of the program that uses a max of 50 threads:

main 10 10 20 .5 .1 .025 .001 10000 50

Reference no: EM131261376

Questions Cloud

Create a chart for individuals with a moving range chart : A local doctor's office tracks the number of insurance claim rejections on a monthly basis. From the following information, create a chart for individuals with a moving-range chart.
How would you classify your personal leadership style : As a manger and leader, what are your strengths, and what are your weaknesses, specifically in relation to power, conflict, stress, psychological types, and/or emotional intelligence? How might you capitalize on the former and improve the latter i..
Positive and negative effects of private art museums : What do private art museums do that the public galleries can't? Analyse the positive and negative effects of private art museums using at least two examples to illustrate your argument (one of which must be Australian). Are they individualistic or..
Find the flow distribution in the parallel network : Find the flow distribution in the parallel network shown in Fig. P11.13. Assume constant friction factors.
Write a non-threaded program to simulation heat dissipation : CSC314 Operating Systems Assignment. Write a non-threaded program to simulation heat dissipation on the surface of a cylinder. You can model a cylinder using a 2D HxC array of cells. H represents the height of the cylinder and C represents the cir..
Frequent feedback to employees about performance : Why should managers provide ongoing and frequent feedback to employees about their performance? How would you feel about receivng feedback more frequently at your current employment (if applicable)?
Determine flow distribution and sketch hydraulic grade line : Identify the equations and unknowns to satisfy the solution for a parallel system. Why is it possible to treat the irrigation system as a parallel piping problem?
Marketing masters course : The Lindner College of Business has about 2500 undergraduate students, including freshmen and sophomores who take little business course work while completing their General Education requirements in the first two years.
Relationship between the sourcing and procurement strategy : Critically evaluate the relationship between the sourcing and procurement strategy with the overall corporate strategy.

Reviews

Write a Review

Operating System Questions & Answers

  Explain the basic need for and concepts of file

Explain the basic need for and concepts of file / folder permissions and business unit resource segregation in organizations so the company leaders will understand the importance of each.

  Any potential negative aspects of the technology

"An emerging technology not in use at the company such as a wireless network or PDAs."

  Ethical, legal and security responsibilities

Determine some of the ethical, legal and security responsibilities health care organizations must address when they implement health care database?

  Compare video, voice, and data formats.

Compare video, voice, and data formats. Identify at least three bandwidth techniques and how you would manage them with either UDP or TCP protocols

  How is file management utilized and managed

What tools can you use? For those of you who work, how is file management managed in your place of business?"

  Human centered and user centered approaches

Discuss the differences between the human centered and user centered approaches? Do you consider that human centered approach is more effective?

  Create your own shell

The premise of Project 2 is to create your own shell. Your shell will be launchable from a terminal window and act similar to the existing shell.

  Explain the format of the processor''s logical address

What is the format of the processor's logical address. What is the length and width of the page table (disregarding the "access rights" bits)

  Describe the type of flaw or condition within the os

Describe the type of flaw or condition within the OS that allowed the attack and how the flaw was addressed or countered. You need at least two references.

  Operating system security fundamentals

1. Explain the function of an operating system. 2. Describe the operating system security environment from a database perspective.

  Design of an operating system performance

Design of an Operating System Performance Evaluation and Analysis - What is the significance of the topic as related to the field of computer science and industry

  Assignment on functional modeling

Create a use-case diagram to include at least three (3) actors for the system described in this case through the use of graphical tools in Microsoft Word or Visio, or an open source alternative such as Dia. Note: The graphically depicted solution ..

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