Since ya'll are asking for someone to help. Maybe you can help me with a
problem I am having with a source code I am modifing.
It has timeslices built into it, but the CPU usage is still in the upper limits (89-98%). I sorta remember something I have read and wantted to verify
it. That the timeslices shouldn't be gave at anytime. Like say you do this.
For A := 0 to 100 do
begin
{Do some stuff here}
TimeSlice;
end;
It would do 100 timeslices back to back.
I have read that you should time them to be at least 55 ms apart
( depending on the system ). That if you do like I did above it will accually make the application use more of the CPU.
Maybe someone could explain to me all about Time Slices. Or point me in the direction of a place I can read up on them.
Bye <=-
Since ya'll are asking for someone to help.
Maybe you can help me with a problem I am having with
a source code I am modifing.
It has timeslices built into it, but the CPU usage is still in
the upper limits (89-98%).
I sorta remember something I have read and wantted to verify
it. That the timeslices shouldn't be gave at anytime.
Like say you do this.
For A := 0 to 100 do
begin
{Do some stuff here}
TimeSlice;
end;
It would do 100 timeslices back to back.
I have read that you should time them to be at least 55 ms
apart ( depending on the system ). That if you do like I
did above it will accually make the application use more of
the CPU.
Maybe someone could explain to me all about Time Slices. Or
point me in the direction of a place I can read up on them.
For A := 0 to 100 do
begin
{Do some stuff here}
TimeSlice;
end;
It would do 100 timeslices back to back.
first off check the documentation for "timeslice" I don't
find it documented as a standard part of TP
What I'm guessing it does is inform a multitasker that the
program is not busy so that the multitasker can dedicate
more cpu effort to running other tasks. (AFAIK windows
OS/2 and Dessqview all do that in slightly different ways
(if you're using a dos compiler)
I have read that you should time them to be at least 55 ms
apart ( depending on the system ). That if you do like I
did above it will accually make the application use more
of the CPU.
I don't see how it could cause more CPU usage than putting
some form of delay loop between calls to timeslice.
Maybe someone could explain to me all about Time Slices. Or
point me in the direction of a place I can read up on them.
OTOH if you want to delay for a long time there may be some
sort of sleep procedure avaialable. (but your code suggests
to me that you want to "do some stuff" between timeslices so
probably you are doing it the best way.
For A := 0 to 100 do
begin
{Do some stuff here}
TimeSlice;
end;
It would do 100 timeslices back to back.
as for when i call my slicing/sleeping stuff, that depends on my program an what its doing at the time... if i'm doing a lot of disk processing, i migh sleep every 50 records processed or every 100 lines read... if its pretty m memory intensive, i may sleep after each second... it really depends... one my applications uses both time based and processing based slicing calls... during intensive disk processing, it uses record based slicing and no timer based... the reason for this is to keep the effective processing speed of t program relatively bearable... if i sliced on each record or line read duri file processing, it may take a long long time for the program to finish wha it is doing but it would be very very very multitasker friendly... on the other hand, if i slice away only once per 1000 records processed, the application would do the disk processing very fast but be very multitasker unfriendly...
what operating system, version and timeslice style?? all three are needed t be known... there are several ways of timeslicing... choosing the proper on depends on the operating system and in some cases, which version of the operating system...
FWIW: the only difference between my Warp3 and Warp4 slicing is the Warp3 stuff is set to sleep for 2ms whereas the Warp4 stuff is set to 0 (meaning "sleep now!")...
i don't know that i can show the entire code setup that i use because there some inline asm as well as numerous asm routines mixed in with the pascal.. can possibly post the actual slicing calls if desired... i had to play with them and work some things out for myself... some of my experimenting did ca lockups and lost data...
yes, to me, it, too, appears that he is wanting to make his stuff more multitasker friendly...
it is doing but it would be very very very multitasker
friendly... on the other hand, if i slice away only
once per 1000 records processed, the application would
do the disk processing very fast but be very
multitasker unfriendly...
This is stuff I can use, cause what I was doing was had
it release a slice not in a wait procedure, but in
times it is getting input and you said it would freeze
the program and take a long time to complete. This is
helpful. Cause if it is running a task. I should wait
a while, before giving up a timeslice, but when it is
just waitting for input I should give up a timeslice
each time. (tell it to sleep).., because it is sorta not
processing anything until input is givin'.
what operating system, version and timeslice style?? all
three are needed to be known... there are several ways of
timeslicing... choosing the proper one depends on the
operating system and in some cases, which version of the
operating system...
Basicly you gave me the ones that I have already. (not the
code, but told me the ones). OS/2-Desqview-Windows(real mode)-DOS.
All versions :)~.
I need to know about Win2k though..
FWIW: the only difference between my Warp3 and Warp4 slicing
is the Warp3 stuff is set to sleep for 2ms whereas the Warp4
stuff is set to 0 (meaning "sleep now!")...
?..
Do you mean that a timeslice pauses your program or ie sleep.
I sorta understand this part, but just wantted to make sure.
i don't know that i can show the entire code setup that i
use because there some inline asm as well as numerous asm
routines mixed in with the pascal.. can possibly post the
actual slicing calls if desired... i had to play with them
and work some things out for myself... some of my
experimenting did cause lockups and lost data...
That is alright I already have code your talking about, but
just wantted to understand the way it works better and find
out proper ways of using it.
You have taught me a few things.
1: TimeSlices pauses your program and lets other process to
run. or also called sleep.
2: So, it is best to do a timeslice when your program isn't
doing
heavy processing. If you do a timeslice in this processing
don't do it back to back, let the program run for a while
before giving one up or it will take a long time to finish
what it is doing. On the other hand if you don't give one
after a certain time the OS will suffer from lack of (for
lack of words) cpu time.
3: Try to give up timeslices when your program is idle, like
waitting for input. Then process that input and while
processing that input see #2.
4: It do mader when and where a timeslice is in the code. See
#1, #2, #3.
Quoting Chris Hoppman to All <=-
Since ya'll are asking for someone to help. Maybe you can help me
with a problem I am having with a source code I am modifing.
It has timeslices built into it, but the CPU usage is still in the
upper limits (89-98%). I sorta remember something I have read and wantted to verify it. That the timeslices shouldn't be gave at
anytime. Like say you do this.
For A := 0 to 100 do
begin
{Do some stuff here}
TimeSlice;
end;
It would do 100 timeslices back to back.
I have read that you should time them to be at least 55 ms apart
( depending on the system ). That if you do like I did above it will accually make the application use more of the CPU.
Maybe someone could explain to me all about Time Slices. Or point me
in the direction of a place I can read up on them.
Another thing is why do you need the timeslice? A multi-tasking
software? A TSR? A game? The particular type of software
also indicates how to go. A game sometimes need fast and
sometimes slow timeslices, for example.
Now with that stuff said have you checked out SWAG? It has
at least 3 sample codes using the keyword time slice in it.
One for os/2 and Desqview and 2 others general code sources.
Keep in mind though those are in pure assembler. But ASM
is a good way to go with timeslices.
Quoting Chris Hoppman to Scott Adams <=-
Another thing is why do you need the timeslice? A multi-tasking
software? A TSR? A game? The particular type of software
also indicates how to go. A game sometimes need fast and
sometimes slow timeslices, for example.
16-Bit Real Mode BBS software.
Now with that stuff said have you checked out SWAG? It has
at least 3 sample codes using the keyword time slice in it.
One for os/2 and Desqview and 2 others general code sources.
Keep in mind though those are in pure assembler. But ASM
is a good way to go with timeslices.
Yes, but I don't need to learn how to do them, *except if there is
others for Win2k*, I needed to learn the proper ways to execute them. The Where and When.. As, my example program shows.
Sysop: | digital man |
---|---|
Location: | Riverside County, California |
Users: | 1,067 |
Nodes: | 17 (0 / 17) |
Uptime: | 16:19:17 |
Calls: | 501,255 |
Calls today: | 2 |
Files: | 109,409 |
D/L today: |
5,538 files (8,374M bytes) |
Messages: | 302,079 |
Posted today: | 1 |