How is thrashing prevented?

There are 2 ways to prevent thrashing -
1. We must decrease the degree of multiprogramming to prevent thrashing.
2. We must provide a process as many frames as it needs.