0% found this document useful (0 votes)
19 views53 pages

PT Platech

assignment
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views53 pages

PT Platech

assignment
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 53

Describe the deadlock

scenario illustrated above


based on your
understanding.
The situation described
shows a deadlock
involving processes P and
Q,
and resources A and B
that they share. Using a
grid and arrows, it
demonstrates how
these processes
interact. Deadlock is
a problem
when both processes
fight for the same
resource or want
different
resources. This can
happen due to
circular waiting,
holding onto
resources, or the lack
of resource release.
The idea of a
"deadlock
inevitable region"
signifies a state where no
process can move
forward
without outside help. In
this case, it's crucial to
use specific algorithms
to prevent or solve
deadlock situations in
real systems.
2. What do you think
would happen if both
Process P and Q need to
get the same resource?
Imagine a situation
where both Process P
and Process Q want
the
same resource. They
both ask for it at
the same time,
creating a
competition. The system
gives the resource to one
process, making the
other wait. The waiting
process does nothing,
hoping the other process
will give back the
resource. If the waiting
process also has a
resource
the other one needs,
they might end up stuck
waiting for each other.
This situation leads to a
deadlock, where both
processes stop working
and can't move forward
without help from outside
or forcibly taking back
the resources. To avoid
these problems in real
systems, methods and
plans are used to make
sure resources are
shared fairly and to
handle
deadlocks effectively.
3. Which concurrency
mechanism would you
suggest that might
prevent the deadlock
situation above?
Rationalize your answer.
To prevent the described
deadlock situation, using
"Mutex Locks" can
be a good method. Mutex
locks ensure that only
one process can use a
resource at a time.
Processes must get
these locks before
using
resources, which stops
the "hold and wait"
situation. Unlike taking
resources away from
processes, mutex locks
handle resource sharing
well, avoiding deadlock
without making things
overly complicated. Many
systems use this method
because it's widely
understood. Mutexes are
crucial in programming
because they ensure
only one part of the
program can be used by
one process at a time,
stopping issues like
data conflicts.
However, they have
problems too, like the
chance of
processes getting stuck if
they can't get the lock, or
using a lot of CPU
Describe the deadlock
scenario illustrated above
based on your
understanding.
The situation described
shows a deadlock
involving processes P and
Q,
and resources A and B
that they share. Using a
grid and arrows, it
demonstrates how
these processes
interact. Deadlock is
a problem
when both processes
fight for the same
resource or want
different
resources. This can
happen due to
circular waiting,
holding onto
resources, or the lack
of resource release.
The idea of a
"deadlock
inevitable region"
signifies a state where no
process can move
forward
without outside help. In
this case, it's crucial to
use specific algorithms
to prevent or solve
deadlock situations in
real systems.
2. What do you think
would happen if both
Process P and Q need to
get the same resource?
Imagine a situation
where both Process P
and Process Q want
the
same resource. They
both ask for it at
the same time,
creating a
competition. The system
gives the resource to one
process, making the
other wait. The waiting
process does nothing,
hoping the other process
will give back the
resource. If the waiting
process also has a
resource
the other one needs,
they might end up stuck
waiting for each other.
This situation leads to a
deadlock, where both
processes stop working
and can't move forward
without help from outside
or forcibly taking back
the resources. To avoid
these problems in real
systems, methods and
plans are used to make
sure resources are
shared fairly and to
handle
deadlocks effectively.
3. Which concurrency
mechanism would you
suggest that might
prevent the deadlock
situation above?
Rationalize your answer.
To prevent the described
deadlock situation, using
"Mutex Locks" can
be a good method. Mutex
locks ensure that only
one process can use a
resource at a time.
Processes must get
these locks before
using
resources, which stops
the "hold and wait"
situation. Unlike taking
resources away from
processes, mutex locks
handle resource sharing
well, avoiding deadlock
without making things
overly complicated. Many
systems use this method
because it's widely
understood. Mutexes are
crucial in programming
because they ensure
only one part of the
program can be used by
one process at a time,
stopping issues like
data conflicts.
However, they have
problems too, like the
chance of
processes getting stuck if
they can't get the lock, or
using a lot of CPU
Describe the deadlock
scenario illustrated above
based on your
understanding.
The situation described
shows a deadlock
involving processes P and
Q,
and resources A and B
that they share. Using a
grid and arrows, it
demonstrates how
these processes
interact. Deadlock is
a problem
when both processes
fight for the same
resource or want
different
resources. This can
happen due to
circular waiting,
holding onto
resources, or the lack
of resource release.
The idea of a
"deadlock
inevitable region"
signifies a state where no
process can move
forward
without outside help. In
this case, it's crucial to
use specific algorithms
to prevent or solve
deadlock situations in
real systems.
2. What do you think
would happen if both
Process P and Q need to
get the same resource?
Imagine a situation
where both Process P
and Process Q want
the
same resource. They
both ask for it at
the same time,
creating a
competition. The system
gives the resource to one
process, making the
other wait. The waiting
process does nothing,
hoping the other process
will give back the
resource. If the waiting
process also has a
resource
the other one needs,
they might end up stuck
waiting for each other.
This situation leads to a
deadlock, where both
processes stop working
and can't move forward
without help from outside
or forcibly taking back
the resources. To avoid
these problems in real
systems, methods and
plans are used to make
sure resources are
shared fairly and to
handle
deadlocks effectively.
3. Which concurrency
mechanism would you
suggest that might
prevent the deadlock
situation above?
Rationalize your answer.
To prevent the described
deadlock situation, using
"Mutex Locks" can
be a good method. Mutex
locks ensure that only
one process can use a
resource at a time.
Processes must get
these locks before
using
resources, which stops
the "hold and wait"
situation. Unlike taking
resources away from
processes, mutex locks
handle resource sharing
well, avoiding deadlock
without making things
overly complicated. Many
systems use this method
because it's widely
understood. Mutexes are
crucial in programming
because they ensure
only one part of the
program can be used by
one process at a time,
stopping issues like
data conflicts.
However, they have
problems too, like the
chance of
processes getting stuck if
they can't get the lock, or
using a lot of CPU
Describe the deadlock
scenario illustrated above
based on your
understanding.
The situation described
shows a deadlock
involving processes P and
Q,
and resources A and B
that they share. Using a
grid and arrows, it
demonstrates how
these processes
interact. Deadlock is
a problem
when both processes
fight for the same
resource or want
different
resources. This can
happen due to
circular waiting,
holding onto
resources, or the lack
of resource release.
The idea of a
"deadlock
inevitable region"
signifies a state where no
process can move
forward
without outside help. In
this case, it's crucial to
use specific algorithms
to prevent or solve
deadlock situations in
real systems.
2. What do you think
would happen if both
Process P and Q need to
get the same resource?
Imagine a situation
where both Process P
and Process Q want
the
same resource. They
both ask for it at
the same time,
creating a
competition. The system
gives the resource to one
process, making the
other wait. The waiting
process does nothing,
hoping the other process
will give back the
resource. If the waiting
process also has a
resource
the other one needs,
they might end up stuck
waiting for each other.
This situation leads to a
deadlock, where both
processes stop working
and can't move forward
without help from outside
or forcibly taking back
the resources. To avoid
these problems in real
systems, methods and
plans are used to make
sure resources are
shared fairly and to
handle
deadlocks effectively.
3. Which concurrency
mechanism would you
suggest that might
prevent the deadlock
situation above?
Rationalize your answer.
To prevent the described
deadlock situation, using
"Mutex Locks" can
be a good method. Mutex
locks ensure that only
one process can use a
resource at a time.
Processes must get
these locks before
using
resources, which stops
the "hold and wait"
situation. Unlike taking
resources away from
processes, mutex locks
handle resource sharing
well, avoiding deadlock
without making things
overly complicated. Many
systems use this method
because it's widely
understood. Mutexes are
crucial in programming
because they ensure
only one part of the
program can be used by
one process at a time,
stopping issues like
data conflicts.
However, they have
problems too, like the
chance of
processes getting stuck if
they can't get the lock, or
using a lot of CPU
Describe the deadlock
scenario illustrated above
based on your
understanding.
The situation described
shows a deadlock
involving processes P and
Q,
and resources A and B
that they share. Using a
grid and arrows, it
demonstrates how
these processes
interact. Deadlock is
a problem
when both processes
fight for the same
resource or want
different
resources. This can
happen due to
circular waiting,
holding onto
resources, or the lack
of resource release.
The idea of a
"deadlock
inevitable region"
signifies a state where no
process can move
forward
without outside help. In
this case, it's crucial to
use specific algorithms
to prevent or solve
deadlock situations in
real systems.
2. What do you think
would happen if both
Process P and Q need to
get the same resource?
Imagine a situation
where both Process P
and Process Q want
the
same resource. They
both ask for it at
the same time,
creating a
competition. The system
gives the resource to one
process, making the
other wait. The waiting
process does nothing,
hoping the other process
will give back the
resource. If the waiting
process also has a
resource
the other one needs,
they might end up stuck
waiting for each other.
This situation leads to a
deadlock, where both
processes stop working
and can't move forward
without help from outside
or forcibly taking back
the resources. To avoid
these problems in real
systems, methods and
plans are used to make
sure resources are
shared fairly and to
handle
deadlocks effectively.
3. Which concurrency
mechanism would you
suggest that might
prevent the deadlock
situation above?
Rationalize your answer.
To prevent the described
deadlock situation, using
"Mutex Locks" can
be a good method. Mutex
locks ensure that only
one process can use a
resource at a time.
Processes must get
these locks before
using
resources, which stops
the "hold and wait"
situation. Unlike taking
resources away from
processes, mutex locks
handle resource sharing
well, avoiding deadlock
without making things
overly complicated. Many
systems use this method
because it's widely
understood. Mutexes are
crucial in programming
because they ensure
only one part of the
program can be used by
one process at a time,
stopping issues like
data conflicts.
However, they have
problems too, like the
chance of
processes getting stuck if
they can't get the lock, or
using a lot of CPU
Describe the deadlock
scenario illustrated above
based on your
understanding.
The situation described
shows a deadlock
involving processes P and
Q,
and resources A and B
that they share. Using a
grid and arrows, it
demonstrates how
these processes
interact. Deadlock is
a problem
when both processes
fight for the same
resource or want
different
resources. This can
happen due to
circular waiting,
holding onto
resources, or the lack
of resource release.
The idea of a
"deadlock
inevitable region"
signifies a state where no
process can move
forward
without outside help. In
this case, it's crucial to
use specific algorithms
to prevent or solve
deadlock situations in
real systems.
2. What do you think
would happen if both
Process P and Q need to
get the same resource?
Imagine a situation
where both Process P
and Process Q want
the
same resource. They
both ask for it at
the same time,
creating a
competition. The system
gives the resource to one
process, making the
other wait. The waiting
process does nothing,
hoping the other process
will give back the
resource. If the waiting
process also has a
resource
the other one needs,
they might end up stuck
waiting for each other.
This situation leads to a
deadlock, where both
processes stop working
and can't move forward
without help from outside
or forcibly taking back
the resources. To avoid
these problems in real
systems, methods and
plans are used to make
sure resources are
shared fairly and to
handle
deadlocks effectively.
3. Which concurrency
mechanism would you
suggest that might
prevent the deadlock
situation above?
Rationalize your answer.
To prevent the described
deadlock situation, using
"Mutex Locks" can
be a good method. Mutex
locks ensure that only
one process can use a
resource at a time.
Processes must get
these locks before
using
resources, which stops
the "hold and wait"
situation. Unlike taking
resources away from
processes, mutex locks
handle resource sharing
well, avoiding deadlock
without making things
overly complicated. Many
systems use this method
because it's widely
understood. Mutexes are
crucial in programming
because they ensure
only one part of the
program can be used by
one process at a time,
stopping issues like
data conflicts.
However, they have
problems too, like the
chance of
Hatulan, Jean Ray Lyndon B

