For Kernel_Newbies By a Kernel_Newbie
- USER_PGD_PTRS which has 768 entries: (1024 * 3 / 4)
- KERNEL_PGD_PTRS which has 256 entries:(Remaining obv. or 1024 * 1/4)
These will be discussed when Page tables will be taken up. The cpu
information found is loaded up into boot_cpu_data. setup_idt initialises the IDT
with 256 entries pointing to no_int,which is the bad interrupt handler defined
in head.S. The ldt and the gdt entries are loaded, (There are 8192 LDT entries
which modify_ldt manual says that they are used by the processor to keep track
of the memory management tables per process.I am not sure about the usage stats
of LDT. GDT entries are loaded with 140 quadwords,depended on NR_CPUS, in
head.S. They denote the data_segment switch and the Code segment
switch(0x10->Kernel Code,0x18 for Kernel Data,0x23 for User_Code and 0x2b for
User_Data->segment.h says that) ,and specify the protection on the segments
for text and data. (Am I Right ???) Jump to start_kernel takes place only for
BP(Boot Processor),and all other APs (Application Processor) (if in SMP) call
initialize_secondary.start_kernel initialises a whole lot of things,which you
can checkout in init/main.c before creating the init kernel_thread,and starts of
the init as a Kernel Thread.
Kernel Thread:
A Kernel_thread is a cloned thread,which is defined in
arch/i386/kernel/process.c. A good example of a Kernel Thread is \"keventd\" which
is started as a kernel_thread using
start_context_thread(context_thread,NULL,CLONE_FILES | CLONE_FS) in
kernel/context.c which has the operations for the kernel thread keventd.A
kernel_thread usually runs in the background, releasing its memory map,and the
files struct and becoming one with \"init\" by calling daemonize() defined
kernel/sched.c. keventd gives up its resources,becomes one with init,and goes
into background, trying to wait for someone to call schedule_task. It blocks
till someone calls schedule_task by putting itself into its wait_queue,calling
schedule,thereby waiting for someone to wake it up through a call to
schedule_task. schedule_task queues up the tq_struct passed as an argument in
the task_queue tq_context.(DECLARE_TASK_QUEUE(tq_context) ). It then wakes up
the keventd process,blocking in its wait_queue,for someone to wake it up,in
order to consume the tq_context queue. After consuming the tq_context queue,it
- « first
- ‹ previous
- of 24
- next ›
- last »