Monday, April 22, 2013

Linux Desktop Environments


              The most popular fully featured Linux Graphical Desktop Environment are GNOME and KDE.We will begin a comprehensive head-to-head clash between these leading desktop environments.
 
GNOME


                 The GNOME (pronounced "Gah-NOME") GNU Network Object Model Environment is a user-friendly desktop based entirely on free software. The combination of good situational awareness and clear presentation of desktop elements makes GNOME he most task-efficient desktop for the widest range of users.

                  Every Six month GNOME Foundation releases a new version.GNOME had moved from the traditional desktop Environment like the one we seen in Windows and Mac OS to shell based user Interface.The version 2.x used the traditional desktop while the new version 3.x uses Shell interface

Let see the different with 2.x and 3.x.

Gnome 2.x 

                 GNOME version 2.x has dual taskbars know as panels.One panel is located at the top of the screen in the form of a menu bar and an additional panel is found at the bottom of the screen.Because of this,some people would say that GNOME 2.z more closely resembles with Mac OS X in appearance.Regarding system resources usage,Gnome 2.x requires less RAM but more CPU than GNOME 3.x. 

RED HAT Gnome 2.x interface
Gnome 3.x

                The classic look of GNOME 2.x shell evolved and in GNOME 3.x we see GNOME Shell user Interface.In the GNOME 3.x shell,there is only one panel located at the top of the desktop,and there is no longer a traditional menu.To open programs users can either press the windows keys or they can click on the "Activities" found on the left side of the panel.This gives the options of a program launchr that appears on the left side of the desktopn,an "Applications" option found on the upper left part of the desktop  or they can search for programs using the search box on the upper right of the desktop. Additionally, when clicking on "Activities," a desktop switcher appears on the right side of the desktop.

 
GNOME 3.x shell Interface


                Another change involves the buttons on the windows; in GNOME 2.x, and practically every other desktop environment or window manager, there are at least three buttons found at the top of each window: one to exit the window, one to maximize the window, and one to minimize the window. However, in the default GNOME 3.x shell, there is only one button that is used to exit the window, which really takes some getting used to. If you want your laptop or desktop to look and behave like a cell phone or tablet, then the GNOME 3.x shell might be for you. Overall, the GNOME 3.x shell is a very simple, clean, and visually pleasing desktop.  


GNOME Window Button


Window Manager: Mutter (GNOME 3.x shell)
Widget Toolkit: GTK+
File Manager:Nautilus
Office Suite: GNOME Office(which includes AbiWord and Gnumeric)
Music Player: Rhythmbox
Video Player: Totem

KDE

This is one of the older Linux desktop environments, and once a bitter rival of Gnome 2. In many ways, KDE (K Desktop Environment) in its default configuration is very similar in appearance to Microsoft Windows.

OpenSUSE KDE Desktop


Each major release of KDE has brought a large set of new features and modifications. KDE 1 had a wide range of features that made it a complete desktop environment. KDE 2 brought the internet to a Linux user’s desktop.Howvever it's KDE 3’s releases many features, such as new desktop and icon themes, integration with third-party applications, and support for LDAP and Exchange.KDE 3 also boosted support for multiple platforms, including Mac OS X.

KDE menu bar


KDE (SC) 4 was based on the much-improved Qt 4, toolkit for KDE.It include the new desktop UI (Plasma) and a built-in compositing effect window manager (KWin).

KDE Plasma workspace


Window Manager:KWin
Widget Toolkit: Ot 4
File Manager:Dolphin
Office Suite: LibreOffice
Music Player: Amarok
Video Player: Kaffeine


                                      KWin provides your windows with a more natural feel. New desktop effects like the "Cube Desktop Switcher" and "Magic Lamp Minimize Animation" have been added. Improvements in the existing effects make window management smoother than ever. 






Summary: Linus Torvalds, creator of the Linux kernel, has switched by the Gnome 3, saying GNOME better than KDE 







Wednesday, April 17, 2013

X Window System


Back in 1970 when Unix was released,it comes with CLI (command line interface) which is to some extent, pretty user-hostile .Nowadays every operating system have a GUI subsystem.They are several reason to use a GUI over CLI,it gives more control over how things are displayed on-screen and it's multitasking nature gives a lot of programs running at any given time.Historically, UNIX has developed a lot by academic project. One such project, Athena project at the Massachusetts Institute of Technology (MIT) developed X Window System.



Later an entity called the "X Consortium" took over X .This is how XFree86 came. Now X project are lead by X.Org Foundation. This consortium developed X windows system current protocol (X11version) and it's been used by all major Linux distributors.
  
