Q111: How can priority inversion be handled?

You can checkout question #108 to know what is priority inversion.

Question #111: How can priority inversion be handled?

Options:

  1. By raising the priority of the blocked process.
  2. By lowering the priority of the blocked process.
  3. By raising the priority of the lower priority process for which higher priority process is waiting.
  4. Both 2 and 3.

Solution: The correct answer is 4th one. If we let lower priority process run by temporarily raising its priority, it will release the semaphore quickly. This is called priority inheritance. This might be needed at various steps in the chain and not just once.

Q108: Priority Inversion

Question #108: Priority inversion refers to:

Options:

  1. Inverting the priority of the processes.
  2. A higher priority process blocked on a lower priority process.
  3. A lower priority process blocked on a higher priority process.
  4. Considering the priority in a reverse manner.

Solution: The correct answer is 2nd one. An example of this is when a lower priority process has acquired a semaphore and a higher priority process needs to acquire that semaphore. Hence, it needs to wait for a lower priority process to release the semaphore first.

Q34: Context free grammar contd.

This question is in continuation of the previous questions 29 and 30

Question #34: If we remove production 4 in the grammar mentioned in 29 , which of the following will be hampered?

A)     Production 4 is used to enforce priority, e.g. in the string 6 + 7 * 8, if we want to perform the addition first, we must use brackets in this way (6 + 7) * 8.

B)      Production 4 is used to enforce priority, e.g. in the string 6 + 7 * 8, if we want to perform the multiplication first, we must use brackets in this way 6 + (7 * 8).

C)      Production 4 is present in above grammar because it makes the strings non-ambiguous, they don’t add any power to the language.

D)     None of the above.

 

Solution:

Multiplication anyways has higher priority than addition operator, brackets are required in cases where we want to reverse the priority. Hence, the correct answer is A