Resident scripts - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Resident scripts (/showthread.php?tid=2701) |
Resident scripts - baggins - 26.06.2020 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! RE: Resident scripts - admin - 26.06.2020 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. |