162

In the early stages of Linux, Linus Torvalds released the Linux kernel source in an alpha state to signal to others that work towards a new Unix-like kernel was in development. By that time, as @RalfFriedi stated, the Linux kernel was cross-compiled in Minix. As for usable software, Linus Torvalds also ported utilities to distribute along with the Linux ...


151

GNU will not adopt something as a project unless the developers agree to certain stipulations which bind all official GNU projects. Currently the Linux kernel probably does not fit these restrictions, and there is nothing for Linus Torvalds, kernel.org, et al. to gain from placing themselves under the GNU umbrella, and a lot to lose -- the aforementioned ...


135

A couple of years ago, Linus Torvalds was discussing Linux version numbers and said, "I think I will call it 3.11 Linux for Workgroups." It turns out he wasn't joking. With a release candidate of Linux 3.11 now available, Torvalds has actually named the new version of the kernel "Linux for Workgroups." He even gave it a Windows-themed boot icon ...


125

When the kernel is tainted, it means that it is in a state that is not supported by the community. Most kernel developers will ignore bug reports involving tainted kernels, and community members may ask that you correct the tainting condition before they can proceed with diagnosing problems related to the kernel. In addition, some debugging functionality and ...


108

$ cat /proc/cmdline root=/dev/xvda xencons=tty console=tty1 console=hvc0 nosep nodevfs ramdisk_size=32768 ip_conntrack.hashsize=8192 nf_conntrack.hashsize=8192 ro devtmpfs.mount=1 $


102

This Samba new vulnerability is already being called "Sambacry", while the exploit itself mentions "Eternal Red Samba", announced in twitter (sensationally) as: Samba bug, the metasploit one-liner to trigger is just: simple.create_pipe("/path/to/target.so") Potentially affected Samba versions are from Samba 3.5.0 to 4.5.4/4.5.10/4.4.14. If your Samba ...


84

