Lab 3: Encoder
Introduction
Data compression is the process of encoding information using fewer bitsthan the original representation. Run-length encoding (RLE) is a simple yeteffective compression algorithm: repeated data are stored as a single dataand the count. In this lab, you will build a parallel run-length encoder called
Not Your Usual ENCoder, orno deadlocks or race conditions. In particular, there are two things that youneed to consider carefully:The worker thread should wait until there is a task to do.The main thread should wait until a task has been completed so that itcan collect the result. Keep in mind that the tasks might not complete inthe same order as they were submitted.CompilationWe will grade your submission in an x86_64 Rocky Linux 8 container onGradescope. We willcompile your program using5/13EvaluationYour code will fi rst be tested for correctness. Parallelism means nothing iyour program crashes or cannot encode fi les correctly.
f you pass the correctness tests, your code will be measured forperformance. Higher performance will lead to better scores.Please note that your computer needs to have atleast as many cores as the number ofthreads you use in order to benefi tfrom parallelization.Consider running your program on the CIMS compute servers if you areusing a single- or dual-core machine.straceWe will usestraceto examine the system calls you have invoked. You willsuffer from severe score penalties if you calclone()too many times,which indicates that you do not use a thread pool properly, or if you callnanosleep(), which indicates that you do not have proper synchronization.On the other hand, you can 代 写 Encoder Data compression expect to fi nd manyfutex()invocations in thestracelog. They are usedfor synchronization.You can use the following command to run your program understraceanddump the log tostrace.txt:$ strace ./nyuenc -j 3 file.txt > /dev/null 2> strace.txtValgrindWe willuse two Valgrind tools, namely Helgrind and DRD, to detect threaderrorsin your code. Both should report 0 errors from 0 contexts.You can use the following command to run your program under Helgrind:nyuencn the root of the archive. You can create the archive fi le with thefollowing command in the Docker container:
$ zip nyuenc.zip Makefile *.h *.cNote that other fi le formats (e.g.,rar) will not be accepted.Lab 3: Encode7/13You need to upload the .zip archive to Gradescope. If you need toacknowledge any infl uences per our academic integrity policy, write them
as comments in your source codeRubricThe total of this lab is 100 points, mapped to 15% of your fi nal grade of this
course.successfully and encode the example fi le correctly. (40 points)Milestone 1. Correctly encode one fi le. (10 points)
Correctly encode multiple fi les. (10 points)Milestone 2. Correctness. (20 points)Your program should produce the correct output within one minute on Gradescope without crashing.
Free ofthread errors (e.g., deadlocks, race conditions). (15 points)For each error context reported by Helgrind or DRD (we will take the smaller of the two), there will be 5 points deduction.
Lab 3: Encoder12/13Gradescope says “your program does not use a threadpool correctly.” Why?most likely reason is that some parts of your program are executedserially while they should have been executed in parallel. In particular, yourmain thread should run concurrently with your worker threads:In the task-submission phase, worker threads should run while the mainthread is submitting tasks. As soon as a task is submitted to the taskqueue, a worker thread should process it.
- In the result-collection phase, the main thread should run while theworker threads are processing tasks. As soon as a task is complete, themain thread should collect the result.Thislab has borrowed some ideasfrom Prof. Arpaci-Dusseau.
标签:compression,should,will,program,fi,Encoder,Data,your,points From: https://www.cnblogs.com/comp9021T2/p/18548127