On Fri, 18 Aug 2000, Ralf S. Engelschall wrote:

> On Fri, Aug 18, 2000, Igor Khasilev wrote:
> 
> > This is my first letter to this list, so sorry if something wrong with my
> > questions.
> > 
> > 1) Please, can anybody give me a reference to this list archive?
> 
> >From the SUPPORT document in the GNU Pth distribution:
> http://www.mail-archive.com/pth-users@gnu.org/

Thank you.

> 
> > 2) Does anybody tried to use pth on top of native os threads. This will
> > allow to use SMP with pth. 
> 
> Why do you need OS _threads_ for this? It should be sufficient to fork
> _processes_ and let the underlaying OS distribute those over the processors,
> shouldn't it?

OK, let me describe in details what I mean: I have threaded http/ftp proxy
server. Each thread serve one user connect. all threads have access to
two-level document cache: in-memory cache and on-disk cache. As result - I
can't split programm on several processes, because price of synchronization
for cache access will be too high. Because programm designed as "one thread
- one connect" it create lot of threads. I know this design is bad, but I
decide to use this approach because it allow to write clear, portable code.
I don't like event-loop design, and I'm afraid of "matrix" design, because
both they are difficult to maintain.

Ideal design (from the performance point of view) will allow you to have
small amount of threads (approximately one per processor), which can run on
several processors. But pth do not allow me to use several processors in one
application.

1) So, I want write programm so, as if I write "thread per connect" model.
   It is easy and clear.

2) Have very few underlying threads. It is good for performance, and save
   system resources.

If Pth will support several running schedulers, each on top of bound thread,
then this is possible. From my point of view all that is need - synchronyze
queue and event list accesses between scedulers.


> > without any modifications of pth. And it works! At least under solaris.
> > Under Linux if conflicts with linuxthreads SIGUSR usage.
> 
> How does this conflict look? I ask, because Pth uses SIGUSR1 1. only

I got SIGSEGV:
[root@idg .libs]# gdb ./test_misc 
GNU gdb 19991004
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) run
Starting program: /tmp/pth-1.3.7/.libs/./test_misc 

Program received signal SIGUSR1, User defined signal 1.
0x40070deb in __sigsuspend (set=0xbffff75c)
    at ../sysdeps/unix/sysv/linux/sigsuspend.c:48
48      ../sysdeps/unix/sysv/linux/sigsuspend.c: No such file or directory.
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x40047507 in pthread_sighandler (signo=10, ctx={gs = 0, __gsh = 0, fs = 0, 
      __fsh = 0, es = 43, __esh = 0, ds = 43, __dsh = 0, edi = 3221223260, 
      esi = 3221223260, ebp = 3221223236, esp = 3221223208, ebx = 3221223260, 
      edx = 0, ecx = 8, eax = 4294967292, trapno = 1, err = 0, 
      eip = 1074204139, cs = 35, __csh = 0, eflags = 514, 
      esp_at_signal = 3221223208, ss = 43, __ssh = 0, fpstate = 0x0, 
      oldmask = 2147484160, cr2 = 0}) at signals.c:86
86      signals.c: No such file or directory.
(gdb) where
#0  0x40047507 in pthread_sighandler (signo=10, ctx={gs = 0, __gsh = 0, 
      fs = 0, __fsh = 0, es = 43, __esh = 0, ds = 43, __dsh = 0, 
      edi = 3221223260, esi = 3221223260, ebp = 3221223236, esp = 3221223208, 
      ebx = 3221223260, edx = 0, ecx = 8, eax = 4294967292, trapno = 1, 
      err = 0, eip = 1074204139, cs = 35, __csh = 0, eflags = 514, 
      esp_at_signal = 3221223208, ss = 43, __ssh = 0, fpstate = 0x0, 
      oldmask = 2147484160, cr2 = 0}) at signals.c:86
#1  0x40070c68 in __restore ()
    at ../sysdeps/unix/sysv/linux/i386/sigaction.c:127
