现代作业系统核心.pptVIP

  • 2
  • 0
  • 约5.56万字
  • 约 125页
  • 2018-06-24 发布于四川
  • 举报
现代作业系统核心

CE6130 現代作業系統核心 Modern Operating System Kernels 許 富 皓 C Preprocessor: Stringification When a macro parameter is used with a leading #, the preprocessor replaces it with the literal text of the actual argument, converted to a string constant. Unlike normal parameter replacement, the argument is not macro-expanded first. This is called stringification. #define WARN_IF(EXP) \ do { if (EXP) \ fprintf (stderr, Warning: #EXP \n); } \ while (0) =============================================== WARN_IF (x == 0); == do { if (x == 0) fprintf (stderr, Warning: x == 0 \n); } while (0); Multiple Kernel Mode Stacks If the size of the thread_union structure is 8KB, the kernel mode stack of the current process is used for every type of kernel control path: exceptions, interrupts, and deferrable functions. If the size of the thread_union structure is 4KB, the kernel makes use of three types of kernel mode stacks. Exception Stack The exception stack is used when handling exceptions (including system calls). This is the stack contained in the per-process thread_union data structure, thus the kernel makes use of a different exception stack for each process in the system. Hard IRQ Stack The hard IRQ stack is used when handling interrupts. There is one hard IRQ stack for each CPU in the system, and each stack is contained in a single page frame. In a multiprocessor system, all hard IRQ stacks are contained in the hardirq_stack array. Structure of Hard IRQ Stack static char hardirq_stack[NR_CPUS * THREAD_SIZE] __attribute__((__aligned__(THREAD_SIZE))); Soft IRQ Stack The soft IRQ stack is used when handling deferrable functions (softirqs or tasklets). There is one soft IRQ stack for each CPU in the system, and each stack is contained in a single page frame. All soft IRQ stacks are contained in the softirq_stack array. Structure of Soft IRQ Stack static char softirq_stack[NR_CPUS * THREAD_SIZE] __attribute__((__aligned__(THREAD_SIZE))); Layou

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档