- Written In C Consider The Following A Program Uses Two Threads To Generate Two Numbers V1 And V2 Are Used As Share 1 (31.3 KiB) Viewed 62 times
Written in C Consider the following: • A program uses two threads to generate two numbers. • V1 and V2 are used as share
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Written in C Consider the following: • A program uses two threads to generate two numbers. • V1 and V2 are used as share
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: • Generates a number and stores it in V1. o Print The value in V2. • Second thread T2 • Generates a number and stores it in V2. 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.