Linux Kernel etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
Linux Kernel etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

17 Haziran 2021 Perşembe

Kernel Module ve Export Symbol

Giriş
Bir module bir başka modülün sadece exported sembollerine erişebilir. Açıklaması şöyle
Modules can only access exported symbols, and exit_task_namespaces isn’t exported — so even though it is visible in the header files, it can’t be used in a module.

Exported symbols can be accessed as you’d expect, there’s nothing special to do.
Örnek
Export edilen şey veri yapısı ise şöyle yaparız
struct snd_card *snd_cards[SNDRV_CARDS];
EXPORT_SYMBOL(snd_cards);
Örnek
modul1 şöyle olsun
/* mod1.c */
#include <linux/module.h>

static int mod1_exp_func(int i)
{
  pr_info("%s:%d the value passed in is %d\n",
            __func__, __LINE__, i);

  return i;
}
EXPORT_SYMBOL(mod1_exp_func); /* export static symbol */

static int __init mod1_init(void)
{
  pr_info("Initializing simple mod\n");
  return 0;
}

static void __exit mod1_exit(void)
{
  pr_info("This module is exiting\n");
}

module_init(mod1_init);
module_exit(mod1_exit);
MODULE_LICENSE("GPL v2");
module2 export edilen sembolleri kullanabilir. Şöyle yaparız
/* mod2.c */
#include <linux/module.h>

extern int mod1_exp_func(int);

static int __init mod2_init(void)
{
  pr_info("Initializing mod2\n");
  pr_info("Calling exported function in mod1\n");
  mod1_exp_func(3);
  return 0;
}

static void __exit mod2_exit(void)
{
  pr_info("mod2 exiting\n");
}

module_init(mod2_init);
module_exit(mod2_exit);
MODULE_LICENSE("GPL v2");

6 Aralık 2019 Cuma

Low Latency Kernel veya Hard Real Time Kernel

Giriş
Low Latency Kernel ve Generic Kernel arasındaki farkın açıklaması şöyle.
RT kernels add a number of patches to the mainline kernel, and a few more configuration tweaks. The purpose of most of those patches is to allow more opportunities for pre-emption, by removing or splitting up locks, and to reduce the amount of time the kernel spends handling uninterruptible tasks (notably, by improving the logging mechanisms and using them less). The goal of all this is to allow the kernel to meet deadlines, i.e. ensure that, when it is required to handle something, it isn’t busy doing something else; this isn’t the same as high throughput or low latency, but fixing latency issues helps.

The generic kernels, as configured by default in most distributions, are designed to be a “sensible” compromise: they try to ensure that no single task can monopolise the system for too long, and that tasks can switch reasonably frequently, but without compromising throughput — because the more time the kernel spends considering whether to switch tasks (inside or outside the kernel), or handling interrupts, the less time the system as a whole can spend “working”. That compromise isn’t good enough for latency-sensitive workloads such as real-time audio or video processing: for those, low-latency kernels provide lower latencies at the expense of some throughput. And for real-time requirements, the real-time kernels remove as many low-latency-blockers as possible, at the expense of more throughput.
Low Latency Kernel Ayarları
Açıklaması şöyle.
Compared to the generic configuration, the low-latency kernel changes the following settings:

- IRQs are threaded by default, meaning that more IRQs (still not all IRQs) can be pre-empted, and they can also be prioritised and have their CPU affinity controlled;
- pre-emption is enabled throughout the kernel (CONFIG_PREEMPT instead of CONFIG_PREEMPT_VOLUNTARY);
- the latency debugging tools are enabled, so that the user can determine what kernel operations are blocking progress;
- the timer frequency is set to 1000 Hz instead of 250 Hz.

12 Ağustos 2018 Pazar

Linux Kernel

Giriş
İlk Linux kernel'i Minix üzerinde derleniyordu.

Farklı Linux Türevlerinin Kernel'ları Yer Değiştiremez
Açıklaması şöyle. Yani binary olarak kesinlikle yer değişemezler
Kernels from different implementations of Unix-style operating systems are not interchangeable, notably because they all present different interfaces to the rest of the system (user space) — their system calls (including ioctl specifics), the various virtual file systems they use...

What is interchangeable to some extent, at the source level, is the combination of the kernel and the C library, or rather, the user-level APIs that the kernel and libraries expose (essentially, the view at the layer described by POSIX, without considering whether it is actually POSIX). Examples of this include Debian GNU/kFreeBSD, which builds a Debian system on top of a FreeBSD kernel, and Debian GNU/Hurd, which builds a Debian system on top of the Hurd.
Low Latency Kernel
Low Latency Kernel veya Hard Real Time Kernel yazısına taşıdım.