开发者

Questions on Linux kernel internals

开发者 https://www.devze.com 2023-02-07 09:23 出处:网络
I wa开发者_运维问答s reading \"Linux device drivers, 3rd edition\" and faced a few kernel items I don\'t quite understand. Hope gurus on this forum will help me out.

I wa开发者_运维问答s reading "Linux device drivers, 3rd edition" and faced a few kernel items I don't quite understand. Hope gurus on this forum will help me out.

1) Does the Linux kernel internally operate with virtual or physical addresses? What especially confuses me is that there are several types of addresses (logical, virtual, bus and physical) and they are all valid and operable by the kernel.

2) Is that correct that CPU instructions can't directly address data stored in peripheral devices and therefore addressable memory is used, i.e. buffers, for these purposes?

4) Can a process sleep when requesting semaphore (which has a value 0) and has to wait for it?

4) Atomic operations -- are these guaranteed by specific CPU instructions?


  1. Some special bits (e.g. initial bootstrap) operate in real mode on physical addresses, but most kernel code (all the parts written in C) runs in a virtual address space. You'll see pointers to other address spaces with annotations to remind you not to directly dereference them.
  2. There are special functions for performing copies between various other address spaces (e.g. PCI devices' configuration space) and the kernel's memory. Depending on the architecture, some parts are directly mappable.
  3. Yes.
  4. Not necessarily. For architectures lacking atomic operations, atomicity can be guaranteed by halting all other processors (easy if single-core) and disabling interrupts.


Three- Yes Four- Architecture dependent

0

精彩评论

暂无评论...
验证码 换一张
取 消