Child process termination

I was roaming through the Interprocess communication in Unix when i found something which can be shared:

i am just copying and pasting it here:

Child Process Termination

Once we have created a child process, there are two possibilities. Either the parent process exits before the child, or the child exits before the parent. Now, Unix’s semantics regarding parent-child process relations state something like this:

  • When a child process exits, it is not immediately cleared off the process table. Instead, a signal is sent to its parent process, which needs to acknowledge it’s child’s death, and only then the child process is completely removed from the system. In the duration before the parent’s acknowledgment and after the child’s exit, the child process is in a state called “zombie”.
  • When a process exits (terminates), if it had any child processes, they become orphans. An orphan process is automatically inherited by the ‘init’ process (process number 1 on normal Unix systems), and becomes a child of this ‘init’ process. This is done to ensure that when the process terminates, it does not turn into a zombie, because ‘init’ is written to properly acknowledge the death of its child processes.

When the parent process is not properly coded, the child remains in the zombie state forever. Such processes can be noticed by running the ‘ps’ command (shows the process list), and seeing processes having the string “<defunct>” as their command name.

What is being returned?

#include "stdio.h"
int main()
{
int i=10,j=20,k;
k=addsub(i,j);
printf("k=%d",k);
return 0;
}
addsub(int c, int d)
{
int x,y;
x=c-d;y=c+d;
return (x,y);
}

it’s the value of y which is returned here, because return statement never gives error if you write more than one arguments to it separated by a comma..it’s the last argument which is returned always.
so, the output is

k=30

which is faster ? p++; or p=p+1;

p++ is faster because on compilation it gets translated to three machine
instructions where as p=p+1 needs four machine instructions. All machine
instructions take the same time.

For p++ the instructions are:

mov ax

inc ax

mov

ax

For p p+ 1 the instructions would be

mov ax

mov bx 1

add bx

mov

ax

This is why p++ is faster than p+1!

Difference: FAT n NTFS?

NTFS

1)allows access local to w2k w2k3 XP win NT4 with SP4 & later may get access for somefile.

2)Maximum size of partition is 2 Terabytes & more.

3)Maximum File size is upto 16TB.

4)File & folder Encryption is possible only in NTFS.

FAT 32

1)Fat 32 Allows access to win 95 98 win millenium win2k xp on local partition.

2)Maximum size of partition is upto 2 TB.

3)Maximum File size is upto 4 GB.

4)File & folder Encryption is not possible