What is preemption in an RTOS, and why is it essential for real-time behaviour?
Preemption is the scheduler's ability to suspend a running task at any moment so that a higher-priority task that has become ready can run immediately.
Without preemption, a task keeps the processor until it decides to give it up. If a low-priority task is in the middle of a long computation when an urgent event arrives, the urgent work waits, and the waiting time depends on what the low-priority task happens to be doing. That is exactly the unpredictability an RTOS exists to remove.
With preemption, the moment a high-priority task becomes ready (because an interrupt delivered data or its timer expired) the scheduler saves the running task's context (its registers and stack pointer), switches to the high-priority task, and later resumes the interrupted task exactly where it stopped. The worst-case response time of the urgent task no longer depends on the other tasks' code.
The price is that tasks can be interrupted anywhere, including in the middle of updating shared data. That is why an RTOS with preemption must also provide synchronisation tools such as mutexes and semaphores.
Tip: preemption buys responsiveness and costs you the need to protect shared data.
Go deeper:
Wikipedia — Preemption (computing) — preemptive vs cooperative multitasking, and context switching.