What is S3 of AWS ?

Its a service that provides secure, durable, and highly-scalable cloud storage. It also allows you to pay only for the storage you actually use, which eliminates the capacity planning and capacity constraints associated with traditional storage. Besides it offers a very high level of integration with many other AWS cloud services.

Amazon S3 offers a range of storage classes designed for various generic use cases: general purpose, infrequent access, and archive. To help manage data through its lifecycle. In order to control who has access to your data, Amazon S3 provides a rich set of permissions, access controls, and encryption options.

Amazon S3 object storage is a cloud object storage that is independent of a server and is accessed over the Internet. Instead of managing data as blocks or files, data is managed as objects using an Application Program Interface (API) built on standard HTTP verbs.  Such objects contain both data and metadata and reside in containers called buckets, but you can’t have a sub-bucket within a bucket. Each bucket can hold an unlimited number of objects.

You can’t “mount” a bucket, “open” an object, install an operating system on Amazon S3, or run a database on it.

Anuncios

AWS brief sum up of basic concepts

A need to work with such cloud has come to my professional life. That’s why i just simply created a brief sum up of basic concepts for non experimented AWS sysadmins and devops.

About Global Infrastructure

  • Each AWS region is a separate geographic area,  providing a highly available technology infrastructure
  • Each region has multiple, isolated locations known as Availability Zones.
  • Each region is completely independent and is designed to be completely isolated from the other regions.
  • Each Availability Zone is also isolated, but the Availability Zones in a region are connected through low-latency links. By placing resources in separate Availability Zones, you can protect your website or application from a service disruption impacting a single location.
  • Redundant instances for each tier of an application should be placed in distinct Availability Zones, thereby creating a multisite solution.

AWSP

Interact with the platform

To access AWS Cloud services, you can use:

  • The AWS Command Line Interface (CLI): one tool to download and configure, you can control multiple services from the command line and automate them through scripts.
  • The AWS Management Console: it is a web application for managing AWS Cloud services.
  • The AWS Software Development Kits (SDKs): an application programming interface (API) that interacts with the web services that fundamentally make up the AWS platform.

A Basic heap implementation in C++

Why use a heap?

A heap can be thought of as a priority queue; the most important node will always be at the top, and when removed, its replacement will be the most important. This can be useful when coding algorithms that require certain things to processed in a complete order, but when you don’t want to perform a full sort or need to know anything about the rest of the nodes. For instance, a well-known algorithm for finding the shortest distance between nodes in a graph, Dijkstra’s Algorithm, can be optimized by using a priority queue. Here an ample explanation of how the heap data structure works…

https://github.com/pianodaemon/cpp_magic/tree/master/algorithms_experiences/basic_heap

C functions linkage in C++

Hi everybody
To know what will happens with this example I’ll use the nm command (but you could also use readelf -s) which can list symbols from object files.

The main actor extern C
The extern C makes a function-name in C++ have C linkage, so that client C code can link to your function using a ‘C’ compatible header file that contains just the declaration of your function. Your function definition is contained in a binary format (that was compiled by your C++ compiler) that the client ‘C’ linker will then link to using the C name.

Before extern C

#include <stdio.h>

void
hola()
{
   printf("hello");
}

int main(){
   return 0;
   hola();
}
[eplauchu@eplauchu ~]$ gcc borrame.c -o 0.out && nm 0.out 
0000000000601034 B __bss_start
0000000000601034 b completed.6344
0000000000601030 D __data_start
0000000000601030 W data_start
0000000000400470 t deregister_tm_clones
00000000004004e0 t __do_global_dtors_aux
0000000000600e18 t __do_global_dtors_aux_fini_array_entry
00000000004005d8 R __dso_handle
0000000000600e28 d _DYNAMIC
0000000000601034 D _edata
0000000000601038 B _end
00000000004005c4 T _fini
0000000000400500 t frame_dummy
0000000000600e10 t __frame_dummy_init_array_entry
0000000000400738 r __FRAME_END__
0000000000601000 d _GLOBAL_OFFSET_TABLE_
                 w __gmon_start__
000000000040052d T hola
00000000004003e0 T _init
0000000000600e18 t __init_array_end
0000000000600e10 t __init_array_start
00000000004005d0 R _IO_stdin_used
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
0000000000600e20 d __JCR_END__
0000000000600e20 d __JCR_LIST__
                 w _Jv_RegisterClasses
00000000004005c0 T __libc_csu_fini
0000000000400550 T __libc_csu_init
                 U __libc_start_main@@GLIBC_2.2.5
0000000000400542 T main
                 U printf@@GLIBC_2.2.5
