Does a form timer maintain state during sleep/hibernate? - vb.net

If I have an event that starts a timer with an interval of say, 30 minutes, and 15 minutes later, the computer the app is running on sleeps (Suspend to RAM) or Hibernates (Suspend to Disk), and is brought back online after ten minutes, will the timer raise its Tick event in 5 minutes (30 minutes REAL time from the start) or 15 minutes (30 minutes RUNTIME from the start)?

The timer maintains whatever state it was in before hibernation or suspension. When the system resumes from hibernate/restore, it will resume from where it was before. In other words, the timer will not run while the system is asleep.

Related

Mule 4 - Flow Design Scheduled

I have a problem when the scheduled starts, it has a subsequent process that lasts longer than each interval, that is, every 2 seconds it starts the process, but if it takes 4 seconds to finish, my problem is that I don't know how to prevent the interval from starting. until the last task is completed.
I'd appreciate any help.
Set the max concurrency attribute of the flow to 1.

How to stop simulation run after specific time NOT tick

all.
Regardless of what my model does, I want to stop the simulation after running for a specific time (real clock time). For example, stop after 5 or 10 or 15 minutes. I tried stopping it after 5 minutes using the RunEnvironment.getInstance()endAt(double tick) as follows:
RunEnvironment.getInstance()endAt(5000)
It stops at 4 minutes, 44 seconds. I came across this answer, but it seems not what I am looking for (I may be wrong). Is there a better way to achieve this? I am very new to RePast and somehow confused about the tick concept.
Thank you.
Here's a quote from a recent paper re. the tick concept that might help.
Events in Repast simulations are driven by a discrete-event scheduler. These events themselves are scheduled to occur at a particular tick. Ticks do not necessarily represent clock-time but rather the priority of its associated event. Ticks determine the order in which events occur with respect to each other. For example, if event A is scheduled at tick 3 and event B at tick 6, event A will occur before event B. Assuming nothing is scheduled at the intervening ticks, A will be immediately followed by B. There is no inherent notion of B occurring after a duration of 3 ticks. Of course, ticks can and are often given some temporal significance through the model implementation. A traffic simulation, for example, may move the traffic forward the equivalent of 30 seconds for each tick.
If you want to schedule a stop after some amount of walltime (e.g., 5 minutes) has elapsed, you could schedule an action that gets the time at its first invocation and then subsequently checks if the correct amount of time has elapsed. At that point, you could call RunEnvironment.getInstance().endRun(). How to do the time arithmetic is a Java question, so if you google for "Java time elapsed" or something like that you should get an answer.
As far as scheduling the action, you need to create a class that implements IAction (https://repast.github.io/docs/api/repast_simphony/repast/simphony/engine/schedule/IAction.html) and schedule that at whatever interval seems appropriate.

Camunda Timer event unexpected delay in timing

I have a process in which I have used a timer event. The timer event is of type
Duration and has wait time of 30 minutes(PT30M). This timer event is expected to end exactly after 30 minutes, but it takes additional 15 or 30 seconds.
This behavior is observed and the delay is exactly 15 or 30 seconds every time even if I change (increase or decrease) the duration of timer event. I would like to know why does it take 15 seconds extra then required to execute.
A timer in a BPMN process is persisted as a job in Camunda. The job executor component repeatedly polls the job table for any jobs that are due. In case there are no due jobs, the polling applies exponential backoff, by default sleeping up to 60 seconds between polling attempts. So if your system has little load, this kind of delay is to be expected. You can use the job executor configuration property maxWait to change the maximum sleeping period.
Relevant documentation:
Job executor in general: https://docs.camunda.org/manual/7.10/user-guide/process-engine/the-job-executor/#job-executor-activation
Job executor configuration properties: https://docs.camunda.org/manual/7.10/reference/deployment-descriptors/tags/job-executor/

Can a WinRT background task be long-lived if within CPU and Network limits?

Microsoft's documentation states:
Background tasks are meant to be short-lived tasks that do not consume a lot of resources.
It also says:
Each app on the lock screen receives 2 seconds of CPU time every 15 minutes, which can be used by all of the background tasks of the app. At the end of 15 minutes, each app on the lock screen receives another 2 seconds of CPU time for use by its background tasks.
I need to run a background task every two minutes to update my live-tile.
My app is a lock-screen-app.
Computation is within the CPU and network usage constraints
Can I create a permanent background task (e.g. something which polls a web service and pulls information, waits and loops) to create a OneShot TimeTrigger every two minutes or is there a better way of doing this?
My concern with the background task option is whether the runtime would deem the task inactive while it was sleeping and close it or something else like there's a limit on the number of times a live tile can be updated within 15 minutes...
Yes, if by long lived you mean under 25 minutes.
Time triggers cannot execute more frequent than 15 minutes. Creating a OneShot trigger that executes in 2 minutes is, that's an interesting idea and should work. Yes, background tasks can register other background tasks to keep this chain going. Should the user's machine be off when it execs it will queue later.
Having said that, updating your tile that frequently & using a background task is not a wise solution. Because, it is unreliable. Background tasks can be disabled, for one. But every 15 minutes, you are going to exceed your quota. Try using a Scheduled tile instead.

How to fix major lag in NSTimers?

In a fairly simple application that I am making, I use many NSTimers, one which runs at a rate of .01 seconds that I use to change the position of multiple images. This causes major lag. How can I fix this? Please explain in detail, as I am fairly new to app dev.
From the NSTimer Docs (emphasis: mine):
A timer is not a real-time mechanism; it fires only when one of the
run loop modes to which the timer has been added is running and able
to check if the timer’s firing time has passed. Because of the various
input sources a typical run loop manages, the effective resolution of
the time interval for a timer is limited to on the order of 50-100
milliseconds. If a timer’s firing time occurs during a long callout or
while the run loop is in a mode that is not monitoring the timer, the
timer does not fire until the next time the run loop checks the timer.
Therefore, the actual time at which the timer fires potentially can be
a significant period of time after the scheduled firing time.
If you want to work at the display frequency, see CADisplayLink.
However, you should first understand where you program spends its time now to understand what makes it slow (profiler).