Written in C
Posted: Fri Jul 08, 2022 6:39 am
Written in C
Consider the following: • A program uses two threads to generate two numbers. ● V1 and V2 are used as shared variables to communicate between the two threads. • First thread T1: o Generates a number and stores it in V1. o Print The value in V2. Second thread T2 o Generates a number and stores it in V2. o Print The value in V1. • The program uses two Mutexs (M1 and M2) to synchronize access to shared variables. o M1 used to control access to V1 o M2 used to control access to V2 Program Details • Consider the provided details, write a simple program that causes a deadlock within the process using the detailed threads, Mutexes. Program Output • No output is needed for this program.
Consider the following: • A program uses two threads to generate two numbers. ● V1 and V2 are used as shared variables to communicate between the two threads. • First thread T1: o Generates a number and stores it in V1. o Print The value in V2. Second thread T2 o Generates a number and stores it in V2. o Print The value in V1. • The program uses two Mutexs (M1 and M2) to synchronize access to shared variables. o M1 used to control access to V1 o M2 used to control access to V2 Program Details • Consider the provided details, write a simple program that causes a deadlock within the process using the detailed threads, Mutexes. Program Output • No output is needed for this program.