Você está na página 1de 3

Resource allocation graph

The deadlock conditions can be modeled using a directed graph


called
a resource-allocation graph (RAG)
2 kinds of nodes:
Boxes — represent resources
• Instances of the resource are represented as dots within
the box
Circles — represent threads / processes
2 kinds of (directed) edges:
Request edge — from thread to resource — indicates the
thread has requested the resource, and is waiting to acquire it
Assignment edge — from resource instance to thread —
indicates the thread is holding the resource instance
When a request is made, a request edge is added
When request is fulfilled, the request edge is transformed into
an assignment edge
When thread releases the resource, the assignment edge is
deleted

Wait-for graph
From Wikipedia, the free encyclopedia

A Wait-For Graph in computer science is a directed graph used for deadlock detection in operating


systems and relational database systems.

In Computer Science, a system that allows concurrent operation of multiple processes and locking of
resources and which does not provide mechanisms to avoid or prevent deadlock must support a
mechanism to detect deadlocks and an algorithm for recovering from them.
One such deadlock detection algorithm makes use of a Wait-For Graph to track which other
processes a process is currently blocking on. In a Wait-for Graph, processes are represented as
nodes, and an edge from process Pi to Pj implies Pj is holding a resource that Pi needs and
thus Pi is waiting for Pj to release its lock on that resource. A deadlock exists if the graph contains
any cycles.

What are the logical clocks?


Possible answers Correct?
are clocks which are synchronized relatively to each
other yes
which must not deviate from the real time by more than
a certain amount no
assign sequence numbers to messages yes
assume no central time source yes
assume central time source no

What are the physical clocks?


Possible answers Correct?
are clocks which are synchronized relatively to each
other no
which must not deviate from the real time by more than
a certain amount yes
assign sequence numbers to messages no
assume no central time source no
assume central time source yes
application of logical clock

A logical clock is a mechanism for capturing chronological and causal relationships in a distributed
system.

Logical clock algorithms of note are:

 Lamport timestamps, which are monotonically increasing software counters.


 Vector clocks, that allow for total ordering of events in a distributed system.
 Version vectors, order replicas, according to updates, in an optimistic replicated system.
 Matrix clocks, an extension of vector clocks that also contains information about other
processes' views of the system.

Você também pode gostar