On Tue, 2003-06-03 at 15:06, Gilad Ben-Yossef wrote:
> Gilboa Davara wrote:
> 
> > 
> > Posix thread library is problematic.
> > Here's a couple of examples.
> > A. Threads: 
> > Lack of true, low level, thread control.
> > For instance, in Win32 I can save a thread's context, suspend it
> > remotely (from another thread or even a controlling process) implant the
> > saved context into it, and it'll continue running from the were I
> > stopped it. (Kind'a like hardware interrupt)
> 
> ptrace(2) says:
> 
> "       PTRACE_PEEKTEXT, PTRACE_PEEKDATA
>                Reads  a  word  at the location addr in the child's
>                memory, returning the word as  the  result  of  the
>                ptrace call.  Linux does not have separate text and
>                data address spaces, so the two requests  are  cur-
>                rently equivalent.  (The argument data is ignored.)
> 
>         PTRACE_PEEKUSR
>                Reads a word at offset addr  in  the  child's  USER
>                area,  which holds the registers and other informa-
>                tion about  the  process  (see  <linux/user.h>  and
>                <sys/user.h>).   The word is returned as the result
>                of the ptrace call.  Typically the offset  must  be
>                word-aligned,  though  this might vary by architec-
>                ture.  (data is ignored.)"
> 
> The equivilient POKE functions exists as well.

I'll give it a look-see.
Thanks!


> 
> 
> > Under Win32 the thread scheduling is more robust, I've got more levels
> > of control between low, normal, and real time. (Without messing with the
> > scheduling type, FIFO, RR, etc) 
> 
> POSIX provides 100 levels of real time scheduling +  a dynamic priority 
> for normal/low proccess and teh addtional ability to pick the scheduling 
> algorythm used to pick the next task, changable at run time.
> 
> Care to eloborate which feature are you missing?

Actually the number of levels depends on the scheduling type.
sched_get_priority_min(SCHED_TYPE) to sched_get_priority_max(SCHED_TYPE)
However, (and current me if I'm wrong) the I can't change the scheduling
type once the thread is running.
At least in my case, I rather have less control over the scheduling
algorithm in-order to gain simpler to use "set-priority" function.
(Kinda like getpriority and setpriority).

> 
> 
> > Oh, and the lack of true smart wait function is problematic. (I usually
> > create a mutex that goes with a thread to emulate a true thread wait
> > function.)
> 
> What is the additional features which the smart wait function provides 
> above a mutex?

Section E...

> 
> > 
> > B. Events (posix conditions).
> > Wait it doesn't work right (PulseEvent never did... MS, like MS, just
> > refuses to fix it), NT events are much easier to use, and have much
> > better control. The posix conditions are a just pain in the back side.
> 
> I don't understand the issue, so I'll jsut shut up...

posix condition require an external mutex lock, they cannot operate in
flood-gate mode. (only single pass). 

> 
> > 
> > C. Process.
> > fork + exec, is far less effective and feature rich then CreateProcess
> > (Or, CreateProcessAsUser, etc)
> 
> How much of that added functionality is ever used in 99.5% of the uses 
> of that function? how many programers understnad the model involved?
> 

Someone here (Shachar) said here that it's more of mentality issue. I
rather use a single command for everything.
Posix, requires a set of commands to achieve the same target.
(create attribute, change attribute, apply attribute to new
thread/process/mutex/condition, use object) while the Windows API does
the same, using flags, in the main create function.

> 
> > 
> > D. Process, Thread control.
> > Lack of Affinity mask (Ability to divert a single process / thread to be
> > used on CPUn,y,z outside the OS's discretions)
> 
> CPU affinity is available under Linux, at least.
> 

If you can find me the command, I'll be forever in your debt. I googled
myself to death over this one.

> 
> > 
> > E. Wait functions.
> > WaitForSingleObject (WaitForMulitpleObjects) is by far better then
> > anything posix. The ability to create a single wait that will work on
> > threads, processes, files, events, mutexes, etc, is a true blessing.
> > I'm currently looking into ways to emulate the WaitFor* on posix
> > machines. 
> > 
> 
> Yes, you're right there. Will you release the code as GPL when you're 
> done? :-)

Sure!

> 
> Yes, Microsoft have in their time, done a lot of very good things and 
> some pretty stupid ones. What made me leave the M$ world and turn to 
> Unix/Posix/Linux as that i didn't like the need to rel-earn everything I 
> knew every 2 years. It's tuff to learn Unix, but once you do you can use 
> the knowledge for years. I did not expreince this under the M$ regime 
> and it can even be claim that it's by design.

I don't doubt it.
My first posix machine was an old HP-UX, then SCO (Tpu!) Unix, DEC,
Solaris and now Linux.
I wrote posix code well before I ever wrote a single Win32 line...

> 
> 
> Gilad



-- 
Take care,
Gilboa Davara
XML - Systems Israel.
mailto:[EMAIL PROTECTED]




=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to