Thrashing occurs when a computer's virtual memory resources are overused, leading to a constant state of paging and excessive swapping of data between RAM and disk, severely degrading system performance. It typically happens when the working set of a program exceeds the available physical memory, causing frequent page faults and inefficiencies.