OS: glossary and note

1.  Each process in Linux has two stacks, a user stack and a kernel stack (8KB by default)

2.  thread_info is architecure dependent but task_struct is generic

3. fork call chain:

  libc fork()

    system_call (arch/i386/kernel/entry.S)

      sys_clone() (arch/i386/kernel/process.c)

        do_fork() (kernel/fork.c)

          copy_process()  (kernel/fork.c)

            p=dup_task_struct(current)   //shallow copy 

            copy_*                                  //copy point-to structures

            copy_thread()                       //copy stack, regs, and eip

          wait_up_new_task()                 //set child runnable 

4. exit() call chain

     libc exit(...)

    system_call (arch/i386/kernel/entry.S)

      sys_exit()  (kernel/exit.c)

        do_exit()  (kernel/exit.c)

          exit_*()                     //free data stuctures

          exit_notify()               //tell other process we exit

                    //reparent children to init if EXIT_ZOMBIE or EXIT_DEAD

5. context switch call chain

  schedule()   (kernel/sched.c)

    context_switch()

      switch_mm (include/asm-i386/mmu_context.h)

      switch_to (include/asm-i386/system.h)

        __switch_to (arch/i386/kernel/process.c)

Linux process scheduling:

http://www.cs.columbia.edu/~junfeng/10sp-w4118/lectures/l07-proc-linux.pdf

boot process:

  http://www.ibm.com/developerworks/library/l-linuxboot/index.html

  http://unix.stackexchange.com/questions/89923/how-does-linux-load-the-initrd-image

  http://www.ruanyifeng.com/blog/2013/02/booting.html

  http://unix.stackexchange.com/questions/259143/how-does-grub-stage1-exactly-access-load-stage-2

  http://www.pixelbeat.org/docs/disk/

Linux下的 Loop device, ramdisk device

  https://en.wikipedia.org/w/index.php?title=Loop_device&gettingStartedReturn=true

  http://www.tldp.org/HOWTO/archived/Loopback-Root-FS/Loopback-Root-FS-2.html

 Real mode and Protected mode:

        Read mode = segmented memory model,

  read mode support only 16-bit addressing, protected mode is an enhanced version of real mode, which support 32-bit addressing

 Memory alignment of 80X86 architecture:

Note that words need not be aligned at even-numbered addresses and doublewords need not be aligned at addresses evenly divisible by four. This allow maximum flexibility in data structures (e.g., records containing mixed byte, word, and doubleword items) and efficiency in memory utilization. When used in a configuration with a 32-bit bus, actual transfers of data between processor and memory take place in units of doublewords beginning at address evenly divisible by four; however, the processor converts requests for misaligned words or doublewords into the appropriate sequences of requests acceptable to the memory interface. Such misaligned data transfers reduce performance by requiring extra memory cycles. For maximum performance, data structures (including stacks) should be designed in such a way that, whenever possible, word operands are aligned at even address and doublewords operands are aligned at address evenly divisible by four. Due to instruction prefetching and queueing within CPU, there is no requirement for instructions to be aligned on word or doubleword boundaries. (However, a slight increase in speed results if the target addresses of control transfers are evenly divisible by four )

Multicore, Multiprocessor, Hyperthreading:

 ##############################################################################

 

https://software.intel.com/en-us/blogs/2008/04/17/the-difference-between-multi-core-and-multi-processing

http://download.intel.com/design/archives/processors/pro/docs/24201606.pdf (Intel Multiprocessor specification)

 misc:

###############################################################################

 ##############################################################################

 ##############################################################################

  ##############################################################################

 misc: 关于磁盘读写的 CHS模式 和 LBA模式 

 ##############################################################################

 

 (注意,LBA模式是在硬件上提供支持的)

  ##############################################################################

 ##############################################################################

 

##############################################################################

 

##############################################################################

 

##############################################################################

 

############################################################################## 

 

 为什么?因为x86架构中的地址是这样形成的:(段基址:段内偏移地址)

其中段基址就存放于DS(data segment), CS(code segment), SS(stack segment), ES(extra segment)这些基址寄存器中。

8086的实模式下,当需要形成内存地址的时候,段基址寄存器向左移4位,然后再加上段内偏移地址,最终形成一个20位的地址。可以看到,段基址向左移4位之后,其起始物理地址肯定是16字节对齐的。

(这样,就可以将16位(总共64KB)的地址扩展到20位的地址(总共1MB)。这也是X86的 段基址:段内偏移地址)的由来 )

 
##############################################################################
 

 ############################################################################## 

 

 ############################################################################## 

:)

原文地址:https://www.cnblogs.com/walkerlala/p/5450954.html