Walking around             Linux Kernel                 Dharshana Kasun Warusavitharana.                 Software Engineer...
How Story Begins Birth of Linux 1984 Richard M Stallman found GNU (GNU is Not Unix).Andy Tannenbaum Wrote Minux. 1991 Linu...
Why Operating System  Process management  Interrupts  Memory management  File system  Device drivers  Networking (TCP/IP, ...
What is a Kernel  The kernel is a bridge between applications and the  actual data processing done at the hardware level. ...
Kernel basic facilities  Process management  Support to hardware abstractions (Hal Daemon).  Setting up an address space f...
Kernel basic facilities (Contd.....)   Memory management   Allows processes to safely access this memory .   Virtual addre...
Kernel basic facilities (Contd.....)   Device management    1. On the hardware side:   Interfacing directly.   Using a hig...
Kernel basic facilities (Contd.....)   System calls   Using a software-simulated interrupt.   Using a call gate. A call ga...
Kernel-wide design approaches
Monolithic kernels  In a monolithic kernel, all OS services run  along with the main kernel thread.  Monolithic kernels, w...
Cons  Coding in kernel space is hard, since you cannot use  common libraries (like a full-featured libc), debugging is  ha...
Microkernel●     A microkernel that is designed for a specific platform    or device is only ever going to have what it ne...
Cons  Disadvantages in the microkernel exist however. Some are:  Larger running memory footprint.  More software for inter...
Hybrid kernels●    Hybrid kernels are part of the operating systems such as    Microsoft Windows NT, 2000 and XP. Dragonfl...
Linux Kernel
Lets Hack :)   Because a driver is not working as well as it  should, or is not working at all.  Because we have a school ...
You need to install the kernel development packages•e.g.: gcc, make, binutils, ncurses, qt• Extract the kernel source in /...
But WHAT if you make a MESS and wantto CLEAN UP?  Just use Mr. Proper  # make mrproper   This will clear all pre-compiled ...
Know your Hardware  To see whats plugged into your motherboard, or USB  ports.  linux:# lspci -v  linux:# lsusb  To check ...
Add Modules   To list modules that are currently loaded you can issue  • To list available modules (compiled) for the curr...
Thank You     &   Happycompiling ...
Walking around linux kernel
Upcoming SlideShare
Loading in …5
×

Walking around linux kernel

