Next Previous Contents

4. Linux Startup

Il Kernel di Linux inizia dal codice C eseguito a partire dall'etichetta assember ''startup_32:'':

|startup_32:
   |start_kernel
      |lock_kernel
      |trap_init
      |init_IRQ
      |sched_init
      |softirq_init
      |time_init
      |console_init 
      |#ifdef CONFIG_MODULES 
         |init_modules 
      |#endif 
      |kmem_cache_init 
      |sti 
      |calibrate_delay 
      |mem_init
      |kmem_cache_sizes_init
      |pgtable_cache_init
      |fork_init
      |proc_caches_init 
      |vfs_caches_init
      |buffer_init
      |page_cache_init
      |signals_init 
      |#ifdef CONFIG_PROC_FS 
        |proc_root_init 
      |#endif 
      |#if defined(CONFIG_SYSVIPC) 
         |ipc_init
      |#endif 
      |check_bugs      
      |smp_init
      |rest_init
         |kernel_thread
         |unlock_kernel
         |cpu_idle

L'ultima funzione ''rest_init'':

  1. lancia il Kernel Thread ''init''
  2. chiama ''unlock_kernel''
  3. Esegue il loop infinito ''cpu_idle'', in attesa che altri processi con maggiore priorita' vengano schedulati.

In effetti la funzione ''start_kernel'' non finisce mai.

Segue la descrizione di init che e' il primo kernel_thread in esecuzione (che lanciera' poi tutti gli altri)

|init
   |lock_kernel
   |do_basic_setup
      |mtrr_init
      |sysctl_init
      |pci_init
      |sock_init
      |start_context_thread
      |do_init_calls
         |(*call())-> kswapd_init
   |prepare_namespace
   |free_initmem
   |unlock_kernel
   |execve

Next Previous Contents

Hosting by: hurra.com
Generated: 2007-01-26 17:56:17