################################################################################
################################################################################
################################################################################
####################
Note: void pointer came with C89(iso standard)
Socket is an end to end communication technique. Socket is a tuple of Ip
address and port number.
Server can be Iterative or Concurrent server.
Iterative server :
The server which can serves the single client's request at a
time.
Concurrent Server:
The server which can serves the multiple client's request at
a time.
Cocurrency can be obtained by either:
#multiple process--parent-child(fork() call)
#multi-threaded process
#I/o Multiplexing techniques(Select method)
Note: When connection is to be established kernel maintains two queues:
1) Incomplete connection queue
2) Complete connection queue
bind() call associates the particular Ip address and port number to it.
listen calls decides how many clients are present in Incomplete and
complete connection queue.
Accept() call is blocked only when complete connection queue is empty.
Connection Establishment is three way Handshaking process which is
initiated by client with "connect()" system call.
################################################################################
######################################
Note: FIN message is sent when either socket is closed for write end or
both. It is also sent when close(sd) is called.
Shutdown call only closes the socket for either read or write or both
operation.
It doesn't decreases the reference count.
shutdown(int sd,int option);
option:
SHUT_RD , SHUT_WR , SHUT_RDWR
close(sd) ---> decreases the reference count by 1 and releases resources only
when reference count is 0.
Possibility of Zombie(Defunct ) process in Parent-child(Concurrent server)===>
In case of parent-child concurrent server, in order to maintain concurrency
parent can't wait for collecting exit status of
child process.So it is always possible child completes it's processing and
exits before parent process completes execution.
This causes zombie or defunt process creation. To get rid of zombie process
creation , we can use signal which led to (user-defined ) function is called on
signal SIGCHLD is recieved .This function takes care of obtaining status of
child process. waitpid() version of system called is used with polling
mechanism.
Note: Zombie process are in termination state so it doesn't takes part in CPU
scheduling but it's record on PCB is still there.
Threading concepts:
Thread can be joinable thread or detached thread.
Threads are by default joinable.
Detached thread :
AS soon as detached thread exits, resources allocated to thread are freed
immediately.
Joinable thread:
joinable thread blocks one thread till exit or completion of other thread.
Non-blocking(with polling) is bit faster than blocking techniqueue.
Non-blocking(with polling) absorbs more cpu cycle as it is running state.
Blocking process goes to sleep state, so doesn't takes cpu cycle.

Socket related concepts

  • 1.
    ################################################################################ ################################################################################ ################################################################################ #################### Note: void pointercame with C89(iso standard) Socket is an end to end communication technique. Socket is a tuple of Ip address and port number. Server can be Iterative or Concurrent server. Iterative server : The server which can serves the single client's request at a time. Concurrent Server: The server which can serves the multiple client's request at a time. Cocurrency can be obtained by either: #multiple process--parent-child(fork() call) #multi-threaded process #I/o Multiplexing techniques(Select method) Note: When connection is to be established kernel maintains two queues: 1) Incomplete connection queue 2) Complete connection queue bind() call associates the particular Ip address and port number to it. listen calls decides how many clients are present in Incomplete and complete connection queue. Accept() call is blocked only when complete connection queue is empty. Connection Establishment is three way Handshaking process which is initiated by client with "connect()" system call. ################################################################################ ###################################### Note: FIN message is sent when either socket is closed for write end or both. It is also sent when close(sd) is called. Shutdown call only closes the socket for either read or write or both operation. It doesn't decreases the reference count. shutdown(int sd,int option); option: SHUT_RD , SHUT_WR , SHUT_RDWR close(sd) ---> decreases the reference count by 1 and releases resources only when reference count is 0. Possibility of Zombie(Defunct ) process in Parent-child(Concurrent server)===> In case of parent-child concurrent server, in order to maintain concurrency parent can't wait for collecting exit status of child process.So it is always possible child completes it's processing and exits before parent process completes execution. This causes zombie or defunt process creation. To get rid of zombie process creation , we can use signal which led to (user-defined ) function is called on signal SIGCHLD is recieved .This function takes care of obtaining status of child process. waitpid() version of system called is used with polling mechanism.
  • 2.
    Note: Zombie processare in termination state so it doesn't takes part in CPU scheduling but it's record on PCB is still there. Threading concepts: Thread can be joinable thread or detached thread. Threads are by default joinable. Detached thread : AS soon as detached thread exits, resources allocated to thread are freed immediately. Joinable thread: joinable thread blocks one thread till exit or completion of other thread. Non-blocking(with polling) is bit faster than blocking techniqueue. Non-blocking(with polling) absorbs more cpu cycle as it is running state. Blocking process goes to sleep state, so doesn't takes cpu cycle.