answersLogoWhite

0

Resource-Request Algorithm for Process

Updated: 9/15/2023
User Avatar

Evilpolice119

Lvl 1
14y ago

Best Answer

Let Request i be the request vector for process Pi. If Request [i, j] = k, then process Pi wants k instances of resource type Rj. When a request for resources is made by process Pi, the following actions are taken: 1. If Request i < Need i, go to step 2. Otherwise, raise an error condition, since the process has exceeded its maximum claim. 2. If Request i  Available, go to step 3. Otherwise, Pi must wait, since the resources are not available. 3. Have the system pretend to have allocated the requested resources to process Pj by modifying the state as follows: Available: = Available – Request i; Allocation i := Allocation + Request i; Need i := Need i – Request i; If the resulting Resource-allocation State is safe, the transaction is completed and process Pi is allocated its resources. However, if the new state is unsafe, then Pi must wait for Request i and the old resource-allocation state is restored.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Resource-Request Algorithm for Process
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What does the word algorithm mean today?

An algorithm is the process by which you solve a problem


What kind of process algorithm is used in mac os x?

scheduling algorithm


What is algorithm in c?

Algorithm is a step by step process to solve a particular task.


Any mathematical process?

Any mathematical process is an algorithm.


What is algorithams?

Algarithm: Algorithm is process to solve the problem in a step by step order Algorithm is used to write the program in a computer language. thrinath.sachin@gmail.com


An algorithm describes a process that ends with a solution to a problem?

i put true


What is the sequential step by step process which a computer uses to perform computations?

Algorithm


Are algorithms only meant for computers?

No. Indeed, algorithms are actually meant for humans, not computers. Computer programmers translate algorithms into working code such that a computer can process the algorithm. The code is actually the implementation of the algorithm, not the algorithm itself.


What are the deadlock detection algorithms?

Deadlock is a scenario where two or more processes are blocked, each waiting for the other to release the necessary resources to complete their execution. This situation can cause the entire system to become unresponsive, leading to reduced performance and potentially crashing the system. To avoid this, it is essential to have an effective deadlock detection algorithm in place. Several deadlock detection algorithms are used in modern computer systems. These algorithms use different approaches to detect deadlocks, and each algorithm has its strengths and weaknesses. Wait-for Graph Algorithm: The wait-for graph algorithm is a commonly used deadlock detection algorithm. In this algorithm, a directed graph is created, where the nodes represent the processes, and the edges represent the resources they are waiting for. The algorithm checks if there is a cycle in the graph. If there is a cycle, there is a deadlock in the system. The wait-for-graph algorithm has a few limitations. It can only detect deadlocks and does not provide any mechanism to recover from them. Also, the algorithm may only work well in large systems with a few resources. Resource Allocation Graph Algorithm: The resource allocation graph algorithm is another widely used deadlock detection algorithm. This algorithm creates a graph where the nodes represent the processes and the resources they hold or need. The algorithm checks for cycles in the graph. If there is a cycle, there is a deadlock in the system. The resource allocation graph algorithm is easy to implement and provides an efficient way to detect deadlocks. However, the algorithm requires considerable memory to store the graph, and it can be slow in large systems. Banker's Algorithm: The Banker's algorithm is a resource allocation and deadlock avoidance algorithm. In this algorithm, each process is given a maximum limit on the number of resources it can use. The algorithm checks if granting the requested resources will result in a safe state or not. If the state is safe, the resources are allocated to the process. If the condition is unsafe, the process is put on hold. The Banker's algorithm is an efficient way to prevent deadlocks. However, it requires considerable overhead to maintain the system's state, and it may only work well in systems with a few resources. Ostrich Algorithm: The Ostrich algorithm is a dynamic deadlock detection algorithm. This algorithm assumes a process is deadlocked if it does not progress for a specified period. The algorithm periodically checks the progress of each method and detects if any process is deadlocked. The Ostrich algorithm is efficient in detecting deadlocks in dynamic systems. However, it may not work well in systems where the processes are short-lived, and the algorithm may not detect deadlocks that occur over a short period. Timeout-based Algorithm: The timeout-based algorithm is another dynamic deadlock detection algorithm. This algorithm sets a timer for each resource request made by a process. If the requested resource is not allocated within the specified time, the process is assumed to be deadlocked. The timeout-based algorithm is an efficient way to detect deadlocks in dynamic systems. However, the algorithm may not work well in systems where the processes are short-lived, and it may produce false positives if the time-out period is too short.


What is writing Code?

Writing code is the process of implementing an algorithm in a specific programming language.


1 equals n how to find answer n equals 100?

You cannot, unless n is a counter in a program or algorithm for a looping process. In that case, you need to know what the algorithm is doing.


What do you mean by scheduling algorithm in OS?

its the algorithm that tells the os what to process next.goes according to :shortest job firstshortest remaining time firstround robin- first in first out system