[Solved] what does this shellscript do? [closed]


This script

  • deactivates swap
  • obtains the amount of RAM in bytes
  • mounts a ramdisk equal to available RAM
  • writes zeros to the ramdisk via dd
  • Attempts to set the dd process to be first on the chopping block for the Out Of Memory killer
  • prints the process ID of dd and its current status for as long as it keeps running

I say “attempts” because it should be writing to oom_adj and not oomadj, at least for recent kernels, and because the max value is 15 and not 17.

There’s also a bug here, because it will print the PID and status for all executing dd, not just the one in the script.

As the comment says, eventually the kernel Out Of Memory killer will kill the process.

I’m pretty sure it’s a silly thing to do. I don’t know of a reason why you would actually need to zero memory this way.

2

solved what does this shellscript do? [closed]