BSIT - 303
processes getting stuck if they can't get the lock, or using a lot.This is the example of
No Deadlocks so that if we compare the image above and to this illustration thenumber 3 and 4
are not in the deadlock position

2.
What do you think would happen if both Process P and Q
need to get the same resource? (5p o i n t s )
It causes deadlock which both processes cannot progress, and the resources will be destroyed
orconsume after it produce. The categories of this resource fall under the consumable
resources.
3.
Which concurrency mechanism would you suggest that
m i g h t p r e v e n t t h e d e a d l o c k s i t u a t i o n above? Rationalize
your answer. (5 points)
I think the hold and wait, like for example the Process P need to hold at least one resourcesuntil the other process
done or release.
4.
Define in detail the Execution Paths 2 to 6. (5 items x 3
points)Example: Execution Path 1

Process Q acquires Resource B and then Resource A.Process
Q then releases Resource B and A, respectively.
1. Q acquires B and then A and then releases B and A. When P resumes execution, it will
be ableto acquire both resources.
2. Q acquires B and then A. P executes and blocks on a request for A. Q releases B and
A.WhenP resumes execution, it will be able to acquire both resources.
3. Q acquires B and then P acquires A. Deadlock is inevitable, because as execution
proceeds, Qwill block on A and P will block on B.
4. P acquires A and then Q acquires B. Deadlock is inevitable, because as execution proceeds,
Qwill block on A and P will block on B.
5. P acquires A and then B. Q executes and blocks on a request for B. P releases A and
B.WhenQ resumes execution, it will be able to acquire both resources.
6. P acquires A and then B and then releases A and B. When Q resumes execution, it will be
ableto acquire both resources