http://en.wikipedia.org/wiki/XFree86#Release_history

X Window overview


X is designed as a client/server architecture. The clients communicate to the X server using the X11 network protocol. Clients can run locally to the Xserver or remotely on other machines



The applications (window manager,xterm) themselves are the clients; they communicate with the server and issue requests such as "create a rectangular box", or "render this string of text, using this font, at this position on-screen".



X server is in charge of actual graphics display,includes reading the mouse and keyboard. Client only concern is to create a rectangular box in some X by Y pixel in size,it's the server decide where to create the box.

1.The screen is your whole ``desktop''
2.The root window is the background of your screen.
3.The window manager is the main interface between the X Window system and the user.




 
The X server basic services are : input handling, window services, graphics, text and fonts.



Input handling services taking keyboard and mouse inputs to clients as events via the window manager, which X regards as just another client. Window services are requests by clients to the X server to provide information about windows or to create or destroy them .Graphics services are the drawing of lines and shapes.

Window manager

Now X server creates the rectangular box,however X server doesn't handles manipulation such aschanging size, maximize or minimize windows. The program that decides where to place windows, control the windows' appearance, position and size, window titles, and buttons is called Window Manager. windows manager is a X client application





Window manager which is essentially the component which controls the appearance of windows and provides the means by which the user can interact with them.



Windows manager : Sawmill, Metacity, Mutter





Toolkit

Windows manages gives the appearance,but where did the decorations of the windows come from. This job is done by Widget toolkits. Widget toolkits are library function an API which include decorative menus, buttons, radio buttons, scroll bars, and canvases. In simple terms windows managers arrange the windows and toolkits provides the decoration. Toolkit is another X client application





The widely known toolkit which is used is GTK+,it was originally designed and used in the GNU Image Manipulation Program (GIMP) project. Another famous toolkit is QT.



Toolkit widgets : GTK+, QT





Upto this point we are talking about X server/client architecture. In this server/client architecture we see several window managers and lot of widget toolkit libraries. Let say that a User opened 3 different application each using a different window manager and toolkit. This means each application varies from one window manager to other. This create a mess. This is resolved by Desktop Environment



Desktop Environment



A Desktop Environment provides a range of integrated utilities and applications such as panels(or starting applications and displaying status ) a desktop (where data and applications can be placed), windows manages and toolkit.



The most popular Linux desktop environments are GNOME and KDE.



GNOME uses MUTTER as windows manager and GTK+ as widget toolkit library. On the other hand KDE uses KWin as their window manager and QT as widget toolkit





So these all create a desktop in your Linux Box.Seem overwhelming? It's definitely a different experience than Windows where you just install the OS and go.


Tuesday, April 9, 2013

Linux Partitioning Scheme

                
                        There are many reasons for partitioning a large hard disk into several smaller partitions.  For a home user  a single Linux partition (plus swap)  can be a reasonable choice.But for a server installation  multiple partitions provide additional safety and performance benefits,so if you're planning to install a web server of a database server i would recommend six partitions.



let me explain the need for these partition :- 

 /
This is called the root partition; the most important partition, where all the system files are stored.if this partition runs out the system hangs,5 to 10 GB is sufficient in most cases.

 /boot
The partition mounted on /boot/ contains the operating system kernel along with files used during the bootstrap process. For most users, a 250 MB boot partition is sufficient. 

/home
 To store user data separately from system data,you should  create a dedicated partition to holds all of the users' configuration files, all their saved documents and their desktop folder.

/var
The /var directory holds content for a number of applications, including the Apache web server. It also is
used to store downloaded update packages on a temporary basis. Ensure that the partition containing the /var directory has enough space to download pending updates and hold your other content. 

/tmp
Some programs write temporary data files here. Usually, they are quite small. However, if you run computationally intensive jobs, like science or engineering applications, hundreds of megabytes could be required for brief periods of time. In this case, keep /tmp in a different partition than /.

swap
Our need one partition that will be used as Linux swap space. This is space on your hard drive that can be used as virtual memory. Virtual memory allows your computer to run large programs and perform complex tasks even if it does not have enough physical RAM to do the job. (It is a lot slower, but it works.)

 A good rule of thumb is that your swap space should be two or three times as much as the available physical memory (RAM).Currently, the maximum size of a swap partition is architecture-dependent. For i386, m68k, ARM and PowerPC, it is "officially" 2Gb

    Systems with 4GB of ram or less require a minimum of 2GB of swap space
    Systems with 4GB to 16GB of ram require a minimum of 4GB of swap space
    Systems with 16GB to 64GB of ram require a minimum of 8GB of swap space
    Systems with 64GB to 256GB of ram require a minimum of 16GB of swap space




