Archive for the ‘Uncategorized’ Category

Cloud Computing Part-I

May 26, 2010

This article was originally written for VIT Reporter.

This is the first in the series of articles on Cloud Computing. In this article I will cover the basic idea behind cloud and the different services that are possible with cloud computing.

Cloud computing has been a buzzword for quite sometime now. Over the past few years cloud computing has matured from a mere buzzword to a dynamic infrastructure used by hundreds of organizations around the world. All the major IT companies already have a cloud related product in the market.

The cloud technology is still evolving and a rigid definition of cloud is not possible. In simple terms a Cloud is an infrastructure of dynamic resources which are utilized on demand. They are basically clusters of computer nodes which are scaled as and when required.

The three fundamental services possible through cloud computing are

a)Infrastructure as a service (Iaas)
b)Platform as a service (PaaS)
c)Software as a service (SaaS)

I’ll touch upon each of the services in detail.

IaaS:

Infrastructure service delivers virtualized hardware(processor, RAM, network adapters) as a service. So, instead of purchasing a server or data center or network equipments, clients can get these resources as a service. The service is billed on as per the amount of resource consumed. Amazon Web Services (AWS) is the most successful IaaS provider to date. Amazon’s Elastic Compute Cloud (EC2) offers, as the name suggests, server power that can grow and contract in line with an organization’s demands.

PaaS:

PaaS offerings may include facilities for application design, application development, testing, deployment and hosting as well as application services such as team collaboration, web service integration and marshalling, database integration, security, scalability, storage, persistence, state management, application versioning, application instrumentation and developer community facilitation. These services may be provisioned as an integrated solution over the web. An example of PaaS is Google App Engine.

SaaS:

SaaS, is software that is deployed over a network. With SaaS, a provider licenses an application to customers as a service on demand, through a subscription or a “pay-as-you-go” model. Saas is also called “software on demand.” SaaS vendors develop, host, and operate software for customer use. Rather than install software on site, customers access the application over the Internet. The most common examples of SaaS are Gmail and Google docs.

Now, in the next article I’ll cover the different deployment models and the importance of open standards in Cloud Computing. The future articles will also contains detailed instructions of setting up your own private IaaS using open source tools. Till we meet again, Happy Reading!!!

Advertisements

Hello world!

April 11, 2010

Assembly programming is something which we don’t do often. Since, this is my hello world blog, I wanted to start off with something simple and geeky. So, I decided to write a assembly Hello world code which will communicate with the Linux system calls directly.


section    .text
global _start            ;linker looks for this
_start:                    ;linker entry point
mov    edx,length    ;length of string
mov    ecx,string   ;string to print
mov    ebx,1    ;file descriptor stdout
mov    eax,4    ;system call number for sys_write
int    0x80    ;interrupts the kernel
mov    eax,1    ;sys_exit system call
int    0x80
section    .data
string    db    'Hello, world!',0xa    ;the string
length    equ    $ - string           ;length of the string

Now, let me explain the code.
The system call number is moved into register eax. The arguments are passed through registers ebx, ecx, edx, esi, edi and ebp
To find out the system call number look at the asm/unistd.h in the user space header files.(/usr/include/asm/unistd.h).


#define __NR_restart_syscall      0
#define __NR_exit          1
#define __NR_fork          2
#define __NR_read          3
#define __NR_write          4
#define __NR_open          5
#define __NR_close          6

The system call numebr for sys_write is 4. Now, look at the sys_write man page.

man 2 write

ssize_t write(int fd, const void *buf, size_t count);

The arguments are fd-file descriptor, buf-pointer to the string and count-size of the string. The arguments are passed to the respective registers. System calls in linux are done using int 0x80.

To make an executable issue the following commands.


anirudh@powerbox:~/code/assembly$ nasm -f elf hello.asm
anirudh@powerbox:~/code/assembly$ ld -o hello hello.o
anirudh@powerbox:~/code/assembly$ ./hello
Hello, world!

To reduce the binary size, the use -s switch. This will omit all the symbol information.

anirudh@powerbox:~/code/assembly$ ld -s -o hello1 hello.o
anirudh@powerbox:~/code/assembly$ ls -lh hello hello1
-rwxr-xr-x 1 anirudh anirudh 7622010-04-21 09:19 hello
-rwxr-xr-x 1 anirudh anirudh 440 2010-04-21 09:20 hello1

Now, let us find out the size of an Hello world executable written in C.


anirudh@powerbox:~/code/c_cpp$ gcc -o hello hello.c
anirudh@powerbox:~/code/c_cpp$ ls -lh hello
-rwxr-xr-x 1 anirudh anirudh 6.3K 2010-04-21 09:31 hello

Now, what if the system call has  more than six arguments ? I’m yet to figure this out.