fork() created a newly independent process that has it's own
space in memory and also has own permission depends upon
what you assign
Using exec() the created process is a sub thread of calling
process. They also share area in memory and so that also
share all permission and resources.
process and task as synonymous. One or more threads
together form a process. The threads, two or more belong to
same process, share same address space of the process and
can access all the global variable of the process.
Where as two processes can't access each other's address
space and hence cant access their global variable. Two
processes can talk with each other using IPC.
what are the things that are acquired by the child
process from the parent process?
File descriptors [including socket descriptor].
The whole text segment.
PPID is PID of parent process.
Process is an executing program with several components and
4. memory context
6. file descriptors
7. security credentials.
processes began through a process called "fork and exec".
that is when one command starts another, the child process
first forks , the kernel copying over pages of memory from
the present process to a new location for the child process.
The child then execs, executing the new command and
overwriting the data.the thread is , which controls the flow
of the process. A process needs at least one thread.
bind system call assigns a name to the unnamed socket.
Binding an address allows a process to register its address
with the system. This makes it possible for other process to
port : a particular port number on a host
socket: a host and a port
-> http port = 80
-> when you fire up google.com
the socket on the server side is google.com:80 this is the server side socket
on your local system where you are browsing the socket is
yourip:port above 1024
After accepting connection on socket of server side. we can
get the client ip address and port by to functions. These
functions are belonging in "/usr/include/arpa/inet.h" header
Here is some scratch from the code.
socket2 = accept(socket1, (struct sockaddr *)&client, &addrlen);