Monday, April 8, 2013

Linux Hard Disk Layout


                            A typical PC has either two IDE or SCSI controllers,Linux named the IDE as "hdd" and SCSI as "s" in place of "h" and each of these controllers can have two drives connected to it.thus 4 hard drives can be connected,a primary master named as (/dev/hda),a primary slave (/dev/hdb),Secondary master(/dev/hdc),secondary slave(/dev/hdd).




                         The partition scheme for PC hard disks allowed only four partitions.These partitions are called primary partitions. To work around this limitation and allow more than four partitions, a new partition type was created, the extended partition,these extended partition further sub-divided into logical partiton.
 

                           Linux  numbers primary or extended partitions as 1 through 4,so dev/hda may have four primary partitions, /dev/hda1, /dev/hda2, /dev/hda3, and /dev/hda4.Or it may have a single primary partition /dev/hda1 and an extended partition /dev/hda2. If logical partitions are defined, they are numbered starting at 5, so the first logical partition on /dev/hda will be /dev/hda5,Although the theoretical maximum number of partitions on an IDE drive is now limited to 15 for kernels with hotplug



below example you can see Hard disk 1 and 2 are primary partition and 3rd is extended
partition which start the number 5. 





Saturday, April 6, 2013

Linux File System : Ext2 vs Ext3 vs Ext4

         
                                      Linux can read and write several file systems because linux work on VFS (Virtual file system )layer that is a data abstraction layer between the kernel and the programs in userspace that issue file system commands.Famous Linux file system are Ext2,Ext3,Ext4.


Ext2 :

                      Ext2 was the standard file system for linux Kernel 1.0.Ext2 stands for second extended file system..Ext2 is flexible,can handle file system up to 4 TB,and supports long filenames up to 1012 characters.Drawback in ext2 filesystem is when  a file system is uncleanly mounted(system crash) ,the whole file system must be checked.This takes a long time on large file systems.


Ext2 does not have journaling feature.
On flash drives, usb drives, ext2 is recommended, as it doesn’t need to do the over head of journaling.
Ext3 support 16 TiB of maximum file system size and 2 TiB of maximum file size.


Ext3 : 

                     Ext3 is basically ext2 + a journal.After an unexpected power failure or system crash (also called an unclean system shutdown), each mounted ext2 file system on the machine must be checked for consistency by the e2fsck program.This is a time-consuming process.Ext3′s uses journaling filesystem which keeps a journal or log of the changes that are being made to the filesystem during disk writing.This allows a computer to be rebooted much more quickly after a system crash.Maintaining the journal adds a certain amount of overhead , but improves filesystem reliability and reduces fsck times

It was introduced in 2001. Developed by Stephen Tweedie.
Starting from Linux Kernel 2.4.15 ext3 was available.
In ext3 a directory can have at most 32,000 subdirectories
You can convert a ext2 file system to ext3 file system directly


Ext4 : 

                   The ext4 file system is designed with many new advanced features.Ext4such as the ones destined to store the file data.unlike Ext3  mostly about adding journaling to Ext2,Ext4 made some important data structures modification in the filesystem.Ext4 fully 64-bit capable,but only uses 48 bit block addressing which can support volumes with sizes up to 1 exbibyte and files with sizes up to 16 tebibytes.It also add checksum to the journal which make the journal more reliable.it uses "multiblock allocator",In Ext3 when a new data is written it uses a Block allocator decide whcih free blocks is used to write the date and it only allocate one block at a time(4KB),means if it had to write a data of 10MB ,it has to call the block allocator 2560 times.With the multiblock allocator it allocate many blocks in a single call,instead of single block per call.

Maximum volumes sizes up to 1 exbibyte
Maximum files with sizes up to 16 tebibytes
Backward compatibility
In ext4 a directory can have at most 64,000 subdirectories
Ext4 uses checksums in the journal to improve reliability

Wednesday, April 3, 2013

Beginners Basic Linux Commands


