Answer the question
In order to leave comments, you need to log in
How to implement automatic termination of a process that is heavily CPU intensive?
I have several php scripts that need to be pulled every minute, but it happens that the script does not have time to execute, but cron pulls it again, apparently because of this there was such a trouble: I
went to pu, and there
I went to htop, there 3 processes are already running 7 hours and load the 4-core processor under 100%, while the RAM is occupied by 1GB out of 7. I killed these processes and the load dropped to 13%.
Is it possible to make it so that if some script generates a load of more than 40-50% on the processor, then it would automatically terminate?
ps: I understand that I described the question at random, but suddenly someone will understand) Thanks in advance!
Answer the question
In order to leave comments, you need to log in
Set yourself a normal environment with a normal compiler. VS is simply trying to tie the user to itself, imposing its "safe" functions that are only in it.
All the same, I think that the correct answer should sound :). The Microsoft plus compiler compiles under .Net, i.e. to bytecode for a virtual machine (CLR) with a garbage collector. Naturally, direct memory manipulations from the program become undesirable. Therefore, if you want to learn real pluses (with pointers), you should use another compiler, such as MinGW (Windows), GCC (Linux), Clang (OS X).
В идеале должен быть запущен только один инстанс?
Если да, то может стоит задуматься о том, чтобы проверять на выполнение предыдущего, прежде чем запускать новый.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question