Why the startup of a new application causes system stuttering
Then sound from VLC player starts stuttering
You've only provided one example of "stuttering", and it's not the system that stutters, but an application program that is sensitive to I/O latency. In a nutshell, your system has hit a limit for its I/O bandwidth.
So, each running app would get a certain amount of time slice from cpu for their operation(depending on their demand)
Maybe, or maybe not.
The OS scheduler may use timeslices to allocate CPU time for each process, or a prioritized preemptive scheme may be utilized. Or if cooperative scheduling is used, a process may be allowed to hog the CPU until it relinquishes control. A "modern operating system" will offer system and application programmers many options to tailor scheduling.
But let's assume a round-robin timeslicing scheduling is used in your example. The VLC player should be categorized as an I/O-intensive program, as opposed to a CPU-intensive. Essentially the VLC player is repeatedly
- reading data (from a disk file)
- writing the data (to the audio device)
The VLC player does not utilize its time slice for intensive computations, but mostly to perform an input or output operation, and is then suspended until that I/O operation completes. Depending on the OS scheduler, the unused portion of the timeslice might be credited back to the process for an extra long timeslice the next go-around, or the process loses it, or the process gets to jump to the head of the ready queue as soon as the I/O completes. What happens exactly will depend on how the OS scheduler is implemented. For instance, the Linux kernel can be built to use one of several schedulers, each with different "fairness" characteristics for different types of processes.
Then when you start NetBeans, you initiate a flurry of disk reads to locate and load application code and shared libraries. Most likely this additional disk activity is intermixed with the VLC player requests, and causing each read for VLC to take longer than the acceptable latency, so the audio device is starved for data and hence the audible "stuttering".
Unfortunately schedulers tend to focus on allocating CPU resources, and have difficulty (or avoid dealing) with unpredictable I/O issues. You could try a faster disk drive, and/or locating the audio file on a drive different from the OS + programs drive.
Your issue is related to realtime and near-realtime systems, which deal with reliable and quick/predictable responses to events. Playback of video and audio do not tolerate variable I/O latency, and have some characteristics of near-realtime systems. Players should incorporate techniques used in near-realtime systems if the OS has capabilities such as process priorities.
Networking has been responsive to handling low-latency traffic versus ordinary traffic, since it had to solve this issue for VoIP. Something similar is needed for mass storage systems.