KernelNewbies
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Kernel Hacking

  • Frontpage

  • Kernel Hacking

  • Kernel Documentation

  • Kernel Glossary

  • FAQ

  • Found a bug?

  • Kernel Changelog

  • Upstream Merge Guide

Projects

  • KernelJanitors

  • KernelMentors

  • KernelProjects

Community

  • Why a community?

  • Regional Kernelnewbies

  • Personal Pages

  • Upcoming Events

References

  • Mailing Lists

  • Related Sites

  • Programming Links

Wiki

  • Recent Changes

  • Site Editors

  • Side Bar

  • Tips for Editors

  • Hosted by WikiWall

Navigation

  • RecentChanges
  • FindPage
  • HelpContents
Revision 3 as of 2004-12-20 02:59:45
KernelNewbies:
  • KernelSafari

Don't want to start hacking yet, but like to take apart the kernel to see how it works ?

  • Some early boot code from the 0.01 kernel has been analyzed in Kernel001WalkThrough

  • The macros copy_to_user and copy_from_user are explained in CopyUser


And here is a beautiful ascii-art representation of kernel facilities/structure:

userspace process <-------------------------------------------------------------------------------------+
        |                                                                                               |
        +-------> files/directories                                                                     |
        |               |                                                                               |
        |               +-------> file -> VFS -> filesystem -> file_operations table -> function        |
        |               |                                                                               |
        |               +-------> directory(file) -> VFS -> filesystem -> file_operations -> function   |
        |                                                                                               |
        +-------> character/block devices                                                               |
        |               |                                                                               |
        |               +-------> file -> VFS -> device table -> char/block functions -> driver         |
        |               |                                                                               |
        |               +-------> file -> VFS --------------> filesystem --------------> devfs driver   |
        |                                                                                               |
        +-------> pipes/sockets                                                                         |
        |               |                                                                               |
        |               +-------> system call -> socket -> layer-4 -> layer-3 -> NIC driver             |
        |               |                                                                               |
        |               +-------> descriptor -> buffer -> descriptor -----------------------------------+-------+
        |                                                                                                       |
        +-------> system calls                                                                                  |
        |               |                                                                                       |
        |               +------> interrupt -> system call handler -> sys_syscall() -> do_syscall()              |
        |                                                                                                       |
        +-------> virtual memory                                                                                |
        |               |                                                                                       |
        |               +-------> malloc() -> mmap() -> VMA -> KMA -> page manager -> hardware memory           |
        |               |                                                                                       |
        |               +-------> malloc() -> mmap() -> VMA -> KMA -> kswapd -> swap manager -> block device    |
        |                                                                                                       |
        +-------> process management                                                                            |
        |               |                                                                                       |
        |               +-------> system call(fork) -> system call handler -> sys_fork()/sys_clone() -----------+
        |               |                                                                                       |
        |               +-------> system call(kill) -> system call handler -> sys_kill() -----------------------+
        |               |
        |               +-------> IPC -> system call(ipc) -> system call handler -> sys_ipc() ------------------+
        |                                                                                                       |
        +-------------------------------------------------------------------------------------------------------+

Anybody want to draw this over? ;)

-Brad

Reorganized it to take less horizontal space.

-Renaud

Fixed it so you can view it (removed the equals)

-Izomorfix

Made it more understandable using a bit more whitespace, but I'm not sure if it's still right (see, not understandable enough).

-Devin Torres

Hi, I have some problems with the meaning of the arrows:

  • The arrows starting from userspace process seem to be calls to functions in "packages" (i.e. files/directories, ...). Now what is the connection between sys_ipc() and user space?

  • Under files/directories seems to be an interface file (the interface for userspace processes) which calls functions in the VFS interface. This calls functions in the filesystem interface and so on. Is this always some type of call under all "packages"?

  • What does the connection between sys_...(), descriptor and userspace process mean? Maybe arrows at the "junctions" ("+") might help as I otherwise have to go up to userspace proecess to now the direction to take. (for example like this: "{descriptor


>+


}") (fix me - sorry for this, but "Help" doesn't seem to work right now)

A legend is missing with an explanation of the arrows and the nodes (they are more likely self-explanatory). Distinction between different types of nodes (if there are different types) might help (or make things messy).

Something more specific: If a process wants to read from a file it calls something under files/directories or character/block devices? Do functions from files/directories call character/block devices? I'm just wanting to improve the diagram. So if answers are not helpful just ignore the question :)

-Flo

  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01