Every time we pass some argument to a function call , function defination form a new copy of the function arguments.
Thursday, 26 March 2015
Inline functions,inline functions vs normal functions
Inline functions is a function expansion which aims at improving the code performance by reducing run time at the cost of memory.
-a new copy of inlined functions are formed everytime it is called which makes the execution fast
-reduces calling overheads
-inling is done at compile time while macro expansion occurs at pre-processing stage
-best for small functions as a new copy is created every time
-In C++ the member functions of a class, if defined within the class definition, are inlined by default (no need to use the inline keyword); otherwise, the keyword is needed
-used for functions executed frequently
- a normal function is executed by making a call which transfers the control to function defination while in inline functions function call is eliminated & direct function defination is implemented.
inline vs normal functions
-inline functions consume more memory
-inline functions are faster than normal functions
Inline function expansion is supported by c and c++ but not by JAVA.
-a new copy of inlined functions are formed everytime it is called which makes the execution fast
-reduces calling overheads
-inling is done at compile time while macro expansion occurs at pre-processing stage
-best for small functions as a new copy is created every time
-In C++ the member functions of a class, if defined within the class definition, are inlined by default (no need to use the inline keyword); otherwise, the keyword is needed
-used for functions executed frequently
- a normal function is executed by making a call which transfers the control to function defination while in inline functions function call is eliminated & direct function defination is implemented.
inline vs normal functions
-inline functions consume more memory
-inline functions are faster than normal functions
Inline function expansion is supported by c and c++ but not by JAVA.
Wednesday, 25 March 2015
virtual address vs physical address vs logical address
virtual address:
This is the address virtually seen by the process.
physical address :
This is the actual hardware physical address .
Lets our system has 4gb of ram
Every process will assume to have virtual address of 4gb .But actually all the space is not used .
Virtual address is converted to physical address using page tables.
vmalloc-allocate physical address
kmalloc-allocate virtual address
logical and virtual memory are kind of same .
virtual address range - 2^32 for 32bit os
API vs system calls
API-application programming interface:
API exist at the user as well as kernel level .
API at user level often call internal system calls to implement their execution.
The kernel API is for programming inside the kernel, e.g. for writing drivers, or for providing new system calls.
System call - is how a program requests services from the operating system at the kernel level .System calls are written at kernel level like write,open etc.
Subscribe to:
Comments (Atom)