www.digitalmars.com         C & C++   DMDScript  

c++.dos.32-bits - Multi-threading in Dos-32

reply "Karl" <someone unknown.org> writes:
Has anyone done any multi-threading at the Dos-X level?
Apr 23 2002
parent reply "Nic Tiger" <nictiger pt.comcor.ru> writes:
I've developed Multi-threading kernel for DOSX two month ago.
I haven't tested it enough to say it is 100% error-free, but it works pretty
well.

I've implemented most basic synchronization (events, mutexes, semaphores and
appropriate functions for using them). Thread's state may include (or if it
doesn't use it may not include) i387 state and SSE state.

On my P-III 1000 the scheduler consumes about 0,2% time, while switching
threads 1000 times per second.
Current code runs at least on Pentium (I used RDTSC instruction to time
execution), but if i486 supports mentioned instruction (I guess modern AMD
486 do), it should run on it either.

The problem to be fixed is using DOS. For now I see 2 ways of using DOS:
- hook DOS int 21 and embed mutex into it
- use win3.11 technique and swap static areas of DOS.

By now exceptions are handled so, that faulty thread is terminated while
others proceed running.

And one more issue: DOSX multithread no way will go under Win, as long as I
program i8253 controller and change the return point from interrupt.

By now, I have no support from RTL, but as soon as I get my Digital Mars CD
with RTL sources, I'll embed this support into RTL.

Note. I froze project because I changed my work and because no one seemed to
need this feature. If it is interesting for somebody I may proceed working
and develop this DOSX-MT project to ready-to-use product.

Nic Tiger.

"Karl" <someone unknown.org> wrote in message
news:aa5cne$1pod$1 digitaldaemon.com...
 Has anyone done any multi-threading at the Dos-X level?

Apr 23 2002
next sibling parent "Walter" <walter digitalmars.com> writes:
That's pretty fantastic!

"Nic Tiger" <nictiger pt.comcor.ru> wrote in message
news:aa5iuv$207h$1 digitaldaemon.com...
 I've developed Multi-threading kernel for DOSX two month ago.
 I haven't tested it enough to say it is 100% error-free, but it works

 well.

 I've implemented most basic synchronization (events, mutexes, semaphores

 appropriate functions for using them). Thread's state may include (or if

 doesn't use it may not include) i387 state and SSE state.

 On my P-III 1000 the scheduler consumes about 0,2% time, while switching
 threads 1000 times per second.
 Current code runs at least on Pentium (I used RDTSC instruction to time
 execution), but if i486 supports mentioned instruction (I guess modern AMD
 486 do), it should run on it either.

 The problem to be fixed is using DOS. For now I see 2 ways of using DOS:
 - hook DOS int 21 and embed mutex into it
 - use win3.11 technique and swap static areas of DOS.

 By now exceptions are handled so, that faulty thread is terminated while
 others proceed running.

 And one more issue: DOSX multithread no way will go under Win, as long as

 program i8253 controller and change the return point from interrupt.

 By now, I have no support from RTL, but as soon as I get my Digital Mars

 with RTL sources, I'll embed this support into RTL.

 Note. I froze project because I changed my work and because no one seemed

 need this feature. If it is interesting for somebody I may proceed working
 and develop this DOSX-MT project to ready-to-use product.

 Nic Tiger.

 "Karl" <someone unknown.org> wrote in message
 news:aa5cne$1pod$1 digitaldaemon.com...
 Has anyone done any multi-threading at the Dos-X level?


Apr 24 2002
prev sibling parent reply "Karl" <someone unknown.org> writes:
Thanks for the info.

It has always been a difficult decision on whether to use Linux or
Dos-32.  I only need something quite simple - no disk I/O, just
a single multithreading program running on a PC-104 box with
flash disk.

Nic Tiger <nictiger pt.comcor.ru> wrote in message
news:aa5iuv$207h$1 digitaldaemon.com...
 I've developed Multi-threading kernel for DOSX two month ago.
 I haven't tested it enough to say it is 100% error-free, but it works

 well.

 I've implemented most basic synchronization (events, mutexes, semaphores

 appropriate functions for using them). Thread's state may include (or if

 doesn't use it may not include) i387 state and SSE state.

 On my P-III 1000 the scheduler consumes about 0,2% time, while switching
 threads 1000 times per second.
 Current code runs at least on Pentium (I used RDTSC instruction to time
 execution), but if i486 supports mentioned instruction (I guess modern AMD
 486 do), it should run on it either.

 The problem to be fixed is using DOS. For now I see 2 ways of using DOS:
 - hook DOS int 21 and embed mutex into it
 - use win3.11 technique and swap static areas of DOS.

 By now exceptions are handled so, that faulty thread is terminated while
 others proceed running.

 And one more issue: DOSX multithread no way will go under Win, as long as

 program i8253 controller and change the return point from interrupt.

 By now, I have no support from RTL, but as soon as I get my Digital Mars

 with RTL sources, I'll embed this support into RTL.

 Note. I froze project because I changed my work and because no one seemed

 need this feature. If it is interesting for somebody I may proceed working
 and develop this DOSX-MT project to ready-to-use product.

 Nic Tiger.

 "Karl" <someone unknown.org> wrote in message
 news:aa5cne$1pod$1 digitaldaemon.com...
 Has anyone done any multi-threading at the Dos-X level?


Apr 28 2002
parent reply "Nic Tiger" <nictiger pt.comcor.ru> writes:
Hi Karl,

I suppose PC-104 means industrial computer (like as Advantec), is it so?
What version of DOS is there? I hope MS-DOS 5+.

If you need any assistance or my multithreading lib, just let me no.

Nic Tiger.

"Karl" <someone unknown.org> wrote in message
news:aai47a$250h$1 digitaldaemon.com...
 Thanks for the info.

 It has always been a difficult decision on whether to use Linux or
 Dos-32.  I only need something quite simple - no disk I/O, just
 a single multithreading program running on a PC-104 box with
 flash disk.

Apr 29 2002
parent "Karl" <someone unknown.org> writes:
DR-Dos.

I can do multithreading in Dos-16 and it served the purposed quite well.
The only reason to go further is networking support. The program size is
not that managable. Going to Linux is OK, but configuring for production
is messy.

Nic Tiger <nictiger pt.comcor.ru> wrote in message
news:aais3t$30bi$1 digitaldaemon.com...
 Hi Karl,

 I suppose PC-104 means industrial computer (like as Advantec), is it so?
 What version of DOS is there? I hope MS-DOS 5+.

 If you need any assistance or my multithreading lib, just let me no.

 Nic Tiger.

 "Karl" <someone unknown.org> wrote in message
 news:aai47a$250h$1 digitaldaemon.com...
 Thanks for the info.

 It has always been a difficult decision on whether to use Linux or
 Dos-32.  I only need something quite simple - no disk I/O, just
 a single multithreading program running on a PC-104 box with
 flash disk.


Apr 29 2002