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?
- 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.
- 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.
- Yes.
- 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
精彩评论