Archive for the ‘Tricks’ Category

Linux process segment layout

Read Full Post »

wikipedia defination ABI&API

  • ABI

In computer software, an Application Binary Interface describes the low-level interface between an application and the OS or other application.

ABIs cover details such as data type, size, and alignment; the calling convention, which controls how functions‘ arguments are passed and return values retrieved; the system call numbers and how an application should make system calls to the operating system; and in the case of a complete operating system ABI, the binary format of object files, program libraries and so on. A complete ABI, such as the Intel Binary Compatibility Standard (iBCS), allows a program from one operating system supporting that ABI to run without modifications on any other such system, provided that necessary shared libraries are present, and similar prerequisites are fulfilled.

  • API

An application programming interface is a particular set of rules and specifications that a software program can follow to access and make use of the services and resources provided by another particular software program that implement that API. It serves as an interface between different software programs and facilitates their interaction, similar to the way the user interface facilitates interaction between humans and computers.

An API can be created for applications, libraries, operating systems, etc., as a way of defining their “vocabularies” and resources request conventions . It may include specifications for routines, data structures, object classes and protocols used to communicate between the consumer program and the implementer program of the API

Read Full Post »

SIZE aligned memory allocation.

Most CPUs require that object and variables reside at paticular offsets in the systems memory. On most Unix systems, an attempt to use misaligned data results in a bus error, which terminates the program altogether. Most compilers automatically align data variables according to their type and the particular processor being used. And under the other circumstances, for example, DMA data transfer will also require the memory block is page-size aligned.

So how to allocate SIZE aligned memory chunk in your program ?


Read Full Post »