This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Resident scripts
#1
Hi,

This is probably a silly question, but I want to understand the use case of resident scripts...

The LM manual states: "Resident scripts are executed infinite amount of times. Scripts are put into inactive state after each call and are resumed after delay timer expires."

I am trying to understand when to use a resident script. At the moment I have event-based scripts and scheduled scripts.

What is the difference between a scheduled script that runs every 5 minutes and a resident script with a sleep interval of 5 minutes (apart from the fact that the scheduled script will run at specific times)?

Many examples on the forum have resident scripts with a delay of 0. If these scripts run infinitely, don't they put a heavy load on the system?

Thanks!
Reply
#2
Resident script sleep time cannot be larger than 60 seconds. There's no point in using large delays because sleeping scripts still consume system memory. Resident scripts should be used for tasks like socket clients and servers, serial port data exchange etc.

Most examples use functions that suspend script until some data arrives or a timeout happens. This does not produce heavy system load.
Reply


Forum Jump: