Question: Concurrent Programming Subject, please help me short answer for those questions: 1 . What is the advantage of a shorter scheduling quantum? _ _ _

Concurrent Programming Subject, please help me short answer for those questions:
1. What is the advantage of a shorter scheduling quantum? _____________________________
2. What is the advantage of a longer scheduling quantum? ______________________________
3. In Java, if a class A has a static variable b, how can you ensure a thread can safely assess the static variable? Method 1____________________________Method 2___________________________________
4. We often see code like while (flag ==0) Pthread_cond_wait(&cond, &mutex). Here why it is better to use while, rather than if (flag ==0) Pthread_cond_wait(&cond, &mutex)?_____________________________
5. A semaphore is initialised as 2. Now it is value is -1. This means how many threads are waiting? _______
6. What concurrency primitive tools can you use to fix atomicity violation bugs and order violation bugs?
Atomicity violation __________________________Order violation__________________________________

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Programming Questions!