How to define task execute every 100 millisecond?
Posted in 2016
Topics: General Discussion
HI,
I need to define a task to execute every 100 millisecond, below are my script ?
INSERT INTO ph_task
(tk_name,
tk_type,
tk_execute,
tk_dbs,
tk_delete,
tk_start_time,
tk_stop_time,
tk_frequency)
VALUES ("upt_timestamp",
"TASK",
"update spdb:t_timestamp set c1=current where 1=1",
"spdb",
Null,
datetime(00:00:00) hour to second,
NULL,
??? -- How to write here?
);
thanks
You cannot do that. The resolution of tk_frequency is only YEAR TO SECOND,
so no sub-second scheduling is possible.
Art
Art S. Kagel, President and Principal Consultant
ASK Database Management
www.askdbmgt.com
Blog: http://informix-myview.blogspot.com/
Disclaimer: Please keep in mind that my own opinions are my own opinions
and do not reflect on the IIUG, nor any other organization with which I am
associated either explicitly, implicitly, or by inference. Neither do
those opinions reflect those of other individuals affiliated with any
entity with which I am affiliated nor those of the entities themselves.
On Thu, Jan 14, 2016 at 8:39 PM, CHUAN LU <luchuan@cn.ibm.com> wrote:
> HI,
> I need to define a task to execute every 100 millisecond, below are my
> script
> ?
> INSERT INTO ph_task
> (tk_name,
> tk_type,
> tk_execute,
> tk_dbs,
> tk_delete,
> tk_start_time,
> tk_stop_time,
> tk_frequency)
> VALUES ("upt_timestamp",>
> "TASK",
>
> "update spdb:t_timestamp set c1=current where 1=1",
>
> "spdb",
>
> Null,
>
> datetime(00:00:00) hour to second,
>
> NULL,
>
> ??? -- How to write here?
> );
> thanks
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--001a113f9a8cbcdc49052955a3cc
You can't - call something once per second to do your task a 100 times, or
write a udr than runs as part of engine start up that does the task on a
continuous loop or ....
Cheers
Paul
Paul Watson
Oninit www.oninit.com
+1 913 387 7529
Oninit® is a Registered Trademark of Oninit LLC
> On Jan 14, 2016, at 19:39, CHUAN LU <luchuan@cn.ibm.com> wrote:
>
> HI,
> I need to define a task to execute every 100 millisecond, below are my script
> ?
> INSERT INTO ph_task
> (tk_name,
> tk_type,
> tk_execute,
> tk_dbs,
> tk_delete,
> tk_start_time,
> tk_stop_time,
> tk_frequency)
> VALUES ("upt_timestamp",>
> "TASK",
>
> "update spdb:t_timestamp set c1=current where 1=1",
>
> "spdb",
>
> Null,
>
> datetime(00:00:00) hour to second,
>
> NULL,
>
> ??? -- How to write here?
> );
> thanks
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
The only way that I can think of to do this would be to create a UDR and do
the task and to have a 100 ms sleep in it using a poll() call. But (and this
is very important), a poll() (or select()) function call is not a function
which is a well behaved function call if run on the CPUVP since it is a
blocking call. That means that it would require that the function execute on a
private VP and not on one of the CPUVPs. This gets rather complicated.
Short of that, you might consider simply using a 'c' program which executes
the function rather than trying to make it a scheduled function inside the
server. This would be easier to accomplish. I'm not sure if you need to run
every 100 ms or if you need to run and then sleep 100 ms before running again.
If the former, then you might need to use posix threading as you might have to
have multiple threads running concurrently. That would be the case if the task
that you need to run takes more than 100 ms to run.
Madison Pruet
Retired from IBM
On Thursday, January 14, 2016 7:39 PM, CHUAN LU <luchuan@cn.ibm.com> wrote:
HI,
I need to define a task to execute every 100 millisecond, below are my script
?
INSERT INTO ph_task
(tk_name,
tk_type,
tk_execute,
tk_dbs,
tk_delete,
tk_start_time,
tk_stop_time,
tk_frequency)
VALUES ("upt_timestamp",
"TASK",
"update spdb:t_timestamp set c1=current where 1=1",
"spdb",
Null,
datetime(00:00:00) hour to second,
NULL,
??? -- How to write here?
);
thanks
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.
Sometimes my mind runs faster than my typing..... ;-)
The only way that I can think of to do this would be to create a UDR TO (not
and) do the task and to have a 100 ms sleep in it using a poll() call. But
(and this is very important), a poll() (or select()) function call is not a
function which is a well behaved function call if run on the CPUVP since it is
a blocking call. Madison Pruet
Retired from IBM
On Thursday, January 14, 2016 8:47 PM, Madison Pruet <madison_pruet@yahoo.com>
wrote:
The only way that I can think of to do this would be to create a UDR and do
the task and to have a 100 ms sleep in it using a poll() call. But (and this
is very important), a poll() (or select()) function call is not a function
which is a well behaved function call if run on the CPUVP since it is a
blocking call. That means that it would require that the function execute on a
private VP and not on one of the CPUVPs. This gets rather complicated.
Short of that, you might consider simply using a 'c' program which executes
the function rather than trying to make it a scheduled function inside the
server. This would be easier to accomplish. I'm not sure if you need to run
every 100 ms or if you need to run and then sleep 100 ms before running again.
If the former, then you might need to use posix threading as you might have to
have multiple threads running concurrently. That would be the case if the task
that you need to run takes more than 100 ms to run.
Madison Pruet
Retired from IBM
On Thursday, January 14, 2016 7:39 PM, CHUAN LU <luchuan@cn.ibm.com> wrote:
HI,
I need to define a task to execute every 100 millisecond, below are my script
?
INSERT INTO ph_task
(tk_name,
tk_type,
tk_execute,
tk_dbs,
tk_delete,
tk_start_time,
tk_stop_time,
tk_frequency)
VALUES ("upt_timestamp",
"TASK",
"update spdb:t_timestamp set c1=current where 1=1",
"spdb",
Null,
datetime(00:00:00) hour to second,
NULL,
??? -- How to write here?
);
thanks
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.