This shows you the differences between two versions of the page.
ep:labs:03:contents:tasks:ex3 [2019/10/13 18:03] emilian.radoi |
ep:labs:03:contents:tasks:ex3 [2025/03/17 20:53] (current) radu.mantu [03. [15p] Zip with compression levels] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== 02. [10p] Monitor the system performance ==== | + | ==== 03. [15p] Zip with compression levels ==== |
+ | The **zip** command is used for compression and file packaging under Linux/Unix operating system. It provides 10 levels of compression, where: | ||
+ | * **level 0** : provides no compression, only packaging | ||
+ | * **level 6** : used as default compression level | ||
+ | * **level 9** : provides maximum compression | ||
- | <note warning> | + | <code bash> |
- | High risk of freezing your computer. Show the assistant your progress before starting this exercise! | + | $ zip -5 file.zip file.txt |
- | </note> | + | </code> |
- | === [5p] Generating a script === | + | === [10p] Task A - Measurements === |
+ | Write a script to measure the compression rate and the time required for each level. You have a few large files in the code skeleton but feel free to add more. If you do add new files, make sure that they are not random data! | ||
- | * Create a 1GB file of random generated integers ranging from 1 to 10 million. | + | === [5p] Task B - Plot === |
- | * Write a script/C program to sort the numbers in this file in ascending order. | + | Generate a plot illustrating the compression rate, size decrease, etc. as a function of **zip** compression level. Make sure that your plot is //understandable// (i.e., has labels, a legend, etc.) Make sure to average multiple measurements for each compression level. |
- | + | ||
- | === [5p] Monitoring the performance === | + | |
- | + | ||
- | * Monitor the system performance using the tools presented in this tutorial. | + | |
- | + | ||
- | Good to know: | + | |
- | + | ||
- | * Split the file into smaller chunks that would fit in memory (e.g. 200MB). | + | |
- | * Use a classical sort algorithm for sorting these chunks. | + | |
- | * Merge the sorted chunks two by two. Read in memory only two numbers at a time (one from each chunk) starting from the beginning, compare the numbers, write the smallest in the merged file, and read the next number from the chunk that had its number written in the merged file. | + | |
- | * Repeat the last step until you obtain the original file sorted. | + |