1,392
-1

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,392
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
83
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Walking around linux kernel

  1. 1. Walking around Linux Kernel Dharshana Kasun Warusavitharana. Software Engineer,Test Automation Name Your WSO2 Inc. Your Title Your Organization (Line #1) Your Organization (Line #2)
  2. 2. How Story Begins Birth of Linux 1984 Richard M Stallman found GNU (GNU is Not Unix).Andy Tannenbaum Wrote Minux. 1991 Linus Torvalds wrote Linux
  3. 3. Why Operating System Process management Interrupts Memory management File system Device drivers Networking (TCP/IP, UDP) Security (Process/Memory protection) I/O
  4. 4. What is a Kernel The kernel is a bridge between applications and the actual data processing done at the hardware level. The kernels responsibilities include Managing the systems resources The communication between hardware and software components The kernels primary function is to manage the computers resources and allow other programs to run and use these resources.Typically, the resources consist of: The Central Processing Unit. The computers memory. Any Input/Output (I/O) Key aspects necessary in resource management.
  5. 5. Kernel basic facilities Process management Support to hardware abstractions (Hal Daemon). Setting up an address space for the application, loads the file containing the applications code into memory Multi-tasking kernels are able to give the user the illusion that the number of processes being run simultaneously on the computer. The kernel generally also provides these processes a way to communicate; this is known as inter-process communication (IPC) and the main approaches are shared memory, message passing and remote procedure calls (see concurrent computing).
  6. 6. Kernel basic facilities (Contd.....) Memory management Allows processes to safely access this memory . Virtual addressing, usually achieved by paging and/or segmentation. Virtual addressing allows the operating system to use other data stores Virtual addressing also allows creation of virtual partitions of memory in two disjointed areas.
  7. 7. Kernel basic facilities (Contd.....) Device management 1. On the hardware side: Interfacing directly. Using a high level interface (Video BIOS). Using a lower-level device driver (file drivers using disk drivers). Simulating work with hardware, while doing something entirely different. 2. On the software side: Allowing the operating system direct access to hardware resources. Implementing only primitives. Implementing an interface for non-driver software (Example: TWAIN). Implementing a language, sometimes high-level (Example Postscript).
  8. 8. Kernel basic facilities (Contd.....) System calls Using a software-simulated interrupt. Using a call gate. A call gate is a special address stored by the kernel in a list in kernel memory at a location known to the processor. Using a special system call instruction. Using a memory-based queue.
  9. 9. Kernel-wide design approaches
  10. 10. Monolithic kernels In a monolithic kernel, all OS services run along with the main kernel thread. Monolithic kernels, which have traditionally been used by Unix-like operating systems. Since there is less software involved it is faster. As it is one single piece of software it should be smaller both in source and compiled forms. Less code generally means fewer bugs which can translate to fewer security problems. Most work in the monolithic kernel is done via system calls. These types of kernels consist of the core functions of the operating system and the device drivers with the ability to load modules at runtime.
  11. 11. Cons Coding in kernel space is hard, since you cannot use common libraries (like a full-featured libc), debugging is harder. Bugs in one part of the kernel have strong side effects. Kernels often become very huge, and difficult to maintain. Even if the modules servicing these operations are separate from the whole, the code integration is tight and difficult to do correctly. Since the modules run in the same address space, a bug can bring down the entire system. The disadvantage cited for monolithic kernels is that they are not portable; that is, they must be rewritten for each new architecture that the operating system is to be used on.
  12. 12. Microkernel● A microkernel that is designed for a specific platform or device is only ever going to have what it needs to operate. The microkernel approach consists of defining a simple abstraction over the hardware, Maintenance is generally easier. Patches can be tested in a separate instance, and then swapped in to take over a production instance. Rapid development time and new software can be tested without having to reboot the kernel. More persistence in general, if one instance goes hay- wire, it is often possible to substitute it with an operational mirror. Most micro kernels use a message passing system of some sort to handle requests from one server to another. A microkernel allows the implementation of the remaining part of the operating system as a normal application program written in a high-level language.
  13. 13. Cons Disadvantages in the microkernel exist however. Some are: Larger running memory footprint. More software for interfacing is required, there is a potential for performance loss. Messaging bugs can be harder to fix due to the longer trip they have to take versus the one off copy in a monolithic kernel. Process management in general can be very complicated. Extremely context based. As an example, they work well for small single purpose (and critical) systems because if not many processes need to run, then the complications of process management are effectively mitigated.
  14. 14. Hybrid kernels● Hybrid kernels are part of the operating systems such as Microsoft Windows NT, 2000 and XP. Dragonfly BSD etc. They are similar to micro kernels, except they include some additional code in kernel-space Many traditionally monolithic kernels are now at least adding (if not actively exploiting) the module capability. On demand capability versus spending time recompiling a whole kernel for things like new drivers or subsystems. Faster integration of third party technology (related to development but pertinent unto itself nonetheless). Disadvantages of the modular approach are: With more interfaces to pass through, the possibility of increased bugs exists (which implies more security holes). Maintaining modules can be confusing for some administrators when dealing with problems like symbol differences.
  15. 15. Linux Kernel
  16. 16. Lets Hack :) Because a driver is not working as well as it should, or is not working at all. Because we have a school or work project. Because the kernel is crashing, and we don’t know why. Because we want to learn how the kernel works. Because it’s fun! Real men hack kernels ;-
  17. 17. You need to install the kernel development packages•e.g.: gcc, make, binutils, ncurses, qt• Extract the kernel source in /usr/src• Optionally create a symlink• Quick configuration using an old configuration•linux:# tar jxvf /tmp/linux-2.6.16.8.tar.gzlinux:# ln-s /usr/src/linux-2.6.16.8 /usr/src/linuxlinux:# cp /boot/config-2.6.14 .configlinux:# make oldconfigCompiling the kernellinux:# make && make install && make modules_install
  18. 18. But WHAT if you make a MESS and wantto CLEAN UP? Just use Mr. Proper # make mrproper This will clear all pre-compiled binaries as well as remove the .config file # make clean Just clean all pre-compiled binaries
  19. 19. Know your Hardware To see whats plugged into your motherboard, or USB ports. linux:# lspci -v linux:# lsusb To check your processor and memory linux:# cat /proc/cpuinfo linux:# cat /proc/meminfo • To see your hard drive partitions. • To see your kernel log linux:# fdisk -l linux:# dmesg
  20. 20. Add Modules To list modules that are currently loaded you can issue • To list available modules (compiled) for the current kernel • To get a small description about a module ... • To load a kernel module driver manually • #lsmod #modprobe -l #modinfo radeon #modprobe radeon To load a kernel drive automatically as the machine boots consider adding it to /etc/modules.conf (2.4) or /etc/modprobe.conf (2.6)
  21. 21. Thank You & Happycompiling ...

×