, (IPC interprocess communications), . ||.
, , . , . , , . || ||, , .
' , , API || . || , || , || , , (CD, , -') . , ' , . ֳ || . , (, ).
|| ' || ' . || , |',| , || || '.
IPC (interprocess communication) UNIX : - || || , || ' - || , || .
| 䳿 /||, , , ', , .
, , || , ||. : ( ), || - ( ), ( ).
Unix . ||, || , || , || || . .., , || , .
|
|
|| | | , , || . 䳿 볺 ||. '|,| . 볺 '|,|, , , . || 䳿 ||.
/|| Unix, || , || , || . . || || || . .. Unix /||, ||, . Գ || || .
/|| |',| , Unix. , ||, || || |,| || .
|| Unix:
- - /|| || || . || :
- - |,| :
1) || 0 (stdin);
2) || 1 || (stdout);
3) || 2 || (stderr);
- , || , || , , || .
, || .
- :
- , ;
- ||;
- ||.
, /||, - stdin, stdout stderr.
|| - . ||, || | ||, |,| . ||, '|| Unix. || Unix . |,| (|| ), |,| ' , || , ||. |',,'| || - ||.
|
|
Linux
|',| || OC Linux. , || , , , , || . ( ) .
. , , || , ||. ( , , CD DVD ). , , |',| |,| .
|| . || . || .
, ||, Linux ( , ).
Ext2/3
Linux Linux-. Ext2/3 '|'| . Ext3 Ext2 || , - . || (Ext3), .
ReiserFS
|,| : , |,,| || || . ||, ReiserFS || |,| . ϳ .
XFS
, || , - . ϳ .
SWAPFS
|| || (swap). Linux ', ', || .
JFS
IBM || , , . ϳ .
|
|
Linux , || , , . || , , , || ( ||). , .
FAT12/FAT16/FAT32
ֳ MS-DOS Windows, (, USB-Flash). Linux .
NTFS
NTFS '|| Windows NT, || Windows. Linux NTFS || .
, Linux, MS-DOS Microsoft Windows, |',| . root ||. || ' . , || || , || |. - || || . |',| . mount.
Linux ( , || /) ( ', swap). , , || '.
Linux ||, || , |,| || - . , .
, 4 :
Swap
' ( Linux swap), || '|| .
(root)
|| . ³ | | || || , || . '|| , || 300. ||, || ||, /opt, || . /opt.
Usr
: || /usr. |',| , || || . , ||, || || 100 || . 1-2 ( ) | | .
Home
|| . . || HTTP . ( ) . |',,'| |',| /usr || /.
|
|
Linux || || :
Bin
, : shell, .
Boot
, || , .
Dev
, || ||. Linux ||, , , , || || . || , || || , .
Etc
|| , || . Linux | | , || .
Home
Linux || (.. || ), || /home.
Lib
, .
Mnt
|| .
Proc
||, || .
Root
.
Sbin
.
Usr
.
Var
, : ( |, || .), || (, || 䳿, || ).
Tmp
Linux || , || . || ( ):
| 1 2 - 1 2
rm 1 - 1
mv 1 2 - 1 2
mkdir ' - || '
rmdir ' - '
ls ' - '
cat ' - '
chown ' -
Unix. . . . -
, 䳿 . || , . || , .
Unix , , Unix , , ||.
Unix . || . , . .. , || init || . 16- | , (PID). PPID.
|| . Unix '|| || , || .
|| , fork (), || , . , || || . , |,| PID, |',| , .
|
|
exec() , || | . exec() |',| ' , , , . , fork(), ( main).
- |',| || .
. || :
- ( );
- ( );
- (, || );
- || (, 䳿);
- (, ).
, '.
|| , ||. || |',| . ' . , ||. '. . ' . || . , , :
- ;
- ||.
. , || 100 |, 1 .
||, || , || , | | || '. || |',| , . , , , || /||.
|| ||, || .
|| . Unix , || , , . || , , || . , , nice(), |',| , || || . ҳ|| || || root || , nice() || .
:
- exit() ||;
- main().
, exit() return .
|,| || : SIGTERM, SIGFPE, SIGSEGV, SIGKILL, SIGABRT .. || kill(), |',| , || , ( SIGTERM). abort().
- Unix-, , || , .
: || ( PID) || , . SIGCHLD, ||, || || wait(), , , , || || . || SIGCHLD (|| ), - . || || SIGCHLD.
, id
pid_t pid1;
printf("It is parent process id = %d \n", (int)getpid());
pid1 = fork();
if (pid1 < 0)
{
printf("Error process not created \n");
exit(0);
}
if (pid1!=0)
{
wait(&child_status);
if (WIFEXITED(child_status))
printf(" %d\n", WEXITSTATUS(child_status));
else
printf(" %d\n", WTERMSIG(child_status));
}
else
printf("Child process with id = %d \n his father %d \n", (int)getpid(), (int)getppid());