Saturday, May 12, 2012

Linux Kernal

With over 13 million lines of code, the Linux kernel is one of the largest open source projects in the world, but what is a kernel and what is it used for?

So What is the Kernel?

A kernel is the lowest level of easily replaceable software that interfaces with the hardware in your computer. It is responsible for interfacing all of your applications that are running in “user mode” down to the physical hardware, and allowing processes, known as servers, to get information from each other using inter-process communication (IPC).

Different Types of Kernels
There are, of course, different ways to build a kernel and architectural considerations when building one from scratch. In general, most kernels fall into one of three types: monolithic, microkernel, and hybrid. Linux is a monolithic kernel while OS X (XNU) and Windows 7 use hybrid kernels. Let’s take a quick tour of the three categories so we can go into more detail later.

Microkernel
A microkernel takes the approach of only managing what it has to: CPU, memory, and IPC. Pretty much everything else in a computer can be seen as an accessory and can be handled in user mode. Microkernels have a advantage of portability because they don’t have to worry if you change your video card or even your operating system so long as the operating system still tries to access the hardware in the same way. Microkernels also have a very small footprint, for both memory and install space, and they tend to be more secure because only specific processes run in user mode which doesn’t have the high permissions as supervisor mode.

Pros
Portability
Small install footprint
Small memory footprint
Security

Cons
Hardware is more abstracted through drivers
Hardware may react slower because drivers are in user mode
Processes have to wait in a queue to get information
Processes can’t get access to other processes without waiting

Monolithic Kernel
Monolithic kernels are the opposite of microkernels because they encompass not only the CPU, memory, and IPC, but they also include things like device drivers, file system management, and system server calls. Monolithic kernels tend to be better at accessing hardware and multitasking because if a program needs to get information from memory or another process running it has a more direct line to access it and doesn’t have to wait in a queue to get things done. This however can cause problems because the more things that run in supervisor mode, the more things that can bring down your system if one doesn’t behave properly.

Pros
More direct access to hardware for programs
Easier for processes to communicate between eachother
If your device is supported, it should work with no additional installations
Processes react faster because there isn’t a queue for processor time

Cons
Large install footprint
Large memory footprint
Less secure because everything runs in supervisor mode

Hybrid Kernel
Hybrid kernels have the ability to pick and choose what they want to run in user mode and what they want to run in supervisor mode. Often times things like device drivers and filesystem I/O will be run in user mode while IPC and server calls will be kept in the supervisor mode. This give the best of both worlds but often will require more work of the hardware manufacturer because all of the driver responsibility is up to them. It also can have some of the latency problems that are inherent with microkernels.

Pros
Developer can pick and choose what runs in user mode and what runs in supervisor mode
Smaller install footprint than monolithic kernel
More flexible than other models

Cons
Can suffer from same process lag as microkernel
Device drivers need to be managed by user (typically)

Where Are the Linux Kernel Files?








The kernel file, in Ubuntu, is stored in your /boot folder and is called vmlinuz-version. The name vmlinuz comes from the unix world where they used to call their kernels simply “unix” back in the 60s so Linux started calling their kernel “linux” when it was first developed in the 90s.
When virtual memory was developed for easier multitasking abilities, “vm” was put at the front of the file to show that the kernel supports virtual memory. For a while the Linux kernel was called vmlinux, but the kernel grew too large to fit in the available boot memory so the kernel image was compressed and the ending x was changed to a z to show it was compressed with zlib compression. This same compression isn’t always used, often replaced with LZMA or BZIP2, and some kernels are simply called zImage.
The version numbering will be in the format A.B.C.D where A.B will probably be 2.6, C will be your version, and D indicates your patches or fixes.









In the /boot folder there will also be other very important files called initrd.img-version, system.map-version, and config-version. The initrd file is used as a small RAM disk that extracts and executes the actual kernel file. The system.map file is used for memory management before the kernel fully loads, and the config file tells the kernel what options and modules to load into the kernel image when the it is being compiled.

Linux Kernel Architecture
Because the Linux kernel is monolithic, it has the largest footprint and the most complexity over the other types of kernels. This was a design feature which was under quite a bit of debate in the early days of Linux and still carries some of the same design flaws that monolithic kernels are inherent to have.
One thing that the Linux kernel developers did to get around these flaws was to make kernel modules that could be loaded and unloaded at runtime, meaning you can add or remove features of your kernel on the fly. This can go beyond just adding hardware functionality to the kernel, by including modules that run server processes, like low level virtualization, but it can also allow the entire kernel to be replaced without needing to reboot your computer in some instances.
Imagine if you could upgrade to a Windows service pack without ever needing to reboot…

Kernel Modules





What if Windows had every driver available already installed and you just had to turn on the drivers you needed? That is essentially what kernel modules do for Linux. Kernel modules, also known as a loadable kernel module (LKM), are essential to keeping the kernel functioning with all of your hardware without consuming all of your available memory.
A module typically adds functionality to the base kernel for things like devices, file systems, and system calls. LKMs have the file extension .ko and are typically stored in the /lib/modules directory. Because of their modular nature you can easily customize your kernel by setting modules to load, or not load, during startup with the menuconfig command or by editing your /boot/config file, or you can load and unload modules on the fly with the modprobe command.
Third party and closed source modules are available in some distributions, like Ubuntu, and may not be installed by default because the source code for the modules is not available. The developer of the software (i.e. nVidia, ATI, among others) do not provide the source code but rather they build their own modules and compile the needed .ko files for distribution. While these modules are free as in beer, they are not free as in speech and thus are not included by some distributions because the maintainers feel it “taints” the kernel by providing non-free software.
A kernel isn’t magic, but it is completely essential to any computer running properly. The Linux kernel is different than OS X and Windows because it includes drivers at the kernel level and makes many things supported “out of the box”. Hopefully you will know a little bit more about how your software and hardware works together and what files you need to boot your computer.

