Questions tagged [linux-kernel]

This tag is for questions about the internals of the Linux kernel itself - particularly about writing code that runs within the context of the kernel (like kernel modules or drivers). Questions about writing userspace code in Linux should generally be tagged [linux] instead. Since the internals of the Linux kernel are constantly changing, it is helpful to include the precise kernel version(s) that you are interested in.

This tag is for questions about the internals of the Linux kernel itself - particularly about writing code that runs within the context of the kernel (like kernel modules or drivers).

Questions about writing userspace code in Linux should generally be tagged instead. Since the internals of the Linux kernel are constantly changing, it is helpful to include the precise kernel version(s) that you are interested in.

The kernel is a UNIX-like kernel initially created by Linus Torvalds in 1991 and now is maintained by developers around the world.

Frequently Asked Questions

Online resources

Books

Kernel source code and source code browsers

Further reading

Mailing lists

17371 questions
52
votes
2 answers

Linux SCHED_OTHER, SCHED_FIFO and SCHED_RR - differences

Can someone explain the differences between SCHED_OTHER, SCHED_FIFO and SCHED_RR? Thanks
eve
  • 2,959
  • 4
  • 21
  • 18
52
votes
5 answers

How does the linux kernel manage less than 1GB physical memory?

I'm learning the linux kernel internals and while reading "Understanding Linux Kernel", quite a few memory related questions struck me. One of them is, how the Linux kernel handles the memory mapping if the physical memory of say only 512 MB is…
TheLoneJoker
  • 1,589
  • 1
  • 23
  • 36
52
votes
4 answers

How to use netlink socket to communicate with a kernel module?

I am trying to write a linux kernel module that communicates with user process using netlink. I am using netlink because the user program I want to communicate to communicates only using sockets and I can't change that to add ioctl() or anything. I…
binW
  • 13,220
  • 11
  • 56
  • 69
52
votes
3 answers

Difference between KVM and LXC

What is the difference between KVM and Linux Containers (LXCs)? To me it seems, that LXC is also a way of creating multiple VMs within the same kernel if we use both "namespaces" and "control groups" features of kernel.
JuliandotNut
  • 1,169
  • 1
  • 12
  • 22
51
votes
3 answers

How can I create a device node from the init_module code of a Linux kernel module?

I am writing a module for the Linux kernel, and I want to create some device nodes in the init() function: int init_module(void) { Major = register_chrdev(0, DEVICE_NAME, &fops); // Now I want to create device nodes // with the returned…
Alptugay
  • 1,676
  • 4
  • 22
  • 29
51
votes
2 answers

Where is linux-vdso.so.1 present on the file system

I am learning about VDSO, wrote a simple application which calls gettimeofday() #define _GNU_SOURCE #include #include #include #include #include #include int main(int argc,…
md.jamal
  • 4,067
  • 8
  • 45
  • 108
51
votes
3 answers

Difference between pthread and fork on gnu/Linux

What is the basic difference between a pthread and fork w.r.t. linux in terms of implementation differences and how the scheduling varies (does it vary ?) I ran strace on two similar programs , one using pthreads and another using fork, both in the…
srinathhs
  • 1,998
  • 4
  • 19
  • 33
51
votes
4 answers

Converting jiffies to milli seconds

How do I manually convert jiffies to milliseconds and vice versa in Linux? I know kernel 2.6 has a function for this, but I'm working on 2.4 (homework) and though I looked at the code it uses lots of macro constants which I have no idea if they're…
EpsilonVector
  • 3,973
  • 7
  • 38
  • 62
51
votes
2 answers

What is the opposite of `mknod`?

I am learning to write character device drivers from the Kernel Module Programming Guide, and used mknod to create a node in /dev to talk to my driver. However, I cannot find any obvious way to remove it, after checking the manpage and observing…
merlin2011
  • 71,677
  • 44
  • 195
  • 329
51
votes
5 answers

How to know linux scheduler time slice?

I'm looking for the value of the time slice (or quantum) of my Linux kernel. Specific Questions: Is there a /proc file which expose such an information ? (Or) Is it well-defined in the Linux header of my distributions ? (Or) Is there a C function…
backlash
  • 777
  • 1
  • 6
  • 12
50
votes
2 answers

What exactly does Linux kernel's `make defconfig` do?

I can use the following command to create a Linux kernel .config file based on a specified architecture default for a custom ARM-based board: ARCH=arm make defconfig KBUILD_DEFCONFIG=var_som_mx6_android_defconfig I thought that this command more or…
Michael Burr
  • 333,147
  • 50
  • 533
  • 760
50
votes
4 answers

How do the nl80211 library & cfg80211 work?

I want to learn about how nl80211 and cfg80211 work in detail, such as: function flow and how nl80211 interacts with network tools like wpa_supplicant and iw.
Rafal
  • 1,120
  • 3
  • 15
  • 23
49
votes
5 answers

Which C version is used in the Linux kernel?

Does the Linux kernel use only the old C90 syntax or has it been optimized with C99 / C11 features? I was wondering if the newest versions of C are used when possible.
user2686744
48
votes
14 answers

Iptables v1.4.14: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)

I'm trying to set iptable rules, and I got following error message when I use iptable : iptables v1.4.14: can't initialize iptables table `nat': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded. I'm…
Douglas
  • 5,229
  • 3
  • 43
  • 54
48
votes
2 answers

What to choose between Slab and Slub Allocator in Linux Kernel?

What are the factors which help to decide the choice of memory allocators in Linux Kernel? In the present Linux Kernel we have the option of choosing SLAB,SLUB or SLOB. I have read that SLOB is used for Kernel of smaller footprints. But I want to…
Siddharth
  • 2,046
  • 5
  • 26
  • 41