Subj : since ya'll are asking. To : Chris Hoppman From : mark lewis Date : Sun Dec 14 2003 05:48 pm CH> Since ya'll are asking for someone to help. hehehe... CH> Maybe you can help me with a problem I am having with CH> a source code I am modifing. can only try... CH> It has timeslices built into it, but the CPU usage is still in CH> the upper limits (89-98%). 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... CH> I sorta remember something I have read and wantted to verify CH> it. That the timeslices shouldn't be gave at anytime. i'm not familiar with that... CH> Like say you do this. CH> For A := 0 to 100 do CH> begin CH> {Do some stuff here} CH> TimeSlice; CH> end; CH> It would do 100 timeslices back to back. almost... {do some stuff here} would also take some time to do its thing... CH> I have read that you should time them to be at least 55 ms CH> apart ( depending on the system ). That if you do like I CH> did above it will accually make the application use more of CH> the CPU. dunno about using more of the cpu or not... and i can't really confirm them to be at least 55ms apart, either... CH> Maybe someone could explain to me all about Time Slices. Or CH> point me in the direction of a place I can read up on them. wow, i picked up a lot of my knowledge about them in numerous areas several years ago... what i ended up doing was to attach my chosen timeslice method to an interrupt vector (F1 in my case) and then i just called that interrupt when i needed or wanted to... this let the system chain in the proper timeslice routine based on the OS and i just called the same interrupt no matter what routine was in it... my setup uses one of five slicers, depending on the OS... one for OS/2 Warp3, one for OS/2 Warp4, all other OS/2 and Windows use DPMI slicing... then there DESQview slicing and finally the old INT28 DOS slicing... 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!")... as for when i call my slicing/sleeping stuff, that depends on my program and what its doing at the time... if i'm doing a lot of disk processing, i might sleep every 50 records processed or every 100 lines read... if its pretty much memory intensive, i may sleep after each second... it really depends... one of 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 the program relatively bearable... if i sliced on each record or line read during file processing, it may take a long long time for the program to finish what 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... i don't know that i can show the entire code setup that i use because there is some inline asm as well as numerous asm routines mixed in with the pascal... i 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... )\/(ark * Origin: (1:3634/12) .