DO YOU KNOW:
- turbo c compiler uses x86 family of microprocessor where as gcc compiler uses x386 family of microprocessor.
- 8086 microprocessor data bus carries 16 data line where as 80386 microprocessor data bus contain 32 data lines.
- In 8086 total 14 registers are present where in 80386 microprocessor total 16 nos. of registers are present.
- The main job od microprocessor is read and write operation and arithmetic operation.
- Total 127 devices are connected to a system.
- Entire available memory(RAM) is divided into different memory shell and each shell capacity capacity is 1 byte.
- A set of wires connected from one device to another device is called bus. two dedicated bus connected from microprocessor to RAM are address bus and data bus.
- Turbo C compiler permits us to access only 1048576bytes (1 MB) of memory where as gcc compiler permits us to access 4gb of memory.
- Any programs in any programming language works only in virtual memory.
- When control line carries 1 microprocessor does write operation and when carries 0 does read operation.
- In case of turbo c the required memory is 1 MB but the available memory is more than the required memory.But in case of Gcc compiler the required memory was 4gb but the available memory was less than the required memory. so the virtual memory concept was introduced.
- Virtual memory is a data structure implemented in the operating system.
- 8192 process can be run on a single system.
- The running program is known as process. each process allocates 4gb of virtual memory.
- Segmentation is a data structure used by the operating system by which it assigns 4gb of virtual memory to each process.
- 4gb virtual memory of a process is split-ed into two parts such as lower 3 gb memory is user space and upper 1gb is kernel space.
- Memory allocation in a program in any programming language is only possible in user space. the kernel module and device driver program allocates memory in kernel space.
- First 16 MB of RAM is known as DMA space and rest is known as normal space.
- The address generated by the microprocessor is known as logical address
- The function names and variable names in any programming language is known as identifiers or symbols.
- When we compile the source file all the symbols present in the source file are copied to the object file.
- Windows executable doesnot work in Linux environment and linux executable doesnot work in the windows environment because both the operating system follows different file system.
- File system is a driver which is implemented on a disk. file system is a data structure which arrange all the files and directories in adisk.
- Memory allocation in any programming language is possible using variable and functions. all variable and functions allocates memory in user space.
- User space again divided into 5 segments.
- text
- data
- bss
- heap
- stack
- All function in a program allocates memory in stack.Only malloc() and calloc() always allocates memory in heap.
- All uninitialized static variables in a program created in the Bss segment.
- All initialized static variables in a program created in the data segment.
- All arithmetic variables allocates memory in stack segment.
- Function names are constant pointers. they are created in text segment.
- Which symbol will be created in which segment that is decided by the compiler at the compile time.
- 1 mb of turbo c divided into 4 segments
- text
- data
- bss
- heap and stack
- The 3gb of one process is defer from the 3gb of other process but all the process share same 1gb kernel space.
- When function allocates memory in stack its address grows down order.
- Every dummy function in turbo c allocates 4 byte but in GCC it is 8 bytes.
- Stack size in gcc compiler is 10240 KB where stack and heap together is 64 KB.
- When function allocates memory in stack its address always grows down order.
- Every dummy function in turbo c allocates 4 bytes of memory where as in gcc it is 8 bytes.
- Pointer is a variable which refers only address. pointer to void type is known as generic pointer.
- Every function allocates memory in stack in the form of double linked list(a node which contains address to next node and a address to the previous node).
- Formal parameter of a function doesn't allocate memory but actual parameter always allocates memory.
- The size of function is
- size of pointer to the next address
- size of pointer to the previous address.
- size of local automatic variables
- size of actual parameters of the function
- Nested function is not allowed in any programming language because it is violating the lexical scoping of the compiler rules.
- Stack and heap are both run time segment, BSS and data are load time segment.
- Memory allocation in a program is only possible in load time and run time but how much memory will be allocated where the memory will be allocated that is decided in compile time and linking time.
- ID loader loads the program into memory in Linux. they are two types
- preloader
- cache loader
- A load time variable cannot be initialized with run time variable.
- The actual instruction which executes the program goes to text segment.
- The file which contains theheader information of a program is known as header file
- typedefs
- function prototypes
- macros
- external identifiers
- If it is required then include the header file,if not required but included the the header file it is unnecessary overloading to the compiler.
- typedef is used to create a new name of the data type.
- If typedef is defined in one c file that typedef cannot be accessed in other c file. the appropriate place is header file.
- Function body is executed when the function is called.
- If the function returntype is other than integer then function prototype is required.
- Prototypes are generally not written in a program. it is written inthe heaeder file.
- All mathematical functions library is libm.so, all standard input output library is libc.so.
- If the function body is defined below the main or above the main in the program that function cannot be reutilized in other program.
- Library is an object file which contain the function body and modules definition. it is used to hide the logic or codes of the program.
- libc.so is the default standard library in c which is linked with any program.
- Once library is created then no need to include the header file in the program.
No comments:
Post a Comment