Timing problems, windows resource managment problems??

Timing problems, windows resource managment problems??

Post by Tibor Webe » Fri, 16 May 2003 23:28:24



Hi everybody!

I am doing the following thing.
getmessage()
{
 do
 {
  is there an object signaled
  {
   yes, send a frame on the CAN
   //the time is measured between the signalling of the
object and the sending of the frame
  }
  else
  {
   check if is there any timeout
  }
 }while(!timeout && !finished)

Quote:}

This is the function briefly. My problem is I have only
limited time to send out that frame. In the most of the
times that is sent after 600usec, but sometimes it takes
more than 25msec (etc. once in 10'000 execution) and the
other side will abort the communication, because it's a
timeout.

How I can see two problem what can happen.
1. My program is running and at once my program loses the
CPU and the windows will execute an other task and my
program will get the back the control too late.
2. The card what is responsible for the communication
doesn't handle the receiveng properly, sometimes it
notices the program too late.

My opinion is I have the first situation.

My question is: Is there any possibility to not let to
stop the execution of my program in special cases or
control the time when I will get it back. For me it seems
to be not possible.
If it's not possible then is there any other way to make
sure my program will get the control back before a certain
time???

Until this I tried to change the priorities, but if I
increased the system was much more more instable. My
program was running more for certain time, but the
execution of other tasks was bigger too, so the program
failed earlier.

The program was written on C++ Builder, console mode.
The program was tested on different platforms, but most
stable platform was the XP.
For the communication a CanCard2 is used. (produced by
Softing)

It would be really urgent!

 
 
 

Timing problems, windows resource managment problems??

Post by Frank T. Clar » Sat, 17 May 2003 00:20:54


This looks like a very common beginners problem caused by a design error.
You appear to be trying to use a general purpose computer system as if it
were a dedicated processor where you have all the CPU utilization you want
whenever you want it. This is never true but usually with proper design it
is not a problem.

I will assume that you have sufficient CPU power for the task you are trying
to do. You must design opportunites within your loop for other system
processing to occur. This is not a simple or obvious task which is why
software development requires a great deal of training and experience.


Quote:> Hi everybody!

> I am doing the following thing.
> getmessage()
> {
>  do
>  {
>   is there an object signaled
>   {
>    yes, send a frame on the CAN
>    //the time is measured between the signalling of the
> object and the sending of the frame
>   }
>   else
>   {
>    check if is there any timeout
>   }
>  }while(!timeout && !finished)
> }
> This is the function briefly. My problem is I have only
> limited time to send out that frame. In the most of the
> times that is sent after 600usec, but sometimes it takes
> more than 25msec (etc. once in 10'000 execution) and the
> other side will abort the communication, because it's a
> timeout.

> How I can see two problem what can happen.
> 1. My program is running and at once my program loses the
> CPU and the windows will execute an other task and my
> program will get the back the control too late.
> 2. The card what is responsible for the communication
> doesn't handle the receiveng properly, sometimes it
> notices the program too late.

> My opinion is I have the first situation.

> My question is: Is there any possibility to not let to
> stop the execution of my program in special cases or
> control the time when I will get it back. For me it seems
> to be not possible.
> If it's not possible then is there any other way to make
> sure my program will get the control back before a certain
> time???

> Until this I tried to change the priorities, but if I
> increased the system was much more more instable. My
> program was running more for certain time, but the
> execution of other tasks was bigger too, so the program
> failed earlier.

> The program was written on C++ Builder, console mode.
> The program was tested on different platforms, but most
> stable platform was the XP.
> For the communication a CanCard2 is used. (produced by
> Softing)

> It would be really urgent!


 
 
 

Timing problems, windows resource managment problems??

Post by Slava M. Uso » Sat, 17 May 2003 01:25:39



[...]

Quote:> This is the function briefly. My problem is I have only
> limited time to send out that frame. In the most of the
> times that is sent after 600usec, but sometimes it takes
> more than 25msec (etc. once in 10'000 execution) and the
> other side will abort the communication, because it's a
> timeout.

Any variant of Windows is not a real-time OS. You need to design your
application in a way that tolerates occasional timing slips. You may try to
use the real-time priority class, but this will not guarantee anything. Then
you can try and move your code into kernel mode, but even there it can be
quite hard to achieve strict response times AND let the rest of the system
function. If your requirements are very strict, then Windows is not
appropriate for you.

S

 
 
 

1. Sound card managment problem

I am writing an audio tool in C++ using WIN32 low level audio API.
Some operations such as output volume control are very simple to do.
Some others aren't and seems not to be well documented in VC++ 4.0.

Does someone can help me to :

- managing the input gain (I need different levels on the left and right
channels)

- managing the local echo of the sound card, that is : I want the
incoming
sound to be heard - attenuated - on the output. Of course the level of
the
attenuation isn't the same on left and right channels.

Thank's for your help.
--

          -- Tout est si simple avec un peu de bonne volonte --

                          CCCCCC  IIIII  SSSSS  IIIII
                         C          I   S         I
Jean-Marc GEORGIN        C          I    SS       I


                          CCCCCC  IIIII SSSSS   IIIII

2. +++++++++++ M S O F F I C E P R O 97 $1 4 5 ++++++++++++

3. Under Control V2.1 Released - Problem Tracking and Software Team Managment Tool

4. zoom 2870 Cellular

5. Borland Resource Workshop - Problem with bitmapped resources

6. ISPs in UK

7. Problem with System resources in Windows-Task (fwd)

8. forwarding domain mail

9. Problem using this function to fill LINEDEVCAPS struct - from Chris Sells book - problem on Windows 2000

10. Problem: Help Compiling Problem with WHAT6 in Windows 95

11. Regarding Network time,Client time, Remote Time, Server Exection Time

12. resource editor positioning problems

13. PlayEnhMetaFile() resource problem