Swapping _ be done when a process has pending I/O, or has to execute I/O operations only into operating system buffers.
Swapping a process with pending I/O or one that is executing I/O operations into operating system buffers is not advisable because:
Inconsistency: If a process is swapped out while waiting for I/O, the I/O completion might occur while the process is not in memory. This can lead to data inconsistency.
Overhead: Continuously swapping processes in and out due to I/O operations can introduce significant overhead, impacting system performance.
To avoid these issues, operating systems typically employ techniques like buffering or double buffering to handle I/O operations without requiring process swapping.