0
$\begingroup$

I have a question regarding the banker's algorithm step 2. When it says the Need[i] <= work. Need is an n * m matrix and work is a vector of length m. I want to know what Need[i] <= Work means. Does it mean that I have to find the vector magnitudes of Need[i] and work and compare them?

$\endgroup$
3
  • 1
    $\begingroup$ Banker's algorithm can be written in many ways. What is step 2 in one pseudocode may be some other step in another, and Need and work could have different names. Please include the version of the algorithm that you're using. $\endgroup$ Commented Apr 12, 2018 at 19:47
  • $\begingroup$ From what I understand, $Need$ can be seen as a collection of $n$,$m$ length vectors. Thus when I say $Need[i]$, I'm talking about the $i$th vector, amongst the $n$ vectors. Since each vector is of length $m$, they're comparable to $Work$. $\endgroup$
    – Mooncrater
    Commented Jun 27, 2018 at 5:48
  • $\begingroup$ Remember that by comparison, here I mean that if $Need[i]>Work$, then all corresponding values of $Need[i]$ are greater than all the corresponding values of $Work$. Or. for $0 \leq j<n$, $Need[i][j]>Work[j]$. $\endgroup$
    – Mooncrater
    Commented Jun 27, 2018 at 5:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.