Solved

REAL-time priority in W95

Posted on 1998-12-18
17
235 Views
Last Modified: 2010-04-04
Is there any way to give a REAL
"time-critical priority" to thread or
"REAL-TIME PRIORITY CLASS"  to process
in Delphi application for Windows'95,
so it couldn't be interrupted at all by other processes
nor by system Kernel? Thanks.
0
Comment
Question by:Fatman121898
  • 5
  • 3
  • 3
  • +4
17 Comments
 
LVL 3

Expert Comment

by:Matvey
ID: 1351784
I doubt that `95 structure allows this gimic, but I'd also love to find a way...
I wonder what is the purpose in your case?
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1351785
I'm afraid there isn't... but who am I to know? I learn everyday from this site.
0
 
LVL 3

Expert Comment

by:williams2
ID: 1351786
No, if there was only one thing you couldn't do, this would be it!!!! ..every task need to go through the kernel, because of the system allocation table. If you even though took away the process timing, the OS would crash immidiately.

Regards,
Williams
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1351787
for realtime-critical applications you need other OS & hardware.
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1351788
I'm not pessimistic by nature, so I wouldn't dump the idea without getting some proove. I wonder what example can I bring here? Uhhm... The Defragment tool isn't a good one, though it proovs that low level hardware access tools aren't impossible. It does however restart the whole process if it detects some disk activity from other running threads. What else?... My new scanner! When I scan something, the system is absolutely hanging. I don't know how it achives this - maybe transfer from the paralel port does it? I doubt it, there must be something else. But this is a good example - even the mouse pointer is disabled. This must be something we caould lern from, I guess. I'm intrigued!
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1351789
Well, for my comment I meant that windows and the normal pc hardware is just not designed for realtime business.... I sure wouldn't want to run my factory processes(if I had a factory :-))  on windows machines.... Realtime has just other requirements...

Matvey, do you have OS NT? and is the scanner software for 95/98? Then it's possible from your ports.... because in win NT the ports (and other things) are far more protected than 95/98/.. In WinNT you can just forget to write directly to a port...

Zif.
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1351790
Hi Tom. I've win 95 and the software was supposed to work with it. Actually it does, and as I've seen in some other scanners this "real-time transfer" must be delaying all other threads somehow.
The PC isn't the best solution if you want to deal with satalite control from NASA, or even the simplest realtime DSP, although some people are very eager to try. Even taking in account the stupid "_universal_" architecture of it, both examples WERE IMPLEMENTED on it! Why do we all have PCs? I'd love to have a Mac, but I'm so sure I won't find any reasonable way to work with it, while my job and friends have other pets. Of course it's about compatibility and popularity. If you want to make something for wide use - do it for the PC, else you should be exactly sure of what you're doing and who's buying, because you won't have many customers here ;-)

Mat
0
 
LVL 3

Expert Comment

by:williams2
ID: 1351791
Hmmmmmmm.. PC's are NOT build for realtime processes, that's for sure, but if you want a scanner that doesn't hang on your machine, you should go buy a scanner with SCSI extensions, then you will not have the problems above.

To some of you that didn't realise that not everything are solved with software.

Some scanners are build being able to write their result to a memoryextension or a SCSI-harddisk. SCSI harddisks are very handy for this purpose.

Zif: I wouldn't trust using a sattelite control, if there was no suitable realtime hardware made for the exact purpose - and why I know that? - My very best friend is a hardware engineer who works for the government doing exacly this to control both missiles and sattelites - and guess what? They also use PC's for this.

Regards,
Williams
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Expert Comment

by:dejohn99
ID: 1351792
In Win95, if your process doesn't make calls to ProcessMessages or handleMessage, the Win95 kernel is not called and your process takes over the entire box.  This is subject to hardware interrupts and DMA accesses of course, but  it also means the Windows 95 cannot redraw screens or perform any of its own tasks.

This is why any scanners and such with slow interfaces will bog down the other threads.  It's not so much giving the thread a higher priority as refusing to return control to the OS.  Win95 and 98 are still DOS at their core, and when they pass control to a thread it takes over the box until it relinquishes that control.

williams2 has the right approach to this problem I think.  It also is the macintosh solution - run anything with major throughput through a SCSI port and forget about it.
0
 

Expert Comment

by:dejohn99
ID: 1351793
BTW: Most gas plants now are run off of PC's running Windows.  Of course the PC is merely a front end for a dedicated bus addressing a network of intelligent controllers with only a few controls on each piece.  The PC operator makes the big decisions, and the routine decisions are made by the microcontrollers.  They notify the PC on a regular basis of any changes they have made, so the PC is always ¼ second or so behind the reality of the plant's status.  Since this is as fast as a human can react anyways, it is close enough to real time for practical purposes.
0
 
LVL 1

Expert Comment

by:EmmDieh
ID: 1351794
Yes, there is.
For example the nice command line utility from the unix95 package allows you to change the priority to idle, norm, high or real.
And the CreateProcess-WinAPI function allows to specify the priority class in the dwCreationFlags parameter.
But you shouldn't use this priority class to perform long tasks
otherwise the system doesn't perform well.


0
 

Accepted Solution

by:
simandoff earned 100 total points
ID: 1351795
You can try this:
  SetPriorityClass(GetCurrentProcess, REALTIME_PRIORITY_CLASS);
  SetThreadPriority
            (GetCurrentThread,THREAD_PRIORITY_TIME_CRITICAL);

Under NT it works fine, but under win9x, there is some problems.
For example some VXD device drivers can interrupt your application, because of their internal calling structure.
To be sure your application never stops under win9x you must
write your own VXD. That's all.
0
 
LVL 1

Author Comment

by:Fatman121898
ID: 1351796
Hi, Simandoff,
SetPriorityClass and SetThreadPriority are good for much purposes, but not for
mine. I need a REALLY Realtime priority, which means stopping ALL other processes while my own one is running (this will get about 3 seconds). All answers I got tell me that this is impossible in such a OS like W95. So, I'm affraid I'll have to give up and "downgrade" to W3.11.
Fat.
0
 
LVL 1

Author Comment

by:Fatman121898
ID: 1351797
Hi,Matvey,
The purpose of my process is to read data from parallel port, which is connected to external ADC hardware, working in real time - means new sample every 10mS for about 3 seconds. I have no possibility to change hardware with intelligent one (which is most probably the real solution in my case) nor OS platform, because my time is up.
Fat.
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1351798
Then how about the idea dejohn99 suggested: do not return control to windows, instead just read all data from the port inside one procedure?
0
 
LVL 1

Author Comment

by:Fatman121898
ID: 1351799
There is still some Windows activity even if a DOS application is working.
But  I found the way...incredible simple.
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1351800
Share it! :-)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now