Multithreading in DOS
-
- Posts: 42
- Joined: Mar 05, 2013 5:37
Multithreading in DOS
I have added supporting of multithreading in FreeBASIC For DOS.
Support of multithreading uses the DJGPP port of PTHREAD 2.07 library.
Attached archive contains FreeBASIC runtime library with multithreading (libfbmt.a),
runtime library without multithreading (libfb.a), two simple threading examples
and all source files of runtime library, which was added or changed.
Instruction on installation:
1. Replace LIBC.A, LIBFB.A and LIBFBMT.A from LIB\DOS with corresponding files from archive.
2. Try to compile and execute two examples - THREADS.BAS and THREADS2.BAS
THREADS program:
fbc -mt THREADS.BAS
THREADS2 program:
fbc -mt THREADS2.bas
Directory "SRC" contains source files, which was added or changed.
First of all, "makefile" was changed, which is located in the root of source code tree.
Files "thread_ctx.c" and "fb_private_thread.h" is situated in directory SRC\RTLIB.
At last, files "thread_core.c", "thread_cond.c" and "thread_mutex.c" was added to SRC\RTLIB\DOS directory.
New runtime library supports all standart FreeBASIC threading subroutines and functions except ThreadCall.
Support of ThreadCall is not released yet because there is no DJGPP port of LibFfi library.
In near future l shall try to compile LibFfi for DOS and add ThreadCall support.
I would like to ask the forum users who are interested in the development of FreeBASIC for DOS,
to participate in the testing and report any bugs here.
Download link: http://tempfile.ru/file/2878250.
Support of multithreading uses the DJGPP port of PTHREAD 2.07 library.
Attached archive contains FreeBASIC runtime library with multithreading (libfbmt.a),
runtime library without multithreading (libfb.a), two simple threading examples
and all source files of runtime library, which was added or changed.
Instruction on installation:
1. Replace LIBC.A, LIBFB.A and LIBFBMT.A from LIB\DOS with corresponding files from archive.
2. Try to compile and execute two examples - THREADS.BAS and THREADS2.BAS
THREADS program:
fbc -mt THREADS.BAS
THREADS2 program:
fbc -mt THREADS2.bas
Directory "SRC" contains source files, which was added or changed.
First of all, "makefile" was changed, which is located in the root of source code tree.
Files "thread_ctx.c" and "fb_private_thread.h" is situated in directory SRC\RTLIB.
At last, files "thread_core.c", "thread_cond.c" and "thread_mutex.c" was added to SRC\RTLIB\DOS directory.
New runtime library supports all standart FreeBASIC threading subroutines and functions except ThreadCall.
Support of ThreadCall is not released yet because there is no DJGPP port of LibFfi library.
In near future l shall try to compile LibFfi for DOS and add ThreadCall support.
I would like to ask the forum users who are interested in the development of FreeBASIC for DOS,
to participate in the testing and report any bugs here.
Download link: http://tempfile.ru/file/2878250.
Last edited by monochromator on Jun 12, 2013 13:57, edited 1 time in total.
Re: Multithreading in DOS
In your file, I can't find THREADS.BAS and THREADS2.BAS.
Anyway... dynamic linking, multithreading.... you are going to port SEAL (or IkonGUI, or something similar) to FreeBasic, I guess.
Years ago, I ported Windoze (an old, but very good GUI originally written for QBASIC) to FreeBasic; with dynamic linking and threads, writing a pseudo-OS (an OS running over DOS, like windows 95) in Freebasic would become a real option.
Anyway... dynamic linking, multithreading.... you are going to port SEAL (or IkonGUI, or something similar) to FreeBasic, I guess.
Years ago, I ported Windoze (an old, but very good GUI originally written for QBASIC) to FreeBasic; with dynamic linking and threads, writing a pseudo-OS (an OS running over DOS, like windows 95) in Freebasic would become a real option.
-
- Posts: 42
- Joined: Mar 05, 2013 5:37
Re: Multithreading in DOS
There is new version with tests and corrections some bugs.
http://tempfile.ru/file/2878496
http://tempfile.ru/file/2878496
Re: Multithreading in DOS
If I compile without "-mt", it build an executable, that crash (exiting due to signal SIGILL)
DosBox on linux, using CCSDPMI.
Maybe I need another extender?
DosBox on linux, using CCSDPMI.
Maybe I need another extender?
Re: Multithreading in DOS
> There is new version with tests and corrections some bugs
> http://tempfile.ru/file/2878496
Interesting ... downloaded (2 MiB !!!) ... not yet tested.
> http://tempfile.ru/file/2878496
Interesting ... downloaded (2 MiB !!!) ... not yet tested.
Multithreading <> GUI ;-) Maybe port 7-ZIP instead ?angros47 wrote:Anyway... dynamic linking, multithreading.... you are going to port SEAL (or IkonGUI, or something similar) to FreeBasic
-
- Posts: 42
- Joined: Mar 05, 2013 5:37
Re: Multithreading in DOS
To angros47:
The cause is not in an extender. The matter is that the libraries Pthread and Watt32 used for the organization of a multithreading, are compiled for the processor i686 and contain some instructions specific to Pentium II+ processors. DOSBOX isn't able to execute them therefore there is an exception "Invalid OpCode" (In this case it is the conditional move command CMOVE).
It is necessary to recompile libraries that I while can't make.
Therefore while multithreading work in DOSBOX is impossible.
As far as I understand, you use Linux. Can you check the discussed subject not in DOSBOX, but in DOSEMU?
The cause is not in an extender. The matter is that the libraries Pthread and Watt32 used for the organization of a multithreading, are compiled for the processor i686 and contain some instructions specific to Pentium II+ processors. DOSBOX isn't able to execute them therefore there is an exception "Invalid OpCode" (In this case it is the conditional move command CMOVE).
It is necessary to recompile libraries that I while can't make.
Therefore while multithreading work in DOSBOX is impossible.
As far as I understand, you use Linux. Can you check the discussed subject not in DOSBOX, but in DOSEMU?
Re: Multithreading in DOS
Ok: I tried it in QEMU, with MS-Dos 6.20 and HX extender, it works.
Thank you!
Thank you!
Re: Multithreading in DOS
IIRC, /beta/pth207b.zip (and some other stuff, e.g. /beta/bnu217b.zip) was accidentally compiled for 686+ (CMOVxx). You can use instead /current/pth207b.zip (and/or recompile from source, which didn't work for me back in the day, but I didn't stick with it) for 386+. Though this port is abandoned and not supported, at least not for DJGPP. And I'm honestly not sure it works properly under FreeDOS (perhaps some rare bug, dunno).monochromator wrote:To angros47:
The cause is not in an extender. The matter is that the libraries Pthread and Watt32 used for the organization of a multithreading, are compiled for the processor i686 and contain some instructions specific to Pentium II+ processors. DOSBOX isn't able to execute them therefore there is an exception "Invalid OpCode" (In this case it is the conditional move command CMOVE).
It is necessary to recompile libraries that I while can't make.
Therefore while multithreading work in DOSBOX is impossible.
As far as I understand, you use Linux. Can you check the discussed subject not in DOSBOX, but in DOSEMU?
DOSBox is "only for games", so it's intentionally lacking a lot of stuff (and its built-in DOS isn't a real one like DOSEMU uses). It can optionally emulate a 586, at best, but by default I think it's only a "fast" 486 DX2 (with CPUID).
There is an alternate thread library called FSU Pthreads. It was resurrected in recent years (thanks to Khusraw) to compile for DJGPP again. It doesn't need a socket library (libsocket nor Watt-32). It is used in latest (buggy but mostly usable) unofficial DJGPP compiles of p7zip (9.13, 9.20.1).
Re: Multithreading in DOS
This file is not found :(
«
Файл удален.
Более подробный ответ Вы можете найти в разделе
Правила
»
«
Файл удален.
Более подробный ответ Вы можете найти в разделе
Правила
»
Re: Multithreading in DOS
I know this is an old thread, but I think it is the one referenced from angros47 in Pull Request #44.
This feature works pretty well? Any special differences that need to be noted in the documentation? Most of the threading pages just mention that threading is not available on DOS.
This feature works pretty well? Any special differences that need to be noted in the documentation? Most of the threading pages just mention that threading is not available on DOS.
Re: Multithreading in DOS
The feature works, although I can't guarantee its reliability.
Re: Multithreading in DOS
If you remember forum member DOS386, he was most critical of the dos implementation, but also very understanding of the limitations or differences provided that it was documented. I don't use the DOS build of fbc for anything. If those using this feature could help update the documentation, would be very helpful to the project and all fbc -target dos users.
Re: Multithreading in DOS
Neither do I.coderJeff wrote:I don't use the DOS build of fbc for anything.
Re: Multithreading in DOS
I may be new here -but I'm using it.fxm wrote:Neither do I.coderJeff wrote:I don't use the DOS build of fbc for anything.
Howdy, folks. Nice to meet you all. :)