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
Question
Book Icon
Chapter 12, Problem 12.29HW
Program Plan Intro

Deadlocks:

  • The deadlock denotes a situation where a collection of threads remains blocked.
  • It denotes waiting for a condition that will 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 some execution trajectory reaches deadlock state “d” then no further progress is 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.

Blurred answer
Students have asked these similar questions
#include <pthread.h>#include <stdio.h>#include <unistd.h>#include <stdlib.h> int count = 0; void *threadfunc(void *arg){ cout<<"Thread Complete\n"; count++; return NULL; } int main(){ count = 0; pthread_t A,B,C;pthread_create(&A, NULL, threadfunc, NULL); pthread_create(&B, NULL, threadfunc, NULL); pthread_create(&C, NULL, threadfunc, NULL); while(count<50) {pthread_join(A, NULL); if(count<50) pthread_join(B, NULL); if(count<50) pthread_join(C, NULL); } return 0; }     What is wrong?
For programming tasks, we can use an Array or an Array List.   Describe when using an Array would be a good choice, and Describe when using an Array List would be a better choice. You must start a thread before you can read and reply to other threads
Const N = 50; Var Tally: integer; Procedure Total; Var Count:integer; Begin For Count := 1 to N do Tally := Tally + 1 End; End; Begin (* main program *) Tally := 0; Parabegin Total; Total; Paraend; Write (Tally) End. Compose a thread safe pseudocode version that guarantees the upper and lower bound of the shared variable Tally are the same value after execution.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education