The esp register is the CPU stack pointer, which is used to address the stack’s top location. On Intel systems, the stack starts at the end and grows toward the beginning of the memory area. Right after switching from User … Continue reading
Processes are dynamic entities whose lifetimes in the system range from a few milliseconds to months. Thus, the kernel must be able to handle many processes at the same time.The kernel reserves a global static array of size NR_TASKS called … Continue reading
Lightweight processes should not be confused with user-mode threads, which are different execution flows handled by a user-level library. For instance, older Linux systems implemented POSIX threads entirely in user space by means of the pthread library; therefore,a multithreaded program … Continue reading
Linux programs the first PC’s PIT to issue timer interrupts on the IRQ0 at a (roughly) 100-Hz frequency, that is, once every 10 milliseconds. This time interval is called a tick, and its length in microseconds is stored in the … Continue reading
Starting with the Pentium, many recent Intel 80×86 microprocessors include a 64-bit Time Stamp Counter (TSC ) register that can be read by means of the rdtsc assembly language instruction. This register is a counter that is incremented at each … Continue reading
t is rare (even unknown) for kernel code to create a standalone kobject; instead, kobjects are used to control access to a larger, domain-specific object. To this end, kobjects are found embedded in other structures. If you are used to … Continue reading
Two main kinds of timing measurement that must be performed by the Linux kernel: Keeping the current time and date, so that they can be returned to user programs through the time( ), ftime( ), and gettimeofday( ) system calls. … Continue reading
The sequence of instructions executed in Kernel Mode to handle a kernel request is denoted as kernel control path : when a User Mode process issues a system call request, for instance, the first instructions of the corresponding kernel control … Continue reading
??All Unix kernels are reentrant : this means that several processes may be executing in Kernel Mode at the same time. Of course, on uniprocessor systems only one process can progress, but many of them can be blocked in Kernel … Continue reading
Block drivers often attempt to retry requests that fail the first time. This behavior can lead to a more reliable system and help to avoid data loss. The kernel, however, sometimes marks requests as not being retryable. Such requests should … Continue reading
The bio structure contains everything that a block driver needs to carry out the request without reference to the user-space process that caused that request to be initiated. The bio structure, which is defined in <linux/bio.h>, contains a number of … Continue reading
There are different types of USB devices as they can be used for different purposes. First a device can be self powered, bus powered or both. The USB can provide a power supply up to 500mA for its devices. If … Continue reading
Once sbull_open has its device structure pointer, it calls del_timer_sync to remove the “media removal” timer, if any is active. Note that we do not lock the device spinlock until after the timer has been deleted; doing otherwise invites deadlock … Continue reading
The kernel provides the function elv_next_request to obtain the first incomplete request on the queue, that function returns NULL when there are no requests to be processed. Note that elv_next_request does not remove the request from the queue. If you … Continue reading
struct gendisk (declared in <linux/genhd.h>) is the kernel’s representation of an indi- vidual disk device. In fact, the kernel also uses gendisk structures to represent parti- tions, but driver authors need not be aware of that. There are several fields … Continue reading