| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | OS/2 Executable system load ?? |
PA> It's documented this way
AK> Where is that documented?
AK>> Tried it, but the CPU load is still the same as before...
It is in the ibm toolkit docs, but you might have to read it more than once.
DosSleep(0) -- yield the _remainder_ of the current timeslice to
a ready-to-run thread of equal or higher priority.
A ready-to-run thread is one that is not blocked on a
semaphore, or in a device driver (getch(), for
example), or in DosSleep().
Since the foreground program usualy gets a boost, there
are usually no other threads of equal or higher priority
when your program is in the foreground.
Since "Pulse" works by counting extra idle-time
cycles, DosSleep(0) will never effect the graph
produced by pulse.
DosSleep(any other value): Round up the value to the next schedular
event (usually 32ms); so DosSleep(1) is the same as
DosSleep(32). At least one timeslice will be yielded;
if there are no ready to run threads, the thread will
still pause for the period.
Here is the most important part of my message: If you have to place a
DosSleep(1) anywhere in your program (to prevent Pulse from showing too
much CPU usage), your program needs to be redesigned for OS/2. Your
prorgram has [a] polling loop[s], and these are bad bad bad (and hardly
ever necessary).
The only time a pooling loop is necessary is if you are using a device that
is not interrupt driven (for example, the Joystick port). With such a
device, however, there are some techniques you can use in a device driver
to limit the impact of polling.
In all other cases, you can replace polling loops with threads that block
(wait) on devices. Such a thread uses 0% of the cpu when the nothing is
happening, and responds faster (since it is not in a sleep) when something
does.
You may have seen me state my first axiom of threads a few days ago: A
thread's most important job is to do nothing very well. I hope I have shed
some light on it with this message. A thread that "does nothing"
with a DosSleep(x) is doing a very poor job.
If you are having trouble applying threads to your problem, describe the
situation here and I'm sure someone will help.
--- Maximus/2 3.00
* Origin: Sol 3 * Toronto * V.32 * (905)858-8488 (1:259/414)SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934 SEEN-BY: 711/955 712/407 515 624 628 713/888 800/1 @PATH: 259/414 400 99 250/99 3615/50 396/1 270/101 712/515 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.