ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

CMSC 216 Exercise #6 Spring 2019

2019-05-12 19:54:50  阅读:586  来源: 互联网

标签:216 Spring array will threads sum need CMSC your



CMSC 216 Exercise #6 Spring 2019
Threads Deadline: Wed, May 8 (lab time)
1 Overview
In this exercise you will use threads to write a program that computes the maximum and the sum of data
present in an array. For this assignment:
There are no public, release nor secret tests.
There is no project distribution (usual folder we post).
You need to work with classmates (in groups of 3 students).
You need to show your work to your teaching TA on Wednesday’s lab (May 8). Notice that all members
of your team will receive the same score.
If you don’t show your work to a TA you will not get any credit. Only one member of your group needs
to do the demo (not all of you need to be present). Even if some of your members belong to another
section, only one person needs to present.
You may use any code we have posted for our lectures/labs.
To submit upload a zip file with your code to the submit server using the appropriate entry. Only one
member of your group needs to submit.
If you have questions about this assignment, please post them in Piazza. This will simplify the process
of keeping the class informed about updates. It is your responsibility to check Piazza often regarding
any possible updates and clarifications.
There is only one deadline (no late submission).

CMSC 216作业代做、program留学生作业代做、代写c/c++课程设计作业、c/c++编程语言作业调试
2 Specifications
You need to write a program that will create an array with random integer values. Then one of two
possible processings will be applied to this array:
– Max - You need to compute the maximum value in the array. Notice that for a number of threads
greater than one, you need to assign to each thread an array segment. Just divide the array in equal
length segments (when possible) based on the number of threads. For example, for an array of 1001
elements and 2 threads, the first thread can process the first half (500) and the second thread the
rest (501).
– Sum - You need to correctly compute the sum of elements in the array based on the following
formula: sum = (sum + a[i]) % 1000000, where a[i] represents an array element.
The program relies on command line arguments to provide the following information:
– Number of elements
– Number of threads
– Seed (for random number generator)
– Task (1 for max, 2 for sum)
– Print Results (Y or N)
Feel free to provide any additional parameters you understand you need.
1
After completing a task (maximum or sum) the program will display the results (maximum value or
sum) if requested by the user.
After completing a task, the program will display the wall clock time, the user time and the system/kernel
time that it took to compute the maximum or the sum. Notice that this time information does not include
the time to generate the random array.
You need to have threads that run concurrently. For example, starting a thread and executing a join on
it and repeating the process for each thread is not valid (you are executing threads sequentially.)
The time information should follow the results.
Report - Run experiments where you explore the impact of threads while computing the maximum
value and the sum. Create a table where you increase the number of threads and the data sets. Your
goal is to see whether using additional threads improves performance. Provide a short (one paragraph)
explanation of your results. The information in this report is what you will be discussing with your TA
in lab. You can create this report in a text file (report.txt).
Remember that you may not use code from the internet.
The current limits in grace will not allow you to create a large number of threads. You can change those
limits (assuming you are using tcsh) by executing ”limit maxproc” followed by a number (e.g., limit
maxproc 400).
Make sure you check the values returned by Pthreads functions; this will allow you to identify whether
your code is failing.
An example of using the srand() and rand() functions can be found in the lecture example (dyn realloc.c)
discussed while covering dynamic memory allocation.
3 Grading Criteria
Your project grade will be determined by the following:
Maximum using multiple threads 40 pts
Sum using multiple threads 30 pts
Correct sum computation 10 pts
Report 10 pts
Code Style 10 pts
3.1 Style grading
Follow the C style guidelines available at:
http://www.cs.umd.edu/~nelson/classes/resources/cstyleguide/
4 Submission
Create a file named authors.txt with the names and directory ids (e.g., terp1, NOT your student number)
of the members in your group.
Create a folder with the .c code, the report and the authors.txt file. Zip that folder and upload it to the
submit server. Only one member of your team needs to upload the submission. To submit your exercise
use the submit server web interface (you will not be able to submit using the submit command in grace).
2
5 Academic Integrity
Please see the syllabus for project rules and academic integrity information. All programming assignments in
this course are to be written individually (unless explicitly indicated otherwise in a written project handout).
Cooperation between students is a violation of the Code of Academic Integrity.

因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com 

微信:codinghelp

标签:216,Spring,array,will,threads,sum,need,CMSC,your
来源: https://www.cnblogs.com/blogy/p/10853343.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有