Question: Write a program in C language to create TWO (2) threads. One thread is a reader thread, it will read a string from the user

Write a program in C language to create TWO (2) threads. One thread is a reader thread, it will read a string from the user input, while the other is a writer thread that will print out the string received from the reader thread. Synchronization is necessary and should be achieved using the pthread_mutex_lock() and pthread_mutex_unlock().

Step by Step Solution

3.47 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Below is a simple program in C that creates two threads one for reading a string from the user and a... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Operating System Questions!