00000000004004a0 t register_tm_clones
0000000000400440 T _start
0000000000601038 D __TMC_END__
[eplauchu@eplauchu ~]$ g++ borrame.c -o 1.out && nm 1.out 
0000000000601034 B __bss_start
0000000000601034 b completed.6344
0000000000601030 D __data_start
0000000000601030 W data_start
0000000000400530 t deregister_tm_clones
00000000004005a0 t __do_global_dtors_aux
0000000000600de8 t __do_global_dtors_aux_fini_array_entry
0000000000400698 R __dso_handle
0000000000600df8 d _DYNAMIC
0000000000601034 D _edata
0000000000601038 B _end
0000000000400684 T _fini
00000000004005c0 t frame_dummy
0000000000600de0 t __frame_dummy_init_array_entry
00000000004007f8 r __FRAME_END__
0000000000601000 d _GLOBAL_OFFSET_TABLE_
                 w __gmon_start__
00000000004004a0 T _init
0000000000600de8 t __init_array_end
0000000000600de0 t __init_array_start
0000000000400690 R _IO_stdin_used
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
0000000000600df0 d __JCR_END__
0000000000600df0 d __JCR_LIST__
                 w _Jv_RegisterClasses
0000000000400680 T __libc_csu_fini
0000000000400610 T __libc_csu_init
                 U __libc_start_main@@GLIBC_2.2.5
0000000000400602 T main
                 U printf@@GLIBC_2.2.5
0000000000400560 t register_tm_clones
0000000000400500 T _start
0000000000601038 D __TMC_END__
00000000004005ed T _Z4holav

After extern C

#include <stdio.h>

#ifdef __cplusplus
extern "C"
{
#endif

void
hola()
{
   printf("hello");
}

#ifdef __cplusplus
};
#endif

int main(){
   return 0;
   hola();
}

[eplauchu@eplauchu ~]$ gcc borrame.c -o 0.out && nm 0.out 
0000000000601034 B __bss_start
0000000000601034 b completed.6344
0000000000601030 D __data_start
0000000000601030 W data_start
0000000000400470 t deregister_tm_clones
00000000004004e0 t __do_global_dtors_aux
0000000000600e18 t __do_global_dtors_aux_fini_array_entry
00000000004005d8 R __dso_handle
0000000000600e28 d _DYNAMIC
0000000000601034 D _edata
0000000000601038 B _end
00000000004005c4 T _fini
0000000000400500 t frame_dummy
0000000000600e10 t __frame_dummy_init_array_entry
0000000000400738 r __FRAME_END__
0000000000601000 d _GLOBAL_OFFSET_TABLE_
                 w __gmon_start__
000000000040052d T hola
00000000004003e0 T _init
0000000000600e18 t __init_array_end
0000000000600e10 t __init_array_start
00000000004005d0 R _IO_stdin_used
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
0000000000600e20 d __JCR_END__
0000000000600e20 d __JCR_LIST__
                 w _Jv_RegisterClasses
00000000004005c0 T __libc_csu_fini
0000000000400550 T __libc_csu_init
                 U __libc_start_main@@GLIBC_2.2.5
0000000000400542 T main
                 U printf@@GLIBC_2.2.5
00000000004004a0 t register_tm_clones
0000000000400440 T _start
0000000000601038 D __TMC_END__
[eplauchu@eplauchu ~]$ g++ borrame.c -o 1.out && nm 1.out 
0000000000601034 B __bss_start
0000000000601034 b completed.6344
0000000000601030 D __data_start
0000000000601030 W data_start
0000000000400530 t deregister_tm_clones
00000000004005a0 t __do_global_dtors_aux
0000000000600de8 t __do_global_dtors_aux_fini_array_entry
0000000000400698 R __dso_handle
0000000000600df8 d _DYNAMIC
0000000000601034 D _edata
0000000000601038 B _end
0000000000400684 T _fini
00000000004005c0 t frame_dummy
0000000000600de0 t __frame_dummy_init_array_entry
00000000004007f8 r __FRAME_END__
0000000000601000 d _GLOBAL_OFFSET_TABLE_
                 w __gmon_start__
00000000004005ed T hola
00000000004004a0 T _init
0000000000600de8 t __init_array_end
0000000000600de0 t __init_array_start
0000000000400690 R _IO_stdin_used
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
0000000000600df0 d __JCR_END__
0000000000600df0 d __JCR_LIST__
                 w _Jv_RegisterClasses
0000000000400680 T __libc_csu_fini
0000000000400610 T __libc_csu_init
                 U __libc_start_main@@GLIBC_2.2.5
0000000000400602 T main
                 U printf@@GLIBC_2.2.5
0000000000400560 t register_tm_clones
0000000000400500 T _start
0000000000601038 D __TMC_END__

How to utilize ioctl when writing a Linux kernel module for 3.10

The ioctl command numbers should be unique across the system in order to prevent errors caused by issuing the right command to the wrong device.

To help programmers create unique ioctl command codes, these codes have been
split up into several bitfields.  Such bitfields must be only manipulated with the _IO macros defined in linux/ioctl.h.

To device a new set of ioctl codes first of all you should read Documentation/ioctl/ioctl-number.txt and later check out how my example has come the theory toward the practice (code here).