Questions about struct task_struct

Nick Krause xerofoify at gmail.com
Thu Aug 7 16:32:52 EDT 2014


On Thu, Aug 7, 2014 at 4:05 PM,  <Valdis.Kletnieks at vt.edu> wrote:
> On Wed, 06 Aug 2014 18:11:30 -0400, Nick Krause said:
>
>> 1.volatile long state; Is this line like jiffies for timers with
>> regards to the keyword volatile?
>
> Why should it be any different?
>
>> 2.void *stack; Is this a pointer to the kernel stack for the process
>> related to the process
>> that the structure is keeping data for and is void to make it an
>> opaque data type? Is this
>> normally an int or some other data type when called with most processes?
>
> Under what conditions would it be an int?  Think a bit.
>
>> 3.unsigned int flags; /* per process flags, defined below */, My only
>> question about this is
>> what flags are there and are these the ifdef statements in the struct?
>
> You explain what "ifdef statements in the struct" means, and maybe
> we'll be able to explain that to you..
>
>> 4.Why are we making the usage count atomic?(pretty obvious but real
>> world reasons would be great)
>
> If you don't understand why usage and reference counts need to be atomic,
> you've got a *lot* to learn about race conditions.
>
>> 8.What are the options like CONFIG_PREEMPT_RCU used for in terms of
>> workloads or locking as I heard a lot about
>> them on the threads on the lkml?
>
> Start looking at Kconfig files.  Most of them are documented.
Thanks Valdis,
I was just curious if I was correct in my understanding of task struct,
seems I am so far and yes I do known why we have reference counting,
I was more curious about how to trace issues with this for debugging.
Regards Nick



More information about the Kernelnewbies mailing list