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
86
votes
5 answers

Selecting a Linux I/O Scheduler

I read that it's supposedly possible to change the I/O scheduler for a particular device on a running kernel by writing to /sys/block/[disk]/queue/scheduler. For example I can see on my system: anon@anon:~$ cat /sys/block/sda/queue/scheduler noop…
Robert S. Barnes
  • 39,711
  • 30
  • 131
  • 179
84
votes
7 answers

Which real-time priority is the highest priority in Linux

In the Linux real-time process priority range 1 to 99, it's unclear to me which is the highest priority, 1 or 99. Section 7.2.2 of "Understanding the Linux Kernel" (O'Reilly) says 1 is the highest priority, which makes sense considering that…
David Steinhauer
  • 2,076
  • 2
  • 16
  • 14
83
votes
2 answers

Magic numbers of the Linux reboot() system call

The Linux Programming Interface has an exercise in Chapter 3 that goes like this: When using the Linux-specific reboot() system call to reboot the system, the second argument, magic2, must be specified as one of a set of magic numbers…
Wei Hu
  • 2,888
  • 2
  • 27
  • 28
83
votes
3 answers

Context switch internals

I want to learn and fill gaps in my knowledge with the help of this question. So, a user is running a thread (kernel-level) and it now calls yield (a system call I presume). The scheduler must now save the context of the current thread in the TCB…
Bruce
  • 33,927
  • 76
  • 174
  • 262
82
votes
6 answers

Accurate calculation of CPU usage given in percentage in Linux?

It's a question which has been asked many times, however there is no well supported answer I could find. Many people suggest the use of top command, but if you run top once (because you have a script for example collecting Cpu usage every 1 second)…
Vangelis Tasoulas
  • 3,109
  • 3
  • 23
  • 36
80
votes
4 answers

How to fix: fatal error: openssl/opensslv.h: No such file or directory in RedHat 7

I have RedHat Enterprise Linux Server 7, and I downloaded the linux kernel version 4.12.10 which I am trying to compile but when I execute the following command: make modules I get the following error: scripts/sign-file.c:25:30: fatal error:…
rainman
  • 2,551
  • 6
  • 29
  • 43
80
votes
3 answers

How much memory could vm use

I read the document Understanding Virtual Memory and it said one method for changing tunable parameters in the Linux VM was the command: sysctl -w vm.max_map_count=65535 I want to know what the number 65535 means and how much memory could vm use by…
solomon_wzs
  • 1,711
  • 5
  • 16
  • 29
79
votes
3 answers

What are the implications of the linux __user macro?

I was hoping someone could explain the nuances of the __user macro used in the linux kernel source. First of all, the macro: # define __user __attribute__((noderef, address_space(1))) Now, after some googling I read that this macro allows…
Mr. Shickadance
  • 5,283
  • 9
  • 45
  • 61
79
votes
3 answers

How does Docker run a Linux kernel under macOS host?

I installed Docker on my macOS Sierra as follows. Note I don't have VirtualBox installed. brew cask uninstall virtualbox brew cask install docker My macOS details. $ uname -a Darwin m-C02QG7TRG8WN.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar …
Lone Learner
  • 18,088
  • 20
  • 102
  • 200
78
votes
2 answers

How can I identify the request queue for a linux block device

I am working on this driver that connects the hard disk over the network. There is a bug that if I enable two or more hard disks on the computer, only the first one gets the partitions looked over and identified. The result is, if I have 1 partition…
ndasusers
  • 1,131
  • 2
  • 10
  • 6
78
votes
5 answers

What does it mean by cold cache and warm cache concept?

I read a paper and it used terms cold cache and warm cache. I googled about this terms but I didn't find something useful (only a thread here). What do these terms mean?
Amir
  • 16,067
  • 10
  • 80
  • 119
78
votes
5 answers

Linux Kernel: System call hooking example

I'm trying to write some simple test code as a demonstration of hooking the system call table. "sys_call_table" is no longer exported in 2.6, so I'm just grabbing the address from the System.map file, and I can see it is correct (Looking through the…
Stephen
  • 4,176
  • 2
  • 24
  • 29
73
votes
4 answers

/lib64/ld-linux-x86-64.so.2: No such file or directory error

Background I am using docker to do a school project. Specifically, I pulled an ubuntu image and here is the system config: I then logged into the docker container (ubuntu) and set up elasticsearch. When I try to run ./bin/elasticsearch I get the…
Rieder
  • 1,125
  • 1
  • 11
  • 18
73
votes
5 answers

Whole one core dedicated to single process

Is there any way in Linux to assign one CPU core to a particular given process and there should not be any other processes or interrupt handlers to be scheduled on this core? I have read about process affinity in Linux Binding Processes to CPUs…
akp
  • 1,753
  • 3
  • 18
  • 26
72
votes
6 answers

How closely are Mac OS X and BSD related?

I read that Mac OS X and bsd are related. How closely are they related. Can Mac OS X software be tweaked and installed on BSD?
Boolean
  • 14,266
  • 30
  • 88
  • 129