Friday, May 11, 2012

Cloud Software Stacks

The whole cloud software area is starting to take shape and looks like the future of the data centre. Data Centers will gradually evolve from physical machines to virtualized servers through to cloud architectures.
 Potentially Cloud software Stacks could become a one-stop software-bundle for the data centre, including hypervisers, virtualized operating systems and applications, management tools and APIs, monitoring, backup etc etc.
 So instead of sourcing different products from multiple vendors to build a data centre customers could "like microsoft office" get a complete data centre software bundle. No wonder vendors are keen to get into this product segment! But with so many products you have to try and pick a vendor that will survive.

Many cloud management products are still works in progress but common features are taking shape:
 - Support the major virtualization technologies (Xen, KVM, VMware)
 - Support or planning to support Public Cloud APIs (Amazon EC2/S3 vCloud)
 - Support for major linux distributions and some support Windows Servers.
 - Support SANs. (EMC etc)
 - Monitoring, metering & billing
 - Authentication (with support for LDAP and Active Directory).
 - Often have open source and enterprise editions.
 - Support for extending into a public cloud ("Cloudbursting")
 - One management tool for private and public clouds.
 - Migration of Machine Images between clouds.

It appears the Cloud Software Stacks are forming into three camps:

1. Amazon AWS Compatible clouds

Eucalyptus - Provides an Amazon AWS compatible cloud.
- Consists of Open Source and Enterprise Editions.
- The Open Source version targets Linux systems that use Xen (versions 3.*) and KVM for virtualization.
- The Enterprise version adds support for Windows servers, VMware virtualization technologies, SAN     Adapter, User and Group Management, Accounting and Quota Management.
- Currently it is being downloaded 10,000 times a month so it is popular.

Nimbula - Cloud Operating System is an automated cloud management system delivering Amazon EC2-like services behind the firewall.
- Commercial version only.
- Currently only supports Xen and KVM but VMware support is planned.
- Supports Microsoft Windows, Linux, Solaris, BSD and AIX servers.
- Offers an API, a command line and a web control panel but does not appear to offer public cloud API support.
- Is able to deploy a virtual infrastructure on bare metal so good for large data centers.
- This is a new product by from the original developers of Amazon EC2 so very good pedigree.

Amazon - Virtual Private Cloud

2. VMWare vCloud Compatible clouds

VMware vCloud Director has the following features:
* Supports multi tenancy/organizational isolation
* Allows for the creation of central application catalogs and personalization of templates
* Enables creation and deployment of vApps from catalogs/templates
* Controls user resource usage through roles/rights, quotas and leases
* Enables programmatic control through the RESTful vCloud API
* Provides an additional level of abstraction from underlying hardware

Launched at VMworld 2010.

3. Others

OpenStack based on NASA Nebula and backed by others like Rackspace is a promising open source initiative and maybe the future for other Cloud stacks to coalesce around.

Abiquo - the provision of physical infrastructure is completely separated from the virtual application infrastructure by a “Resource Cloud”.
-Community and Enterprise Editions.
-Supports Xen, KVM or Virtual Box, VMware and Microsoft’s Hyper-V all in the community edition.

Cloud.com (formerly VMOps) - Massively Scalable Infrastructure Management.
- Has Community, Enterprise Edition and Service Provider Editions .
- Works with Xen and KVM hypervisors as well as VMware vSphere or Citrix XenServer.
- Own API but plan to implement Amazon EC2/S3 and vCloud on top.

OpenQRM - Next generation, open-source Data-center management platform
- supports VMware, Xen, KVM and Linux-VServer vms.
- supports major linux distribution like Debian, Ubuntu, CentOS and openSuse.
- Nagios integration for monitoring.

OpenNebula - Open-Source toolkit for building private, public and hybrid clouds.
- Apache Open Source Licence. Enterprise Edition coming out.
- supports Xen, KVM and VMware virtualization platforms
- on-demand access to Amazon EC2 and ElasticHosts Cloud providers.
- Local Unix-like command line interface and Cloud interfaces, such as libvirt, EC2 Query API and OGF OCCI API
- Support for multiple users, image transferring and cloning, virtual network management and service contextualization.
- Currently no support for windows servers but is planned.

Elastra - provides cloud-based computing services

Enomaly - which makes software for private cloud management and also operates     the SpotCloud marketplace for buying and selling cloud capacity. 

NewScale - NewScale software can be ordered through Cisco and Cisco channel partners under new product names including Cisco Cloud Portal and Cisco Workplace Portal, as well as the Cisco Intelligent Automation for Cloud.

Aserver - typically for service providers

CloudSwitch - Hybrid Cloud

OpSource - Virtual Private Cloud

Your Reviews/Queries Are Accepted