Read the input from STDIN (the Moodle server will implement input redirection to send the information from a file to STDIN). The input has a single line with the message (string or char array).

Learning Goal: I’m working on a operating systems project and need an explanation and answer to help me learn.

please start from scratch, Use C++

given a message (string or char array) as input, you need to implement a multithreaded version of the Shannon-Fano-Elias code generator based on the following steps:

  • Read the input from STDIN (the Moodle server will implement input redirection to send the information from a file to STDIN). The input has a single line with the message (string or char array).

Example Input File: AAAAAABBBBBCCCCDDDEE


  • Create n POSIX threads (where n is the number of symbols to encode). Each child thread executes the following tasks:
    • Receives the probabilities of the symbols from the main thread.
    • Implements the Shannon-Fano-Elias encoding algorithm to determine the code for the assigned symbol.
    • Print the Shannon-Fano-Elias code for the assigned symbol.

Given the previous input, the expected output is:

 

SHANNON-FANO-ELIAS Codes:

Symbol A, Code: 001
Symbol B, Code: 011
Symbol C, Code: 1010
Symbol D, Code: 1101
Symbol E, Code: 11110

NOTES:

  • You can safely assume that the input files will always be in the proper format.
  • You cannot use global variables. A 100% penalty will be applied to submissions using global variables.
  • You must define the critical sections following the guidelines that we discussed in class.
  • You must use POSIX threads. A penalty of 100% will be applied to submissions using a thread library other than the pthread library.
  • You can only use named POSIX semaphores, pthreads mutex semaphores, or pthreads condition variables to achieve synchronization. Using pthread_join or sleep to synchronize your threads is not allowed (you must use pthread_join to guarantee that the parent thread waits for all its child threads to end before ending its execution). A penalty of 100% will be applied to submissions using the previous system calls to synchronize the child threads.
  • You cannot use different memory addresses to pass the information from the parent thread to the child threads.
  • You must use the output statement format based on the example above.

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!