Computer Systems: A Programmer's Perspective (3rd Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 12, Problem 12.30HW

A.

Program Plan Intro

Deadlocks:

  • The deadlock denotes a situation where a collection of threads remains blocked.
  • It denotes waiting for a condition that would never be true.
  • The progress graph denotes invaluable tool for understanding deadlock.
  • If “P” and “V” operations are been ordered incorrectly, the forbidden regions for two semaphores would overlap.
  • If any execution trajectory reaches deadlock state “d” then no further progress will be possible.
  • In this case each thread waits for the other one for a “V” operation that never occurs.
  • The overlapping forbidden regions would induce a set of states called “deadlock region”.
  • The deadlock is inevitable is trajectory touches a state in deadlock region.
  • Once it enters deadlock regions, the trajectories could never leave.

Mutex lock ordering rule:

  • A program is deadlock-free if each thread acquires its mutexes in order.
  • It releases them in reverse order and given a total ordering for all mutexes.
  • The mutex should be achieved in order to ensure deadlock free scheme.

B.

Program Plan Intro

Deadlocks:

  • The deadlock denotes a situation where a collection of threads remains blocked.
  • It denotes waiting for a condition that would never be true.
  • The progress graph denotes invaluable tool for understanding deadlock.
  • If “P” and “V” operations are been ordered incorrectly, the forbidden regions for two semaphores would overlap.
  • If any execution trajectory reaches deadlock state “d” then no further progress will be possible.
  • In this case each thread waits for the other one for a “V” operation that never occurs.
  • The overlapping forbidden regions would induce a set of states called “deadlock region”.
  • The deadlock is inevitable is trajectory touches a state in deadlock region.
  • Once it enters deadlock regions, the trajectories could never leave.

Mutex lock ordering rule:

  • A program is deadlock-free if each thread acquires its mutexes in order.
  • It releases them in reverse order and given a total ordering for all mutexes.
  • The mutex should be achieved in order to ensure deadlock free scheme.

C.

Program Plan Intro

Deadlocks:

  • The deadlock denotes a situation where a collection of threads remains blocked.
  • It denotes waiting for a condition that would never be true.
  • The progress graph denotes invaluable tool for understanding deadlock.
  • If “P” and “V” operations are been ordered incorrectly, forbidden regions for two semaphores would overlap.
  • If any execution trajectory reaches deadlock state “d” then no further progress will be possible.
  • In this case each thread waits for the other one for a “V” operation that never occurs.
  • The forbidden regions that are overlapping would induce a set of states called “deadlock region”.
  • The deadlock is inevitable is trajectory touches a state in deadlock region.
  • Once it enters deadlock regions, the trajectories could never leave.

Mutex lock ordering rule:

  • A program is deadlock-free if each thread acquires its mutexes in order.
  • It releases them in reverse order and given a total ordering for all mutexes.
  • The mutex should be achieved in order to ensure deadlock free scheme.

Blurred answer
Students have asked these similar questions
THREAD -"C LANGUAGE" ONLY   Write a program that uses 5 threads. Initialize a shared variable with a value of 0. Each thread must add its Thread ID (tid) to the shared variable. Once a thread has done the addition, print the ID of the thread. It is important to make use of mutexes so that only one thread is incrementing the shared variable at a time. Output the value of the shared variable once all threads have finished incrementing it.
Lab 4 Directions Write a C program called threadcircuit to run on ocelot which will provide a multithreaded solution to the circuit-satisfiability problem which will compute for what combinations of input values will the circuit output the value 1. This is the sequential solution, which is also attached. You should create 6 threads and divide the 65,536 test cases among them. For example, if p=6, each thread would be responsible for roughly 65,536/6 number of iterations (if it's not divisible, some threads can end up with one more iteration than the others). The test cases must be allocated in a cyclic fashion one by one. #include <stdio.h>#include <sys/time.h>/* Return 1 if 'i'th bit of 'n' is 1; 0 otherwise */#define EXTRACT_BIT(n,i) ((n&(1<<i))?1:0)int check_circuit (int z) {  int v[16];        /* Each element is a bit of z */  int i;  for (i = 0; i < 16; i++) v[i] = EXTRACT_BIT(z,i);  if ((v[0] || v[1]) && (!v[1] || !v[3]) && (v[2] || v[3])…
The following question is related to Threading   Task-1:  Write a c program that creates 5 threads and prints which thread is running and after the thread is closed, a new thread starts its execution. Each thread should run sequentially one by one.  OUTPUT:  thread-1 running thread-1 closed thread-2 running thread-2 closed
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    Systems Architecture
    Computer Science
    ISBN:9781305080195
    Author:Stephen D. Burd
    Publisher:Cengage Learning
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning