Explain the concept of priority inversion in a Real-Time Operating System (RTOS). What mechanisms would you use to prevent or resolve it?