10 votes
Accepted

Minimum number of processes for the deadlock?

I agree that no deadlock is possible here. If there are three or fewer processes, there clearly cannot be a deadlock because there are enough resources for every process to just hold two resources the ...
David Richerby's user avatar
5 votes
Accepted

Distributing resources for maximum gain

This is a knapsack problem. In the most basic version, you have a single resource (e.g., space in your knapsack) and you're trying to choose which items to put in it so you can carry the greatest ...
David Richerby's user avatar
4 votes
Accepted

Why does garbage collection extend only to memory and not other resource types?

GC deals with a predictable and reserved resource. The VM has total control over it and has total control over what instances are created and when. The keywords here are "reserved" and "total control"....
Marcelo De Zen's user avatar
3 votes

Why does garbage collection extend only to memory and not other resource types?

There are many programming techniques to help manage these kinds of resources. C++ programmers often use a pattern called Resource Acquisition is Initialization, or RAII for short. This pattern ...
D.W.'s user avatar
  • 154k
3 votes

Why does garbage collection extend only to memory and not other resource types?

This appears to be one of the reasons languages with garbage collectors implements finalizers. Finalizers are intended to allow a programmer to clean up an object's resources during garbage ...
Brian Hibbert's user avatar
2 votes

Why does garbage collection extend only to memory and not other resource types?

All memory is equal, if I ask for 1K, I don’t care where in the address space the 1K comes from. When I ask for a file handle, I want a handle to the file I wish to open. Having a file handle open ...
Ian Ringrose's user avatar
2 votes

Best approach to resource allocation problem

Let us first show that your proposed greedy algorithm for the second restriction is not optimal. For this, consider a scenario with $e_1 = 1, e_2 = 3$ and $e_3 = 4$ as well as $d_1 = 1, d_2 = 2$ and $...
Watercrystal's user avatar
  • 1,516
2 votes

NP-hardness of resource allocation problem

If you set $N = 2$, and $r_{i0} = r_{i1} = r_i$ for each $i$, and set $R = \frac12 \sum_{i \in [L]} r_i$, then the feasibility of this linear program is precisely the Partition problem. Namely, a ...
Mees de Vries's user avatar
2 votes
Accepted

How to determine how many dots are in a resource in a resource allocation graph?

The dots represent the number of clients a resource can serve simultaneously. So, in the example in the question, resources $R_1$ and $R_3$ can only serve one client at a time, $R_2$ can serve ...
David Richerby's user avatar
1 vote
Accepted

Best approach to resource allocation problem

The second variant of your problem can be also stated as a Bin covering problem and vice-versa. Let us see how. You can assume $n$ bins of capacities: $(e_{1}+1)$, $\dotsc$, $(e_{n-1}+1)$ and $(e_{n}+...
Inuyasha Yagami's user avatar
1 vote
Accepted

Problem class of assigning N persons to N tasks, zero costs with prefs

This problem is known as maximum matching of a bipartite graph. Basically let vertex $p_i$ (resp., $q_i$) represent the $i$th person (resp., task). And we connect $p_i$ and $q_j$ with an undirected ...
Lwins's user avatar
  • 360
1 vote

Reasoning about resources: "resource logics"?

Just learned about Bunched Logic which seems to fit the bill too.
Lance's user avatar
  • 2,163
1 vote

Reasoning about resources: "resource logics"?

Do you mean a resource-aware logic? If so, yes, there's linear logic [Girard, 1987] (as was already noted in the comments). It has had a big influence on the study of concurrency and implicit ...
fmontesi's user avatar
  • 171
1 vote
Accepted

Portfolio allocation with a few twists

I'd suggest using integer linear programming (ILP). You need to buy an integer number of stocks, so you can use integer variables to represent the amount of each stock you buy. ILP can express ...
D.W.'s user avatar
  • 154k
1 vote

Help interpreting this deadlock question

Introduction Consider a Petri Net model of the three processes. Assume the following: Every resource (A, B, C, D, E, F) has one unit only. All three processes run on a single processor. The ...
John Frederick Chionglo's user avatar
1 vote
Accepted

Help interpreting this deadlock question

Here is one bad scenario: P0 obtains A and B. P1 obtains D and E. P2 obtains C and F. At this point, we have reached deadlock, since P0 is waiting for P2 to release C, P1 is waiting for P0 to ...
Yuval Filmus's user avatar
1 vote

Minimum number of processes for the deadlock?

I would think that even with 5 processes, deadlock isn't possible. If 5 processes each need up to 2 of six identical resources, we could assume that each acquires one resources, and then we have 5 ...
gnasher729's user avatar
  • 27.8k

Only top scored, non community-wiki answers of a minimum length are eligible