OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Sep 29, 2023 3:54 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Is it feasible to make a program thrash on purpose?
PostPosted: Mon Jun 27, 2022 6:38 am 
Offline

Joined: Mon Jun 27, 2022 6:35 am
Posts: 1
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?


Top
 Profile  
 
 Post subject: Re: Is it feasible to make a program thrash on purpose?
PostPosted: Mon Jul 11, 2022 8:10 pm 
Offline
Member
Member

Joined: Wed Mar 09, 2011 3:55 am
Posts: 507
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?


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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group