Friday, April 19, 2019

Networking and communication sys (sockets) Assignment

Ne bothrking and communication sys (sockets) - Assignment ExampleIn contrast, for example, when we send letter through post office, no connection is established between the sender and recipient role of the letter .To reestablish connection in this connectionless communication governance, next letter is the only option. fig 2 Connection oriented and Connectionless Socket Programming(Ginni T. 2010) 3. Analyzing the flow of code from top to bottom gives a better understanding. Set up few variables to store information on the IP address and port on which the socket legion allow be executed to generate socket. Next, bound it to the specified addresses and port. Wait for incoming requests to establish connections. Once a client connection is received, the socket accepts the request to handle information exchange. Client now sends virtually data as input, which is read by the server socket and executed. Both generated sockets are terminated after server sends output certify to the cl ient (as in Khanna S.1995). Summarizing, the four important steps in socket programming between client and server involves opening the socket opening an input and output stream to the socket reading from and writing to the socket according to server protocols change up . 4. Socket is implemented at the client side for sending requests to the machine port, and requires IP/hostname (address) of the server magical spell Server Socket, executed on the server side, listens and answers client queries in reference to its port number. 5. Thread is the smallest building block of processes during execution that can be scheduled by an operating system. It is used for duplication of computer programs, when two or more tasks are executed concurrently. The string along has four high level states namely, ready, running, waiting and dead. Fig 3. A process with two reap of execution (Shaw Philip 2011) 6. Threads can be created by all implementing runnable interface when requirement is of sing le thread and extending the thread class for multiple threads. Depending on number of threads either of the two process is preferred. Extending Thread Class Fig4.Thread Creation(Olira G.) is preferred while creating multiple threads. 7. When a thread instead of being scheduled by current operating system is lined up by virtual machine, its called green thread whereas working thread usually handles many concurrent tasks, allocating one thread to perform one task. 8. Thread is the smallest unit of processes during execution, which can be organized by an operating system whereas runnable is an interface used to create threads in the same process. Implementing a Runnable may have some advantages over extending thread while creating single thread. 9. Multithreading is the execution of different parts of a processcalledthreads, concurrently at the same time without interfering with each other. In reference to multithreading, synchronization is the capability to fudge the access of multip le threads (or tasks) to the shared resources so that one thread do not spay a shared variable while another is in the process and hence, avoiding errors. In the diagram thither are three threads of a single process, each with a different query and response. Fig5. synchronism in Multithreading(LandrieuS.,2008) 10. Preemptive scheduling is the act of temporarily interrupting ataskbeing carried out by the processor and resuming it later. Time slicing is the time period for which

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.