Questions about struct task_struct

Nick Krause xerofoify at gmail.com
Wed Aug 6 18:11:30 EDT 2014


I am new to kernel programming and have a lot  questions about this
structure. Also if after you guys reply I have a few \
questions for Greg Kroah Hartman about usb development and stable
trees. I am very excited about learning this properly
now and if anyone notices something wrong in my understanding please
let me known :).
Thanks So Much,
Nick
Questions about task_struct
1.volatile long state; Is this line like jiffies for timers with
regards to the keyword volatile?
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?
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?
4.Why are we making the usage count atomic?(pretty obvious but real
world reasons would be great)
5.I assume int ptrace is for ptrace or debugged processes? If I wrong
please let me known too.
6. What is wakkee_flips and wakkee_flips_decay used for?
7.This is probably a stupid question but are these the scheduler cases for CFS?
1240 int on_rq;
1241
1242 int prio, static_prio, normal_prio;
1243 unsigned int rt_priority;
1244 const struct sched_class *sched_class;
1245 struct sched_entity se;
1246 struct sched_rt_entity rt;
1247 #ifdef CONFIG_CGROUP_SCHED
1248 struct task_group *sched_task_group;
1249 #endif
1250 struct sched_dl_entity dl;
8.What are preempt notifiers and what are they for?(another stupid question)
9. Are these lines for the policy used and to block certain processes
to only a few processors?
1261 unsigned int policy;
1262 int nr_cpus_allowed;
1263 cpumask_t cpus_allowed;
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?

P.S. Sorry about some many questions,. Answer then whenever you guys
have time and if there stupid and easily found
somewhere let me known.



More information about the Kernelnewbies mailing list