Wednesday, 16 December 2015
Tuesday, 17 November 2015
* vs &
* is for pointer
& store only reference
* can be reinitialised
& is defined only once during initialisation
& store only reference
* can be reinitialised
& is defined only once during initialisation
Tuesday, 30 June 2015
string vs char pointer
accept
|
The difference here is that
will place Hello world in the read-only parts of the memory and making s a pointer to that, making any writing operation on this memory illegal. While doing:
puts the literal string in read-only memory and copies the string to newly allocated memory on the stack. Thus making
legal.
|
Monday, 29 June 2015
c program
compiler like gcc look for header files with brackets <> in standard paths like:
/user/include
/user/local/include
for other header files(#include"current.h") it look for in the current directory first & after that in standard path
Thursday, 23 April 2015
64 bit operating system
64 bit os means os is capable of accessing 64 bit address space & hence have corresponding RAM available.
it is due to the restriction of space on motherboard that we cannot accomodate such large ram 2^64 .Hence we use ram of about 8gb & max 16 gb .
it is due to the restriction of space on motherboard that we cannot accomodate such large ram 2^64 .Hence we use ram of about 8gb & max 16 gb .
Thursday, 9 April 2015
some facts on memory management n file management
Reduce storage overhead in access control in memory management by giving access permission to group of user.
A File Control Block (FCB) is a file system structure in which the state of an open file is maintained. An FCB is managed by the operating system, but it resides in the memory of the program that uses the file, not in operating system memory. This allows a process to have as many files open at one time as it wants to, provided it can spare enough memory for an FCB per file.
A File Control Block (FCB) is a file system structure in which the state of an open file is maintained. An FCB is managed by the operating system, but it resides in the memory of the program that uses the file, not in operating system memory. This allows a process to have as many files open at one time as it wants to, provided it can spare enough memory for an FCB per file.
Tuesday, 7 April 2015
process scheduling
Multiprocessing aims that maximum of the CPU should be utilized.Whenever some process is waiting ,at that time cpu is free and os give cpu to some other process.
Almost all cpu resources all scheduled before their use.
Ready queue : A newly arrived process is stored in ready queue from where CPU allocation is done by os to execute the process
PCB stores this ready , wait or active status of process.
The entry of all the PCBs of the current processes is in : Process table
Non Pre-emptive scheduling:
1)process switches from running to wait
2)process terminate
A new process must be executed in non preemptive scheduling.
Pre emptive scheduling:
1-When a process switches from the running state to the ready state (for
example, when an interrupt occurs)
2-When a process switches from the waiting state to the ready state (for
example, at completion of I/0)
Windows 95 onwards and mac uses preemptive scheduling
Almost all cpu resources all scheduled before their use.
Ready queue : A newly arrived process is stored in ready queue from where CPU allocation is done by os to execute the process
PCB stores this ready , wait or active status of process.
The entry of all the PCBs of the current processes is in : Process table
Non Pre-emptive scheduling:
1)process switches from running to wait
2)process terminate
A new process must be executed in non preemptive scheduling.
Pre emptive scheduling:
1-When a process switches from the running state to the ready state (for
example, when an interrupt occurs)
2-When a process switches from the waiting state to the ready state (for
example, at completion of I/0)
Windows 95 onwards and mac uses preemptive scheduling
Thursday, 26 March 2015
Functions variable duplication
Every time we pass some argument to a function call , function defination form a new copy of the function arguments.
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.
Friday, 30 January 2015
general linux ,
/usr/bin/setup - this setup is used to change keyboard,firewall,mouse,printer configuration settings.
ls /usr/bin -show all commands
ls /usr/bin -show all commands
/bin: For binaries usable before the/usrpartition is mounted. This is used for trivial binaries used in the very early boot stage or ones that you need to have available in booting single-user mode. Think of binaries likecat,ls, etc./sbin: Same, but for scripts with superuser (root) privileges required./usr/bin: Same as first, but for general system-wide binaries./usr/sbin: Same as above, but for scripts with superuser (root) privileges required.fdisk -l - to show all hard drivesuname -r : to see kernel version
Subscribe to:
Comments (Atom)