5.
Do Execution Paths 3 and 4 encompass the first
three conditions for a deadlock to occur?Explain your
answer. (5 points)
Yes, the deadlock occurs in the path 3 and 4 because their execution has on the same block so
that itshard to progress both two.
6.
If you are to implement deadlock prevention before the processes
above reach the criticalsection, would it be an indirect method or a
direct method? Why? (5 points)
I would implement or choose the indirect method because it is more flexible than direct
method.Because the direct method possible there are only one condition which is the circular
wait, but in theindirect there are 3 conditions like the mutual exclusion, hold and wait, and No
preemption.
7.
Which deadlock avoidance approach would you suggest for
the given situation above and why?(5 points)
The deadlock avoidance approach that I would suggest in the situation is the resource allocation
denialthis is good for me because it does not grant any other request to process if the allocation
of theresources might lead to deadlock.
8.
Would you agree that deadlock is relative to the number of
processes and available resourcesin an operating system?
Why or why not? (5 points)
Yes, because all the deadlocks involve different resources and processes also. So that it
involvesconflicting resource.
9.
If you are asked to reconstruct the progress diagram above
to eliminate the critical section, whichis the deadlock-
inevitable region, which aspect(s) or area(s) would you
modify? Explain how themodification eliminates the
deadlock. (5 points)
If I reconstruct the progress diagram I would modify the fatal region of the diagram which is
which is inthe gray shaded area, For instance, if P doesn't require simultaneously using both
resources so thatthe two processes take the following form
asdwa

You might also like