ls                       - List files in the current working directory
ls -al                  - List all files  in long listing format showing permissions, ownership, size, and time.
pwd                   - Print working directory is used to output the path of the current working directory.
cd                      - Change directory
cd   /                  - Moves from the current directory to "/" directory.
cd ~                   - Takes you back to your home directory.
mkdir                - Creates a directory
mkdir Rem       - Creates a directory with name Rem
rmdir                 - Removes a directory
rmdir Rem        - Removes a directory Rem
cp                      - Copy one or more files to another location   
clear                  - Clear terminal screen
cfdisk                - Partition table manipulator for Linux
date                   - Display or change the date & time
df                       - Display free disk space
du                      - Estimate file space usage
history              - Command History
hostname          - Print or set system name
tty                     - Print filename of terminal on stdin
uname              - Print system information
whereis            - Report all known instances of a command
who                  - Print all usernames currently logged in
whoami            - Print the current user id and name (`id -un')
man                 - Help manual
exit                  - Exit the shell

Tuesday, April 2, 2013

Linux Kernel Version Numbering

                              
                                 The Linux foundation is a consortium who is responsible for the kernel Developments. Greg Kroah-Hartman and chris wright is the current Linux Kernel maintainer for the stable release

                                The initial Linux kernels numbers released by Torvalds in September 1991 are simple numbering system starts from 0.01,0.02.The numbering system Linux kernel have was began in the late 1994 starts from 1.0.After that Linux kernel is identified by a set of four numbers. First three number related to the kernel release version and revisions where the last number mention its bugs fixes version. A new type of numbering system was announced by Linux Torvalds back in 2011.
 
Let me explain:

Latest Stable Kernel release is : 3.8.5

First Number – Kernel version (3)
                              
                               The kernel version changes only when substantially major changes are made in the kernel code. This happen thrice in Linux kernel history. First in 1994 (1.0),then 1996 (2.0) the last happen in 2011(3.0)

Second Number – Major Revision (8)

                                When a new stable kernel was introduce say (3.7) .it opens a 2 weeks merge window for the next development cycle At this time merge window accepts codes,experimental trees, driver updates from the developers fraternity. After 2 weeks, Linus Torvalds will declare that the window is closed and release the first of the "rc" (release candidate)kernels with an incremented number (3.8.rc1).This is called pre-patch release .From here onwards it only accepts bug fixes and around each week Linux releases 3.8-rc2,-rc3, ... continuing until he is satisfied that there are no new bugs. Then they release the new Mainline Linux kernel 3.8 where all all new features are introduced.

Third Number – Minor Revision (5)

                                 Once a Mainline release 3.8 is made, its ongoing maintenance is passed off to the "stable team," currently consisting of Greg Kroah-Hartman.This teams who fixes bugs and other serious problem and the updates the kernel with a release 3.8.1,3.8.2......3.8.5 where there is no bugs at all,they release 3.8.5 as the stable Linux
 





Monday, April 1, 2013

Micro-kernel vs Monolithic kernel


Micro-kernel

                              A micro kernel is a compact kernel where the core functionality like Inter-process communication and memory management runs in Kernel space while the system base services like processor Scheduler and device drivers runs in User space.Here kernel is divides into separate process,Known as servers. The communication of these servers which are kept in different address spaces is done by via message passing. 

                             This split allows better hardware independence of the operating system itself,thus an error in the kernel cannot cause the entire system to crash, if a kernel process crashes, it is still possible to re instated the system as a whole by merely restarting the service that caused the error.


Some OS that uses Micro kernel are MINIX, HURD ,QNX, L4.



Advantages:

The source code of kernel is very small only 4000 lines of C program.
Due to its small source code kernel is faster to boot .

Disadvantages:

Process management is complex,to make a single service call,first it has to build and send a message then for the reply it has to accept and decode.
Messaging bugs can be harder to fix due to its longer trip.

 
Monolithic Kernel

A monolithic kernel is a single large static binary file process where all services as well as core functionality are a tight knit group sharing the single address space. In this architecture entire services are loaded on boot up and reside in memory and work is done using system calls.

Linux was started as monolithic kernel,since Linux 2.0 version,it is considered as monolithic/modular kernel. it's called monolithic because the entire kernel is complied into one large executable file and loads into memory at system boot.it's called modular because it's only loads a small fragment of kernel called modules at run time,so that the basic kernel contains only those components that are necessary for the system to start itself and removed again after the boot.




OS that runs on Monolithic kernel are Linux,UNIX,BSD,Windows.

Advantages

Since all resources are handled in one place it could say that is is better in performance, and easy for kernel developers.
Faster integration of third party technology.
 
Disadvantages

Error in the kernel can cause the entire system to crash.
source code can become extremely large,nearly 6.34 million lines.


I will conclude this article by saying there is no OS architecture that is better than the other in the general sense.Regardless of the famous flame war between Linus Torvalds and Andrew Tanenbaum the philosophy behind micro kernels fascinates OS developers.however from the practical standpoint Linux WINS,Linux became so stable over the last 20 years and can run for years without crashing.