COSC 3360 – 24967 – Fundamentals of Operating Systems

COSC 3360 - 24967 - Fundamentals of Operating Systems

COSC 3360 – 24967 – Fundamentals of Operating Systems

Programming Assignment Help

At Programming Homework Tutors, we believe in providing our students with practical, real-world examples of how to apply the concepts they learn in class. That’s why we’ve developed a variety of sample projects to help you see how our courses can be used to create impactful solutions in your field of study.

 

Objective:

This assignment will introduce you to interprocess synchronization mechanisms in UNIX using named POSIX semaphores, pthread mutex semaphores, and pthread condition variables.

Problem:

For this assignment, you will modify your solution for programming assignment 1 to comply with the restrictions explained below.

Given the information about the alphabet and the compressed file as input from STDIN, you need to implement a multithreaded Huffman decompressor 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 the following format:

4

A 3

C 3

B 1

D 2

11 1 3 5

0 0 2 4

101 6 8

100 7

 The first line has a single integer value representing the number of symbols in the alphabet (n).

The next n lines present the information about the alphabet. Each line presents the information about a symbol from the alphabet:

A character representing the symbol.

An integer representing the frequency of the symbol.

 The final n lines present the information about the compressed file. Each line presents the information about a compressed symbol:

A string representing the binary code of the symbol.

A list of m integers (where m is the frequency of the symbol) representing the positions where the symbol appears in the message.

 

 Generate the Huffman Tree based on the input.

 Create n POSIX threads (where n is the number of symbols in the alphabet). Each child thread executes the following tasks:

 Receives the Huffman tree and the information about the symbol to decompress (binary code and list of positions) from the main thread.

Uses the Huffman tree to determine the character from the original message based on the binary code.

Stores the decompressed character (as many times as needed based on the list of positions) on a memory location accessible by the main thread.

 Print the information about the assigned symbol using the output message from the example below.

 Print the original message.

Given the previous input, the expected output is:

Symbol: A, Frequency: 3, Code: 11

Symbol: C, Frequency: 3, Code: 0

Symbol: D, Frequency: 2, Code: 101

Symbol: B, Frequency: 1, Code: 100

Original message: CACACADBD

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.

 

Disclaimer


The sample projects provided on our website are intended to be used as a guide and reference for educational purposes only. While we have made every effort to ensure that the projects are accurate and up-to-date, we do not guarantee their accuracy or completeness. The projects should be used at your own discretion, and we are not responsible for any loss or damage that may result from their use.
At Programming Homework Tutors, we are dedicated to helping students and educators achieve their goals by providing them with the resources they need to succeed. Our website offers a variety of tools and resources that can help you with the project mentioned above.
Whether you need help with research, project management, or technical support, our team of experts is here to assist you every step of the way. We offer online courses, tutorials, and community forums where you can connect with other learners and get the support you need to succeed.
If you’re looking to take your skills to the next level and make an impact in your field, we invite you to explore our website and see how we can help you achieve your goals.

No Comments

Post A Comment

This will close in 20 seconds