Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Sep 2002 13:07:39 -0700 (PDT)
From:      Julian Elischer <julian@elischer.org>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        arch@freebsd.org, Alfred Perlstein <bright@mu.org>
Subject:   Re: Process/thread states.
Message-ID:  <Pine.BSF.4.21.0209031245020.12482-100000@InterJet.elischer.org>
In-Reply-To: <XFMail.20020903152715.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help


On Tue, 3 Sep 2002, John Baldwin wrote:

> 
> On 03-Sep-2002 Julian Elischer wrote:
> > We'd (david and I) like to go ahead and provide a general patch to
> > implement this, for others to peruse, but we'd like to 
> > hear if there will be screaming first before we do more work on it..
> 
> Please be consistent.  You have SLEEPING, so I would use SLEEP instead
> of SLP.  Also, I would use CLEAR instead of CLR.  Personally I don't
> want to have to use Caps Lock to write kernel code and I find the
> kernel shouting at me about thread states to be a bit much (I don't
> see why just using == to check a thread state is all that hard).

because it in some cases actually becomes: (due to the fact thst you
can be on the sleep queue AND teh run queue)
#define TD_ON_RUNQ(td) (((td)->td_state & TD_BASE_MASK) == TD_ST_RUNQ)
as you have to separate out the sleep queue bit.

Ther eis a possibility that these states may get worse when thread
suspensions and swapping are added to the picture.

A thread can be swapped (as part of the process), AND sleeping AND
suspended.

Do you really want to type that sort of test everywhere?
By making it a macro we can keep the implementation of this state
hidden. e.g if we move the RUNQ part of the state to td_flags
to make it independently testable, the rest of the code doesn;t have to
know how we optimised this. (we are discussing this exact change now).
similarly for swapped.. or other states.

> Just please at least be consistent if you are going to uglify things.
I prefer TD_ON_RUNQ(td)
to
(((td)->td_state & TD_BASESTATE_MASK) == TD_ST_RUNQ)

> 
> -- 
> 
> John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
> "Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-arch" in the body of the message
> 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0209031245020.12482-100000>