I understand what thrashing is, but after completing an operating systems course at university, I was wondering if it is feasible to intentionally cause a program to thrash, or if today's operating systems are "too smart" to fall for such tricks.
Is it possible to make my application spend more time loading pages than executing code?
Is it feasible to make a program thrash on purpose?
-
- Member
- Posts: 510
- Joined: Wed Mar 09, 2011 3:55 am
Re: Is it feasible to make a program thrash on purpose?
Applications, per-se, do not thrash, because, in general, the application does not have control over which of its pages are loaded or not. *Systems* thrash. If the total set of applications running on the system uses much more memory than the system has installed RAM, and are not designed with good locality of reference (which might not be possible, depending on what the application needs to do), and the system is configured with sufficient swap to fulfill the memory requirements of the various applications, then the system will thrash. To deliberately cause a system to thrash, you don't need to do much more than allocate as much memory as the OS will let you, and then just keep writing to the memory you allocated, with each write going to a completely random location. This assumes, of course, that the system has sufficient swap space. If no swap is configured, or the amount of swap configured is much less than the RAM available, then the system won't thrash no matter what you do.billy91 wrote:I understand what thrashing is, but after completing an operating systems course at university, I was wondering if it is feasible to intentionally cause a program to thrash, or if today's operating systems are "too smart" to fall for such tricks.
Is it possible to make my application spend more time loading pages than executing code?
-
- Posts: 11
- Joined: Sat Jan 06, 2024 2:55 am
- Libera.chat IRC: @freenode-nf1
- Location: India
- Contact:
Re: Is it feasible to make a program thrash on purpose?
It's possible to induce thrashing intentionally by overwhelming virtual memory but modern OS are designed to resist such manipulation.billy91 wrote:I understand what thrashing is, but after completing an operating systems course at university, I was wondering if it is feasible to intentionally cause a program to thrash, or if today's operating systems are "too smart" to fall for such tricks.
Is it possible to make my application spend more time loading pages than executing code?