The degree of multiprogramming is the number of processes loaded into primary memory at a given time. A higher degree of multiprogramming allows more processes to compete for CPU time, helping the operating system keep the CPU utilised while other processes are waiting for events such as I/O. The degree of multiprogramming can change over time as the operating system controls the degree of multiprogramming by admitting processes into memory and, in systems that use suspension/swapping, suspending processes and moving their memory contents out of RAM.
Multiprogramming exists to help keep the CPU busy. Suppose the running process requests data from secondary storage. Instead of leaving the CPU idle while the process waits for I/O, the operating system can schedule another process. Increasing the degree of multiprogramming therefore gives the OS more processes to choose from when scheduling CPU work, which can improve CPU utilisation.
However, higher isn't always better. Every process requires memory. If too many processes are kept in memory, there may not be enough physical RAM for their working sets, causing excessive paging/swapping—potentially leading to thrashing. Thrashing is a condition in which the operating system spends an excessive amount of time moving pages between primary memory and secondary storage because there is insufficient physical memory for the active processes. As a result, the system spends more time servicing page faults and paging than performing useful computation.