The idle task is used for process accounting, and also to reduce energy consumption. In Linux, one idle task is created for every processor, and locked to that processor; whenever there’s no other process to run on that CPU, the idle task is scheduled. Time spent in the idle tasks appears as “idle” time in tools such as top. (Uptime is calculated differently....


83

bc is used during the kernel build to generate time constants in header files. You can see it invoked in Kbuild, where it processes kernel/time/timeconst.bc to generate timeconst.h. This could be implemented as a C program which is built and run during the build, but it’s easier to use bc (which is small and common; in fact it’s part of the set of tools ...


82

In user space programs, main() is the entry point to the program that is called by the libc initialization code when the binary is executed. Kernel code does not have the luxury to rely on libc, as libc itself relies on the kernel syscall interface for memory allocation, I/O, process managements etc. That said, the equivalent of main() in kernel code is ...


80

Simplified, it goes more or less like this: The kernel logs messages (using the printk() function) to a ring buffer in kernel space. These messages are made available to user-space applications in two ways: via the /proc/kmsg file (provided that /proc is mounted), and via the sys_syslog syscall. There are two main applications that read (and, to some ...


79

According to cloc run against 3.13, Linux is about 12 million lines of code. 7 million LOC in drivers/ 2 million LOC in arch/ only 139 thousand LOC in kernel/ lsmod | wc on my Debian laptop shows 158 modules loaded at runtime, so dynamically loading modules is a well-used way of supporting hardware. The robust configuration system (e.g. make menuconfig) ...


79

On my system it gets the uptime from /proc/uptime: $ strace -eopen uptime open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 open("/lib/libproc-3.2.8.so", O_RDONLY|O_CLOEXEC) = 3 open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 open("/proc/version", O_RDONLY) = 3 open("/sys/devices/system/cpu/online", O_RDONLY|O_CLOEXEC) = 3 open("/etc/...


77

There is much documentation and discussion on this on the net. The short answer that there are deep ideological differences between the GNU project and the Linux kernel projects, which gets in the way of a possible unification. The focus of the FSF, the organization behind the GNU Project, is on ideological purity with respect to the idea of free software. ...


76

By default modprobe loads modules from subdirectories located in the /lib/modules/$(uname -r) directory. Usually all files have extension .ko, so you can list them with find /lib/modules/$(uname -r) -type f -name '*.ko' or, taking into account compressed files: find /lib/modules/$(uname -r) -type f -name '*.ko*' However, to load a module successfully ...


67

For anyone curious, here's the linecount breakdown for the GitHub mirror: ============================================= Item Lines % ============================================= ./usr 845 0.0042 ./init 5,739 0.0283 ./samples 8,758 0.0432 ./ipc 8,926 ...


60

The Unix boot process has (had) only limited capabilities of intelligently loading a program (relocating it, loading libraries etc). Therefore the initial program was an exact image, stored on disc, of what needed to be loaded into memory and "called" to get the kernel going. Only much later things like (de-)compression were added and although more powerful ...


50

Building a custom kernel can be time consuming -- mostly in the configuration, since modern computers can do the build in a matter of minutes -- but it is not particularly dangerous if you keep your current, working kernel, and make sure to leave that as an option via your bootloader (see step #6 below). This way, if your new one does not work, you can just ...


50

The other answer explains, as its author says, "classic logging" in Linux. That's not how things work in a lot of systems nowadays. The kernel The kernel mechanisms have changed. The kernel generates output to an in-memory buffer. Application softwares can access this in two ways. The logging subsystem usually accesses it as a pseudo-FIFO named /proc/...


50

In the textbook design of a process scheduler, if the scheduler doesn't have any process to schedule (i.e. if all the processes are blocked, waiting for input), then the scheduler waits for a processor interrupt. The interrupt may indicate input from a peripheral (user action, network packet, completed read from a disk, etc.) or may be a timer interrupt that ...


50

I think this part of the clone(2) man page may clear up the difference re. the PID: CLONE_THREAD (since Linux 2.4.0-test8) If CLONE_THREAD is set, the child is placed in the same thread group as the calling process. Thread groups were a feature added in Linux 2.4 to support the POSIX threads notion of a ...


48

This was implemented to the Linux kernel 3.4 as a flag of the system call prctl(). From the prctl(2) manpage: [...] A subreaper fulfills the role of init(1) for its descendant processes. Upon termination of a process that is orphaned (i.e., its immediate parent has already terminated) and marked as having a subreaper, the nearest still living ...


47

No, for the very simple reason that there is a maximum numerical value the PID can have. If a process has the highest PID, no child it forks can have a greater PID. The alternative to giving the child a lower PID would be to fail the fork() altogether, which wouldn't be very productive. The PIDs are allocated in order, and after the highest one is used, ...


45

Just use /sys. Example. I want to find the driver for my Ethernet card: $ sudo lspci ... 02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01) $ find /sys | grep drivers.*02:00 /sys/bus/pci/drivers/r8169/0000:02:00.0 That is r8169. First I need to find coordinates of the device using ...


43

The answers so far seem to be "yes there is lots of code" and nobody is tackling the question with the most logical answer: 15M+? SO WHAT? What does 15M lines of source code have to do with the price of fish? What makes this so unimaginable? Linux clearly does lots. Lots more than anything else... But some of your points show you don't respect what's ...


43

Drivers are maintained in-kernel so when a kernel change requires a global search-and-replace (or search-and-hand-modify) for all users of a function, it gets done by the person making the change. Having your driver updated by people making API changes is a very nice advantage, instead of having to do it yourself when it doesn't compile on a more recent ...


42

SCSI and ATA are entirely different standards. They are currently both developed under the aegis of the INCITS standards organization but by different groups. SCSI is under technical committee T10, while ATA is under T13.1 ATA was designed with hard disk drives in mind, only. SCSI is both broader and older, being a standard way of controlling mass storage ...


42

Kernel processes (or "kernel threads") are children of PID 2 (kthreadd), so this might be more accurate: ps --ppid 2 -p 2 -o uname,pid,ppid,cmd,cls Add --deselect to invert the selection and see only user-space processes. (This question was pretty much an exact inverse of this one.) In 2.4.* and older kernels, this PID 2 convention did not exist yet.


40

Architecture of Android Android relies on Linux for core system services such as security, memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack. Latest Android runs Linux version 3.10 (source). And my comment on your second sentence is ...


39

The ifconfig command on operating systems such as FreeBSD and OpenBSD was updated in line with the rest of the operating system. It nowadays can configure all sorts of network interface settings on those operating systems, and handle a range of network protocols. The BSDs provide ioctl() support for these things. This did not happen in the Linux world. ...


38

The reason is not a historical one but a practical one. There are many many many programs that run on top of the Linux kernel; if a kernel interface breaks those programs then everybody would need to upgrade those programs. Now it's true that most programs do not in fact depend on kernel interfaces directly (the system calls), but only on interfaces of the ...


Only top voted, non community-wiki answers of a minimum length are eligible