Question: Must Use multithreaded programming with pthread and semaphore to maximize concurrency The type of compression used in wzip is a simple form of compression called
Must Use multithreaded programming with pthread and semaphore to maximize concurrency
The type of compression used in wzip is a simple form of compression called run-length encoding (RLE). RLE is quite simple: when you encounter n characters of the same type in a row, the compression tool wzip will turn that into the number n and a single instance of the character. Thus, if we had a file with the following contents: aaaaaaaaaabbbb the tool would turn it (logically) into: 10a4b A compressed file will consist of some number of 5-byte entries, each of which is comprised of a 4-byte integer (the run length) and the single character. To write out an integer in binary format (not ASCII), you should use fwrite(). (other similar library functions can do the same.) Read the man page for more details. For wzip, all output should be written to standard output (the stdout file stream, which, as with stdin, is already open when the program starts running). Note that typical usage of the wzip tool would thus use shell redirection in order to write the compressed output to a file. For example, to compress the file file.txt into a (hopefully smaller) file.z, you would type:
prompt> ./wzip file.txt > file.z
Note: if your multithreaded program runs slower than a normal non-multithreaded ones, then there must be something wrong
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
