Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Cygwin\'s unix like enviroment complete the below problem In Section 5.7.1

ID: 3852956 • Letter: U

Question

Using Cygwin's unix like enviroment complete the below problem

In Section 5.7.1, we presented a semaphore-based solution to the producer - consumer problem using a bounded buffer. In this project, you will design a programming solution to the bounded-buffer problem using the producer and consumer processes shown in Figures 5.9 and 5.10. The solution presented in Section 5.7.1 uses three semaphores: empty and full, which count the number of empty and full slots in the buffer, and mutex, which is a binary (or mutual exclusion) semaphore that protects the actual insertion or removal of items in the buffer. do { .. /* produce an item in next-produced */ wait (empty): wait (mutex): .. /* add next-produced to the buffer */ .. signal (mutex): signal (full): } while (true): The structure of the producer process. do { wait(ful1): wait (mutex): .. /* remove an item from buffer to next consumed */ .. signal (mutex): signal (empty): .. /* consume the item in next_consumed */ .. } while (true): The structure of the consumer process. For this project, you will use standard counting semaphores for empty and full and a mutex lock, rather than a binary semaphore, to represent mutex. The producer and consumer - running as separate threads - will move items to and from a buffer that is synchronized with the empty, full, and mutex structures. You can solve this problem using PthreadS

Explanation / Answer

UNIX programs that have been written for maximum portability will know the difference between text and binary files and act appropriately under Cygwin. For those programs, the text mode default is a good choice. Programs included in official Cygwin distributions should work well in the default mode.it much easier to mix files between Cygwin and Windows programs, since Windows programs will usually use the CRLF format. Unfortunately you may still have some problems with text mode. First, some of the utilities included with Cygwin do not yet specify binary mode when they should. Second, you will introduce CRs in text files you write, which can cause problems when moving them back to a UNIX system.If you are mounting a remote file system from a UNIX machine, or moving files back and forth to a UNIX machine, you may want to access the files in binary mode. The text files found there will normally be in UNIX NL format, and you would want any files put there by Cygwin programs to be stored in a format understood by UNIX. Be sure to remove CRs from all Makefiles and shell scripts and make sure that you only edit the files with DOS and Windows editors that can cope with and preserve NL terminated lines.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote