For those of you not born in the Elizabethan Era you may be surprised to learn that the norm back in the ‘days of old’ were crowds of folks using a shared computer server. If you had administration rights, you could horde the server resources and divvy out the scraps to the serfs but you’d need to prepare for a revolt from the sun-deprived masses.
I recall one of our professors had a long-running (weeks, if not months) simulation that he ran on the server. It ate up memory and cpu resources like cookie monster in a room full of Oreos. Rather than disrupt the masses, he scheduled it to run in the wee hours and paused it during peak hours. How he did it always elluded me, but I’ve recently found a means to do just that, unclear if it’s particularly how he did it.
Most all of your are somewhat familiar with the ‘kill’ command. ‘kill -9 -1’ kills all of your processes, ‘kill -9 [pid]’ more typically used to kill a particular process. You supply a kill signal, and this specifically allows you to pause and resume a process as you wish.
‘kill –STOP [pid]’ will suspend a process, ‘kill –CONT [pid]’ will resume it. Slap this pair in a crontab and you could suspend/resume a particular process based on time/day/…
$ kill -STOP [pid]
This will pause the specified process, allocated memory will be transferred to disk during this hiatus, freeing it up for current users.
$ kill -CONT [pid]
Following with this command later in the day will resume the process, letting it pick up where it left off. A four-day process can be turned on/off over the course of the month, making use of idle time to run without disrupting current users.
Cheers.
No comments:
Post a Comment