barrios's kernel story
Tuesday, April 03, 2007
Sunday, December 31, 2006
Thursday, November 02, 2006
Friday, May 12, 2006
Kernel Syncronization
kernel control path
sequence of instruction executed by the kernel to handle a system call, an exception, or an interrupt
Nested Execution of Exception and Interrupt Handlers
Kernel control paths may be arbitrarily nested; an interrupt handler may be interrupted by another interrupt handler
The price to pay for allowing nested kernel control paths is that an interrupt handler must never block, that is, no process switch can take place until an interrupt handler is running. In fact, all the data needed to resume a nested kernel control path is stored in ther Kernel Mode stack, which is tightly bound to the current process
Interrupt handler may preempt both other interrupt handlers and exception handlers. But an exception handler never preempts an interrpt handler. only exception is "Page Fault"
Interrupt handler never perform operations that can induce page faluts, and thus, potentially, a process switch
Kernel Preemption
reference : Performing the Process Switch
Essentially, every process switch consists of two steps:
1. Switching the Page Global Directory to install a new address space
2. Switching the Kernel Mode stack and the hardware context, which provides all the information needed by the kernel to execute the new process, including the CPU registers.
just a moment here. :-)
Hardware Context ?
the set of data that must be loaded into the registers before the process resumes its execution on the CPU. The hardware context is a subset of the process execution context, which includes all information needed for the process execution. In Linux, a part of the hardware context of a process is stored in the process descriptor, while the remaining part is saved in the Kernel Mode stack.
Process switching occurs only in Kernel Mode. The contents of all registers used by a process in User Mode have already been saved on the Kernel Mode stack before performing process switching.
The main motivation for making a kernel preemptive is to reduce the dispatch latency of the User Mode process, that is, the delay between the time they become runnable and the time they actually begin running.
Kernel don't allowed kernel preemption when any of the following cases occurs:
1. Then kernel is executing an interrupt sevice routine.
2. The deferrable functions are desabled(always true when the kernel is executing a softirq or tasklet)
3. The kernel preemption has been explictly disabled by setting the preemption counter to a positive value
Tje above rules tell us that the kernel can be preempted only when it is executing an exception handler(in particular a system call) and the kernel preemption has not been explictly disabled.
Critical Region
If the sytstem includes a single CPU, the critical region can be implemented by disableing interrupts while accessing the shared data structure, because nesting of kernel control paths can only occur when interrupts are enabled.
On the other hand, if the same data structure is accessed only by the service routines of system call, and if the system includes a single CPU, the critical region can be implemented quite simply by disabling kernel preemption while accessing the shared data structure.
When Synchronization is Not Necessay
1. All interupt handlers acknowledge the interrupt on the PIC and also disable the IRQ line. Further occurrences of the same interrupt cannot occur until the handler terminates.
2. Interrupt handler, softirqs, and tasklets are both nonpreemptable and non-blocking, so they cannot be suspended for a long time interval. In the worst case, their execution will be slightly delayed, because other interrupts occur during their execution
3. A kernel control path performing interrupt handling cannot be interrupted by a kernel control path executing a deferrable function or a system call service routine.
4. Softirqs and tasklets cannot be interleabed on a given CPU.
5. The same tasklet cannot be executed simultaneously on several CPUs.
So,
1. Interrupt handlers and tasklets need not to be coded as reentrant fuctions.
2. Per-CPU varables accessed by softirqs and tasklets only do not require synchronization.
3. A data structure accessed by only one kind of tasklet does not require synchronization.
Synchornization Primitives.
Tuesday, April 18, 2006
2006/04/18
These days the job market is very tight in the Korea.
Fortunately, I work for software engineer in Samsung Electronics Software Lab.
I have finished my tranning program for a two month.
Currently, I use commuter buses at Suwon. It takes two hours.
Because I am still a new recruit, I get to work by 8 to 5 o'clock. :-) so I learn still the many education program in the samsung company now.
Therefore, I must wake up early. Usually, I wake up at 5 o'clock. I always try to be an industrious worker.
I am getting used to the work. :-)
Wednesday, February 08, 2006
My younger brother
He always enjoy the game on the weekend. One of games which he enjoy is startcraft.
I think that above sentence's grammer is wrong. :-( How to write ??
In fact, I enjoy the starc, too. :-)
He works at LG electronics home theater team. He is a H/W enginner.
My major is computer enginnering. so I am a S/W enginner.
I hope that We establish the company.
ps) There is a board in the picture. That is a Onenand board. Onenand is samsung's new flash memory. I develop the onenand driver and linux's mtd layer porting for onenand flash memory.
Tuesday, February 07, 2006
2006/02/08
It snowed heavily in the morning.
I will meet someone for selling my PDD at 11:00. Although it was time for meeting, I was sleeping. Fortunately, He was so late because it snowed heavily. As soon as I get up, I go to the place for meeting and sell my PDA.
I earn the money. so I will buy the memory stick 1G.
In these day, I indulge in PSP :-)
ps) Alomostly, My department is determined in Samsung Electronics software R&D center Embedded O/S Group kernel team.