Virtualization is the term which may be used in various cases like hardware, memory management, storage, desktop, data and network. In these cases it has different functions and meanings.
Here are some cases of virtualization:
Hardware virtualization - Execution of software in an environment separated from the underlying hardware resources
Memory virtualization - Aggregating RAM resources from networked systems into a single memory pool
There are other cases as well - network virtualization, storage virtualization and many more.
[Read More]
Storage virtualization
Storage virtualization is a concept in IT System Administration, referring to the abstraction (separation) of logical storage from physical storage so that it may be accessed without regard to physical storage or heterogeneous structure. This separation allows the Systems Admin increased flexibility in how they manage storage for end users.
Storage virtualization uses address space mapping to achieve location independence by abstracting the physical location of the data. The virtualization system presents to the user a logical space for data storage and itself handles the process of mapping it to the actual physical location.
[Read More]
Network virtualization
In computing, Network Virtualization is the process of combining hardware and software network resources and network functionality into a single, software-based administrative entity, a virtual network. Network virtualization involves platform virtualization, often combined with resource virtualization.
Network virtualization is categorized as either
1. External, combining many networks, or parts of networks, into a virtual unit,
2. Internal, providing network-like functionality to the software containers on a single system.
Whether virtualization is internal or external depends on the implementation provided by vendors that support the technology.
[Read More]
Self reproducing program in C
main(){char\*p="main(){char\*p=%c%s%c;
(void)printf(p,34,p,34,10);}%c"
(void)printf(p,34,p,34,10);}
zero sized allocation using malloc
int main() { int \*p \= 0; printf("before addr: %pn", p); p \= (int \*) malloc(0); printf("after addr: %pn", p); printf("sizeof: %un", sizeof(\*p)); \*p \= 1; printf("\--- %d -- this is the last statment.n", \*p); free(p); } Output
before addr: (nil)
after addr: 0x80496c8
sizeof: 4
-– 1 – this is the last statment.
Note :
Linux
allows a ‘read’ of the zero sized allocated memory allows a ‘write’ on the zero sized allocated memory sizeof shows an allocation of 4 bytes.
[Read More]
return and exit from main: difference
Basically the difference between following programs !
//ret.c
int main()
{
return 43;
}
//exit.c
int main()
{
exit(43);
}
well, there are three ways for the processes to exit: -
1. Voluntary exit (implicit)
2. Voluntary exit (explicit)
3. Involunatary exit
Voluntary exit can be implicit e.g. in case of return and explicit e.g.
in case of a call to exit(). Involuntary exit is like being killed by a
[Read More]
Pointer cause decay, references do not.
Decay means loss of type information. In C and C++, an array name ‘decays’ to pointer to the first element. The information lost is basically the number of elements in the array. This difference should be manifested by sizeof() operator in function f() and g(). References keep that information with them. such as ‘constness’ of int. Function names are also said to ‘decay’ into pointer to the function if only function name is used.
[Read More]
References and Constants
What is a reference?
A reference is nothing more than an alias. Anything you do with a reference you are actually doing to the object you are referencing.
float x=3.14;
float& intref=x; // intref is a reference to x
float* ptr=&intref; // ptr holds the address of x
float y=2.58;
intref=y; // x is now equal to 2.58
Another simple example:
void func(float& fr)
{
fr=99.99;
}
int main()
{
[Read More]
How to create function polymorphism in C
Why should we try for polymorphism in c?
There are already many high-level, easy-to-use languages out there with full object-oriented capabilities, including polymorphism. Why insist on doing this in C?
I am working on a communications systems simulator that is used, among other things, to estimate the complexity of different communication algorithms. It is able to do so at quite a low-level, keeping count of every operation required.
At one point, I found myself needing to execute the same algorithm, but with different data types.
[Read More]
C Strings
Strings are arrays of chars. String literals are words surrounded by double quotation marks.
"This is a static string" ```To declare a string of 49 letters, you would want to say:``` char string\[50\]; ```This would declare a string with a length of 50 characters. Do not forget that arrays begin at zero, not 1 for the index number. In addition, a string ends with a null character, literally a '\\0' character.
[Read More]