#2  0x40018e86 in __pth_mctx_set () from /tmp/pth-1.3.7/.libs/./libpth.so.13
#3  0x4001b131 in pth_spawn () from /tmp/pth-1.3.7/.libs/./libpth.so.13
#4  0x4001abd0 in pth_init () from /tmp/pth-1.3.7/.libs/./libpth.so.13
#5  0x8048cc1 in main ()
#6  0x4006a9cb in __libc_start_main (main=0x8048ca4 <main>, argc=1, 
    argv=0xbffffa94, init=0x8048894 <_init>, fini=0x80490bc <_fini>, 
    rtld_fini=0x4000ae60 <_dl_fini>, stack_end=0xbffffa8c)
    at ../sysdeps/generic/libc-start.c:92
(gdb) quit


> temporarily and 2. only if a new thread is spawned.  So, is it really
> conflicting there? OTOH if you have this conflict you can easily use SIGUSR2

I thought that SIGUSR1 was reason ,but this is not true. As you suggest I
changed SIGUSR1 in pth_ctxt to different signal, and got SIGSEGV again:

(gdb) run
Starting program: /tmp/pth-1.3.7/.libs/test_misc 

Program received signal SIGSEGV, Segmentation fault.
0x40047507 in pthread_sighandler (signo=28, ctx={gs = 0, __gsh = 0, fs = 0, 
      __fsh = 0, es = 43, __esh = 0, ds = 43, __dsh = 0, edi = 3221223260, 
      esi = 3221223260, ebp = 3221223236, esp = 3221223208, ebx =
3221223260, 
      edx = 0, ecx = 8, eax = 4294967292, trapno = 1, err = 0, 
      eip = 1074204139, cs = 35, __csh = 0, eflags = 514, 
      esp_at_signal = 3221223208, ss = 43, __ssh = 0, fpstate = 0x0, 
      oldmask = 2281701376, cr2 = 0}) at signals.c:86
86      signals.c: No such file or directory.
(gdb) where
#0  0x40047507 in pthread_sighandler (signo=28, ctx={gs = 0, __gsh = 0, 
      fs = 0, __fsh = 0, es = 43, __esh = 0, ds = 43, __dsh = 0, 
      edi = 3221223260, esi = 3221223260, ebp = 3221223236, esp =
3221223208, 
      ebx = 3221223260, edx = 0, ecx = 8, eax = 4294967292, trapno = 1, 
      err = 0, eip = 1074204139, cs = 35, __csh = 0, eflags = 514, 
      esp_at_signal = 3221223208, ss = 43, __ssh = 0, fpstate = 0x0, 
      oldmask = 2281701376, cr2 = 0}) at signals.c:86
#1  0x40070c68 in __restore ()
    at ../sysdeps/unix/sysv/linux/i386/sigaction.c:127
#2  0x40018e86 in __pth_mctx_set () from /tmp/pth-1.3.7/.libs/./libpth.so.13
#3  0x4001b131 in pth_spawn () from /tmp/pth-1.3.7/.libs/./libpth.so.13
#4  0x4001abd0 in pth_init () from /tmp/pth-1.3.7/.libs/./libpth.so.13
#5  0x8048cc1 in main ()
#6  0x4006a9cb in __libc_start_main (main=0x8048ca4 <main>, argc=1, 
    argv=0xbffffa94, init=0x8048894 <_init>, fini=0x80490bc <_fini>, 
    rtld_fini=0x4000ae60 <_dl_fini>, stack_end=0xbffffa8c)
    at ../sysdeps/generic/libc-start.c:92
(gdb) 


> if you want. Just replace all occurrances of SIGUSR1 with SIGUSR2 in
> pth_mctx.c and recompile Pth. SIGUSR1 is nowhere else hard-coded.

Wait, a minute, can it be known problem with linuxtreads when current
thread is detected usin stack address? So if you use alternate stack,
linuxthreads will crash?


Igor Khasilev                |
PACO Links, [EMAIL PROTECTED]    |

______________________________________________________________________
GNU Portable Threads (Pth)            http://www.gnu.org/software/pth/
User Support Mailing List                            [EMAIL PROTECTED]
Automated List Manager (Majordomo)           [EMAIL PROTECTED]

Reply via email to