Tuesday, 29 July 2014

Create RAMDisk on Linux platform

Problem statement: 
Write a program in C++ to create a RAMDRIVE and associate an a cyclic directory structure to it. Use this RAMDRIVE to store input, out files to run a calculator program.


   A.    Basics of RAMDisk
As name suggest, RAMDisk is basically hard disk portion which is used / treated as RAM portion. It means, from actual RAM, we utilize few size to be used as RAMDisk. For e.g out of 2GB RAM size, you may allocate 512 MB size to newly created portion. Ramdisk or ramdrive is part of system memory that applications/user can use just like normal disk space — e.g. to create folders and files in it and manipulate them with dramatically better performance rather if they were stored on the hard drive. This is because Ram memory is much faster than other forms of storage.
By default Ubuntu has ramdisk mounted into /dev/shm/ directory so you can just copy/move files into that dir and be sure they’ll be stored in RAM memory. That could be useful for, say, video conversion when both input and output files are stored in ramdisk — resulting performance will be better as read and write speeds are higher for ram than for hdd or any other storage. This is due to the fact CPU cannot access to HDD directly while it can do it with RAM. There are two types of RAMDisk: 1. ramfs (not much used now a days) and 2. tmpfs (mostly used).

Thursday, 24 July 2014

Use pipe to perform Inter-Process Communication (IPC)

Problem statement: Write an IPC program using pipe. Process A accepts a character string and Process B inverses the string. Pipe is used to establish communication between A and B processes using Python or C++.

   A.    Basics of Inter-Process Communication (IPC)
Inter-Process-Communication (or IPC for short) are mechanisms provided by the kernel to allow processes to communicate with each other. On modern systems, IPCs form the web that binds together each process within large scale software architecture. 
The Linux kernel provides the following IPC mechanisms:

Ugrade Ubuntu 10.04 to Ubuntu 12.04 via terminal [closed]

Upgrade to Ubuntu 12.04 from Ubuntu 10.04 via terminal

1. start terminal. Use shortcut alt+ctrl+t

2.  Install update-manager-core, if it is not already installed.
 pavan@ubuntu:~$ sudo apt-get install update-manager-core 

3. Run the commands below to open upgrade manager's release  upgrade file
pavan@ubuntu:~$ sudo vi /etc/update-manager/release-upgrades 

4. set Prompt=lts if not set in the opened file. Save file and close it

5. Update all packages installed before you upgrade
pavan@ubuntu:~$ sudo apt-get update && sudo apt-get upgrade & sudo apt-get autoremove

6. Finally begin the upgrade process
pavan@ubuntu:~$ sudo do-release-upgrade
when ask if you want to continue with upgrade, press Y or yes

7. After successful upgrade, cross check your Ubuntu version with below command
pavan@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 12.04.1 LTS
Release:    12.04
Codename:    precise
8. You are done. Enjoy !!!

Wednesday, 23 July 2014

Display i-node information of given file

Problem statement: Display i-node information of given file using C++ or Python language

    A.     Introduction
The inode (also known as Index Node) is a very basic concept related to Linux and UNIX filesystem. Each and every object/element in the filesystem is associated with an inode.
You must be aware of the fact that, most of the countries have given a unique identity to their citizens in the form of a unique identification number ('Aadhar Card' in India and 'SSN' in the USA) to identify an individual easily and uniquely. This also leads to make all the paper work corresponding to any citizen easier to be handled.
Just like these identification numbers for people, there is a unique identity of every member of a Linux filesystem which is known as Inode number and it uniquely exists for each and every individual file on Linux or Unix filesystem.

Reset Ubunut 12.04 root password using recovery mode on GRUB window

Setup Openstack using devstack on Ubuntu 12.04