Re: [fpc-pascal] Threading in FPC DOS

2006-07-12 Thread Andreas Berger
@Vincent thanks for your detailed reply :) @All Vinzent Hoefler wrote: On Wednesday 12 July 2006 11:34, Andreas Berger wrote: save and restore the floating point unit. I will need to do this for FPC, so if someone knows how to save and restore the FPU, I would apreciate the help. F(

Re: [fpc-pascal] Threading in FPC DOS

2006-07-12 Thread Vinzent Hoefler
On Wednesday 12 July 2006 11:34, Andreas Berger wrote: > save and restore the floating point unit. I will need to do this for > FPC, so if someone knows how to save and restore the FPU, I would > apreciate the help. F(X)SAVE/F(X)RSTOR The X-Versions are more efficient, but only available on newe

Re: [fpc-pascal] Threading in FPC DOS

2006-07-12 Thread Jonas Maebe
On 12 jul 2006, at 13:00, Vinzent Hoefler wrote: "sched_yield()"? Seems to be POSIX, so I suppose it's available on most Unices. Indeed also exists on Mac OS X. Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freep

Re: [fpc-pascal] Threading in FPC DOS

2006-07-12 Thread Andreas Berger
Since Dos can have multiple ways of multitasking (it could e.g. also plug in to DV or Win3.x or TopView via int 2FH etc) this model seems advisable to me. I assume you are implementing a basic fixed timeslicer? What are you going to use it for btw? This because DV/X (which is free nowadays) a

Re: [fpc-pascal] Threading in FPC DOS

2006-07-12 Thread Vinzent Hoefler
On Wednesday 12 July 2006 11:10, Marco van de Voort wrote: > > > > spinning loops on Mac OS X, so maybe sleep(0) is the same. > > > > > > Do you know a correct way of doing this on *nix? > > > > "sched_yield()"? Seems to be POSIX, so I suppose it's available on > > most Unices. > > Yes, and not so

Re: [fpc-pascal] Threading in FPC DOS

2006-07-12 Thread Marco van de Voort
> > > spinning loops on Mac OS X, so maybe sleep(0) is the same. > > > > Do you know a correct way of doing this on *nix? > > "sched_yield()"? Seems to be POSIX, so I suppose it's available on most > Unices. Yes, and not so recent ('93) that it is risky. At least FreeBSD seems to have it. _

Re: [fpc-pascal] Threading in FPC DOS

2006-07-12 Thread Vinzent Hoefler
On Wednesday 12 July 2006 10:57, Tomas Hajny wrote: > I certainly don't know a general solution for *nix. However, even old > "single-task" DOS provides such a function and it's a great help that > can be provided by programmer to scheduler in the underlying OS, so > *nix systems should provide su

Re: [fpc-pascal] Threading in FPC DOS

2006-07-12 Thread Vinzent Hoefler
On Wednesday 12 July 2006 09:58, Marco van de Voort wrote: > > On 12 jul 2006, at 11:25, Marco van de Voort wrote: > > > > sleep(0) is quite bad, because it may not necessarily give up any > > timeslice. At least very short nanosleeps seem to be implemented as > > spinning loops on Mac OS X, so may

Re: [fpc-pascal] Threading in FPC DOS

2006-07-12 Thread Tomas Hajny
Marco van de Voort wrote: >> On 12 jul 2006, at 11:25, Marco van de Voort wrote: >> >> > I doubt it. Note that it also probably needs enhancing of the >> > threadinterface with a giveuptimeslice functionality, something for >> > which >> > now sleep(0) is abused. >> >> sleep(0) is quite bad, becaus

Re: [fpc-pascal] Threading in FPC DOS

2006-07-12 Thread Marco van de Voort
> On 12 jul 2006, at 11:25, Marco van de Voort wrote: > > > I doubt it. Note that it also probably needs enhancing of the > > threadinterface with a giveuptimeslice functionality, something for > > which > > now sleep(0) is abused. > > sleep(0) is quite bad, because it may not necessarily give

Re: [fpc-pascal] Threading in FPC DOS

2006-07-12 Thread Vinzent Hoefler
On Wednesday 12 July 2006 09:15, Tomas Hajny wrote: > Well, multitasking <> multithreading. I'm not sure if DV or Win 3.x > provide special multithreading support for DOS applications... Nope, not really (at least for Win3.x). There are some services to aid multi-tasking-aware applications at th

Re: [fpc-pascal] Threading in FPC DOS

2006-07-12 Thread Tomas Hajny
Marco van de Voort wrote: >> Marco van de Voort wrote: . . >> However, it certainly depends on whether a general solution (not >> requiring special support like DV, etc.) is really feasible and >> practical. > > I doubt it. Note that it also probably needs enhancing of the > threadinterface with

Re: [fpc-pascal] Threading in FPC DOS

2006-07-12 Thread Jonas Maebe
On 12 jul 2006, at 11:25, Marco van de Voort wrote: I doubt it. Note that it also probably needs enhancing of the threadinterface with a giveuptimeslice functionality, something for which now sleep(0) is abused. sleep(0) is quite bad, because it may not necessarily give up any timeslice.

Re: [fpc-pascal] Threading in FPC DOS

2006-07-12 Thread Marco van de Voort
> Marco van de Voort wrote: > > me. > > I assume you are implementing a basic fixed timeslicer? What are you > > going > > to use it for btw? This because DV/X (which is free nowadays) afaik gives > > you preemptive scheduling on Dos. > > Well, multitasking <> multithreading. I'm not sure if DV

Re: [fpc-pascal] Threading in FPC DOS

2006-07-12 Thread Tomas Hajny
Marco van de Voort wrote: >> >> I need to implement some simple threading in a DOS application I am >> >> writing with FPC. What I need to know is the following: >> >> >> >> 1) Does FPC protect it's stack or can I allocate memory from the heap >> >> and point SS and ESP to it for the threads stack.

Re: [fpc-pascal] Threading in FPC DOS

2006-07-12 Thread Marco van de Voort
> >> I need to implement some simple threading in a DOS application I am > >> writing with FPC. What I need to know is the following: > >> > >> 1) Does FPC protect it's stack or can I allocate memory from the heap > >> and point SS and ESP to it for the threads stack. > >> > > > > I believe

Re: [fpc-pascal] Threading in FPC DOS

2006-07-11 Thread Andreas Berger
I need to implement some simple threading in a DOS application I am writing with FPC. What I need to know is the following: 1) Does FPC protect it's stack or can I allocate memory from the heap and point SS and ESP to it for the threads stack. I believe the latter is correct (except th

Re: [fpc-pascal] Threading in FPC DOS

2006-07-11 Thread Tomas Hajny
On 11 Jul 06, at 15:14, Andreas Berger wrote: > I need to implement some simple threading in a DOS application I am > writing with FPC. What I need to know is the following: > > 1) Does FPC protect it's stack or can I allocate memory from the heap > and point SS and ESP to it for the threads st