In Windows there’re objects maintained by the system – events, file access handles, windows, timers, etc, that are not unlimited so that all programs in the system can create something like no more than 50k objects (I’m not sure of the exact figure, but it’s not very critical for this question).
So if some program runs for a very long time and creates lots of objects and doesn’t release them (exactly like a memory leak, but here system objects are leaked) the system finally runs out of objects and other programs that try to do something that requires creating any new system objects start getting error indications from system functions. Like for example, program A runs and leaks all objects available to the system and then program B tries to open a file and fails just because the system has no resources to service that request. The only solution at that point is to restart program A so that leaked resources are reclaimed by the system.
Does the same problem exist on Unix/Linux systems or are they somehow protected against that?
They’re subject to the same problems, but can to some degree be hardened/limited. Often by default, there’s limits per process that’s way below anything that would cause systemwide problems. All you have to do is start a lot of processes though. Some of these limits can be viewed by the
ulimitcommand. Some *nixes have the possibility to set limits on a per user basis (see /etc/security/limits.conf on some linux systems)But in cases where you remove the limit, or have a whole lot of processes doing bad stuff, the system wide total limit is usually bound by available resources(memory)
if you want a demonstration of resource limitation, run this command in a bash shell and see if your system is still usable: