Date: Tue, 20 Apr 1999 17:19:57 -0400 (EDT) From: Luoqi Chen <luoqi@watermarkgroup.com> To: dick@tar.com, jplevyak@inktomi.com Cc: hackers@FreeBSD.ORG Subject: Re: flock + kernel threads bug Message-ID: <199904202119.RAA17889@lor.watermarkgroup.com>
next in thread | raw e-mail | index | archive | help
> > POSIX threads specs require "threads" to have the same PID as the "process" > > that spawns them. > > > > The current kernel structure in FreeBSD does not support this notion. > > Once consequence is that posix kernel threads in FreeBSD will have > > trouble being fully compliant, which affects at least signal handling > > and the priority functions, and probably others (in addition to the > > file locking issue raised here). Using p->p_leader to proxy for the > > idea that each thread should have the same PID as the process is > > helpful, but doesn't solve the problem completely. > > > > The better solution to this problem will come when/if there is better > > support for the distinction between "kernel threads" and "processes". > > I fully agree. Given that kernel threads are currently implemented > as processes it might be easiest to migrate to such a model by > initially using struct proc for both processes and kernel threads > and use 'p->p_leader->XXX' to access 'process' values including > PID, and p->XXX to access 'thread' values. It may be prefereble > to do a little rename p_leader -> p_proc. > > At some point it may be possible to bifricate 'struct proc' and 'struct thread'. > No, this is not an issue of separate task and thread structures. You may have the same problem for two separate processes that share file descriptor table, and john's fix would not work for this case. The correct solution to this problem (in my opinion) is to clear all POSIX locks upon closure of a file descriptor, which requires we keep in the file descriptor table a list of procs that reference it. -lq To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199904202119.RAA17889>