Question: System Proggramng with C progrramng . @lnux Write a program that has three threads. The first thread should open and read data from a file
System Proggramng with C progrramng . @lnux
Write a program that has three threads. The first thread should open and read data from a file (data.txt), 1 byte at a time, placing it in a buffer (array, use size of 100). Second and third threads should read from this buffer 1 byte at a time and display it on the screen. Readers must stop when the buffer of 100 bytes is fully written to the screen. You should secure the read access to your buffer using a mutex, but this mutex should not affect writing to the screen. Hint: You will need a read and write positions. You may ignore buffer under and overruns. Try to remember back data structures lecture about queues. Do not forget to join worker threads to the main thread. You need three functions: writer, reader, and main and three topics: IO, threads, and mutexes. Most of the grade will be awarded to the use of functions rather than the program logic. [9 points]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
