Linux Internal By:- BOSS Team Member CDAC-chennai
Linux Internal <ul><li>Introduction
Kernel
Process Management
Memory Management
File System
Device Driver
Network Stack
Architecture-dependent code </li></ul>
Introduction <ul><li>Operating System is a software designed to control the hardware of a system in order to allow users a...
Linux is a  free operating system based on UNIX standards.
LINUX® is a registered trademark of Linus Torvalds.
Features of Linux. </li></ul><ul><li>Multiprogramming
Multi-user
Secure
Fast </li></ul>
Components of Linux System <ul><li>Architecture of the GNU/Linux operating system </li></ul>
Components of a Linux System (Cont.)‏ <ul><li>When Linux is running in main memory,the it is divided in to two parts  1) U...
Kernel is running in kernel space. </li></ul><ul><li>The  system libraries (e.g. glibc)  define a standard set of function...
The Linux Kernel <ul><li>Kernel is a resource manager whether resource being managed is a  process,memory,hardware device.
Short history of Linux kernel development. </li></ul>
Linux Kernel <ul><li>Types of Kernel </li></ul><ul><li>Monolithic Kernel.  (e.g. Linux kernel)‏
Micro kernel  (e.g. Windows NT kernel,Mach kernel etc.)‏ </li></ul>
Structure of monolithic and micro-kernel-based operating systems <ul><li>Monolithic kernel  Micro Kernel </li></ul>
Linux Kernel 2.6.x <ul><li>Characteristics that differ between the Linux kernel and other Unix variants: </li></ul><ul><li...
Preemptive
Symmetric multiprocessor (SMP) support.
Linux does not differentiate between threads and normal processes.
Linux provides an object-oriented device  model with device classes,hotpluggable events and user-space device file system(...
Upcoming SlideShare
Loading in …5
×

Linux internal

2,499 views
2,327 views

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,499
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
97
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Linux internal

  1. 1. Linux Internal By:- BOSS Team Member CDAC-chennai
  2. 2. Linux Internal <ul><li>Introduction
  3. 3. Kernel
  4. 4. Process Management
  5. 5. Memory Management
  6. 6. File System
  7. 7. Device Driver
  8. 8. Network Stack
  9. 9. Architecture-dependent code </li></ul>
  10. 10. Introduction <ul><li>Operating System is a software designed to control the hardware of a system in order to allow users and application programs to make use of it.
  11. 11. Linux is a free operating system based on UNIX standards.
  12. 12. LINUX® is a registered trademark of Linus Torvalds.
  13. 13. Features of Linux. </li></ul><ul><li>Multiprogramming
  14. 14. Multi-user
  15. 15. Secure
  16. 16. Fast </li></ul>
  17. 17. Components of Linux System <ul><li>Architecture of the GNU/Linux operating system </li></ul>
  18. 18. Components of a Linux System (Cont.)‏ <ul><li>When Linux is running in main memory,the it is divided in to two parts 1) User space. 2) Kernel space. </li></ul><ul><li>User's applications are running in user space.
  19. 19. Kernel is running in kernel space. </li></ul><ul><li>The system libraries (e.g. glibc) define a standard set of functions through which applications interact with the kernel, and which implement much of the operating-system functionality that does not need the full privileges of kernel code. </li></ul>
  20. 20. The Linux Kernel <ul><li>Kernel is a resource manager whether resource being managed is a process,memory,hardware device.
  21. 21. Short history of Linux kernel development. </li></ul>
  22. 22. Linux Kernel <ul><li>Types of Kernel </li></ul><ul><li>Monolithic Kernel. (e.g. Linux kernel)‏
  23. 23. Micro kernel (e.g. Windows NT kernel,Mach kernel etc.)‏ </li></ul>
  24. 24. Structure of monolithic and micro-kernel-based operating systems <ul><li>Monolithic kernel Micro Kernel </li></ul>
  25. 25. Linux Kernel 2.6.x <ul><li>Characteristics that differ between the Linux kernel and other Unix variants: </li></ul><ul><li>Dynamic loading of kernel module
  26. 26. Preemptive
  27. 27. Symmetric multiprocessor (SMP) support.
  28. 28. Linux does not differentiate between threads and normal processes.
  29. 29. Linux provides an object-oriented device model with device classes,hotpluggable events and user-space device file system(sysfs). </li></ul>
  30. 30. Linux Kernel <ul><li>Kernel version naming convention: Linux kernel currently consists of four numbers A.B.C[.D]
  31. 31. The A number denotes the kernel version. It is changed least frequently, and only when major changes in the code and the concept of the kernel occur.
  32. 32. The B number denotes the major revision of the kernel. If B is even then kernel is stable else it is unstable.
  33. 33. The C number indicates the minor revision of the kernel is only changed when new drivers or features are introduced.
  34. 34. minor fixes are handled by the D number. </li></ul>
  35. 35. Linux kernel <ul><li>Block diagram of Linux Kernel. </li></ul>
  36. 36. Linux Kernel- System Call Interface <ul><li>System call is the mechanism used by an application program to request service from the operating system.
  37. 37. API is a function definition that specifies how to obtain a given service(ex.calloc,malloc ,free etc.), while System call is an explicit request to the kernel made via a software interrupt (ex.brk)‏
  38. 38. Invoking a system call by user mode process. </li></ul>
  39. 39. Linux Kernel-Process Management <ul><li>Process is a program in execution.
  40. 40. Process is represented in OS by Process Control Block. </li></ul>
  41. 41. Linux Kernel-Process Management <ul><li>Linux kernel stores the list of process in a circular doubly linked list called task_list.
  42. 42. Each element in task list is a process descriptor of the type task_struct .
  43. 43. task_struct structure is allocated via slab/slub allocator. </li></ul>
  44. 44. Linux Kernel-Process Management <ul><li>Thread is a unit of execution or objects of activity within process.
  45. 45. Thread is simply a new process that happens to share the same address space as its parent
  46. 46. Process creation: fork () creates a child process that is a copy of current process. it differs in PID,PPID. exec() loads new executable in to address space. clone() creates a new process(LWP) with its own identity, but that is allowed to share the data structures of its parent.
  47. 47. Process Termination: when process calls system call exit(). Process can also terminate involuntarily by signals or exceptions it can not handle or ignore. </li></ul>
  48. 48. Linux Kernel-Process Management <ul><li>Process state is defined in part of current activity of that process
  49. 49. The kernel implements a O(1) scheduler algorithm that operates in constant time, regardless of the number of threads vying for the CPU. It supports SMP. </li></ul>
  50. 50. Linux Kernel-Memory Management <ul><li>Computer memory layout: </li></ul>
  51. 51. Linux Kernel-Memory Management <ul><li>Linux’s physical memory-management system deals with allocating and freeing pages, groups of pages, and small blocks of memory. </li></ul><ul><li>It has additional mechanisms for handling virtual memory, memory mapped into the address space of running processes. </li></ul>
  52. 52. Splitting of Memory in a Buddy Heap
  53. 53. Managing Physical Memory <ul><li>The page allocator allocates and frees all physical pages; it can allocate ranges of physically-contiguous pages on request. </li></ul><ul><li>The allocator uses a buddy-heap algorithm to keep track of available physical pages. </li></ul><ul><ul><li>Each allocatable memory region is paired with an adjacent partner.
  54. 54. Whenever two allocated partner regions are both freed up they are combined to form a larger region.
  55. 55. If a small memory request cannot be satisfied by allocating an existing small free region, then a larger free region will be subdivided into two partners to satisfy the request. </li></ul></ul><ul><li>Memory allocations in the Linux kernel occur either statically (drivers reserve a contiguous area of memory during system boot time) or dynamically (via the page allocator). </li></ul>
  56. 56. Virtual Memory <ul><li>The VM system maintains the address space visible to each process: It creates pages of virtual memory on demand, and manages the loading of those pages from disk or their swapping back out to disk as required.
  57. 57. The VM manager maintains two separate views of a process’s address space: </li></ul><ul><ul><li>A logical view describing instructions concerning the layout of the address space. The address space consists of a set of non overlapping regions, each representing a continuous, page-aligned subset of the address space. </li></ul></ul><ul><ul><li>A physical view of each address space which is stored in the hardware page tables for the process.
  58. 58. mkswap /dev/sdax
  59. 59. swapon /dev/sdax
  60. 60. swapoff /dev/sdax </li></ul></ul>
  61. 61. File System <ul><li>A file system is the methods and data structures that an operating system uses to keep track of files on a disk or partition; that is, the way the files are organized on the disk.
  62. 62. A file is an ordered string of bytes
  63. 63. Files are organized in directory.
  64. 64. File information like size,owner,access permission etc. are stored in a separate data structure called inode.
  65. 65. Superblock is a data structure containing information about file system </li></ul>
  66. 66. Filesystem <ul><li>The Virtual Filesystem (also known as Virtual Filesystem Switch or VFS) is a kernel software layer that handles all system calls related to a standard Unix filesystem. Its main strength is providing a common interface to several kinds of filesystems.
  67. 67. ex. copy a file from MS-dos filesystem to Linux </li></ul>
  68. 68. Filesystem <ul><li>file object stores information about the interaction between an open file and a process. This information exists only in kernel memory during the period when a process has the file open. </li></ul>
  69. 69. Filesystem maintenance <ul><li>Filesystems checked at boot up
  70. 70. Maintaining consistency with fsck , e2fsck
  71. 71. lost+found
  72. 72. command line utility for Filesystem maintenance
  73. 73. tune2fs
  74. 74. dump2fs
  75. 75. debugfs </li></ul>
  76. 76. Device Driver <ul><li>Device drivers take on a special role in the Linux kernel. They are distinct “black boxes” that make a particular piece of hardware respond to a well-defined internal programming interface; they hide completely the details of how the device works.
  77. 77. Linux Device Driver are categorised in three types such as
  78. 78. Character Device Driver
  79. 79. Block Device Driver
  80. 80. Network Device Driver. </li></ul>
  81. 81. Network stack <ul><li>The network stack, by design, follows a layered architecture modeled after the protocols themselves. Recall that the Internet Protocol is the core network layer protocol that sits below the transport protocol . Above TCP is the sockets layer, which is invoked through the SCI.
  82. 82. The sockets layer is the standard API to the networking subsystem and provides a user interface to a variety of networking protocols. From raw frame access to IP protocol data units and up to TCP and the User Datagram Protocol (UDP), the sockets layer provides a standardized way to manage connections and move data between endpoints. </li></ul>
  83. 83. Architecture-dependent code <ul><li>While much of Linux is independent of the architecture on which it runs, there are elements that must consider the architecture for normal operation and for efficiency. The ./linux/arch subdirectory defines the architecture-dependent portion of the kernel source contained in a number of subdirectories that are specific to the architecture . For a typical desktop, the i386 directory is used. Each architecture subdirectory contains a number of other subdirectories that focus on a particular aspect of the kernel, such as boot, kernel, memory management, and others. </li></ul>
  84. 84. Thank You

×