List:General Discussion« Previous MessageNext Message »
From:Bennett Haselton Date:November 22 2001 3:42am
Subject:RE: does each database connect cause mysqld to fork?
View as plain text  
Do you mean processes instead of threads?

(ps lists each *process* separately, along with its process ID, but doesn't 
list separate threads within each process.  If mysqld handles each new 
connection by calling fork(), then I think fork() creates a new process, 
not a new thread.)

         -Bennett

At 04:39 PM 11/22/2001 +1300, Quentin Bennett wrote:
>Hi,
>
> From previous message (I don't run linux), I believe that linux ps lists 
> all
>threads, and mysqld does create a thread for each connection.
>
>Regards
>
>Quentin
>
>-----Original Message-----
>From: Bennett Haselton [mailto:bennett@stripped]
>Sent: Thursday, 22 November 2001 4:15 p.m.
>To: mysql@stripped
>Subject: does each database connect cause mysqld to fork?
>
>
>Each time I open a database handle (in perl code), does that cause a new
>process to run, a new instance of mysqld?  And each time I disconnect the
>database handle ($dbh->disconnect() in perl code), does that cause the
>number of running instances of mysqld to go down by one?
>
>The process list on my Linux server includes several instances of mysqld:
>
>server1:/home/bhaselto/web/html$ ps auwx | grep mysqld
>root      1014  0.0  0.0  1672    0 ?        SW   Nov05   0:00
>[safe_mysqld]
>mysql     1037  0.0  3.6 15172 9484 ?        S    Nov05  22:10
>/usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --
>mysql     1039  0.0  3.6 15172 9484 ?        R    Nov05  19:02
>/usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --
>mysql     1040  0.0  3.6 15172 9484 ?        S    Nov05   0:04
>/usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --
>mysql     4518  0.0  0.0     0    0 ?        Z    21:07   0:00 [mysqld
><defunct>]
>mysql     4519  0.0  3.6 15172 9484 ?        R    21:07   0:00
>/usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --
>
>so I was wondering if that was the explanation -- I know I have multiple
>running scripts that use the database at the same time, although I thought 
>
>they generally didn't leave the handles open that long.
>
>         -Bennett
>
>bennett@stripped     http://www.peacefire.org
>(425) 649 9024
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <mysql-thread91929@stripped>
>To unsubscribe, e-mail
><mysql-unsubscribe-quentin.bennett=infinity.co.nz@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>The information contained in this email is privileged and confidential
>and intended for the addressee only. If you are not the intended
>recipient, you are asked to respect that confidentiality and not
>disclose, copy or make use of its contents. If received in error
>you are asked to destroy this email and contact the sender immediately.
>Your assistance is appreciated.


bennett@stripped     http://www.peacefire.org
(425) 649 9024

Thread
does each database connect cause mysqld to fork?Bennett Haselton22 Nov
  • Re: does each database connect cause mysqld to fork?Paul DuBois23 Nov
RE: does each database connect cause mysqld to fork?Quentin Bennett22 Nov
  • RE: does each database connect cause mysqld to fork?Bennett Haselton22 Nov
    • Re: does each database connect cause mysqld to fork?Dan Nelson22 Nov