Page 63 - DCAP403_Operating System
P. 63

Operating System




                    Notes          Computation Speedup

                                   A task can often be run faster if it is broken into subtasks and distributed among different
                                   processes. For example, the matrix multiplication code you saw in class. This depends upon the
                                   processes sharing data. (Of course, real speedup also required having multiple CPUs that can be
                                   shared as well.) For another example, consider a web server which may be serving many clients.
                                   Each client can have their own process or thread helping them. This allows the server to use the
                                   operating system to distribute the computer’s resources, including CPU time, among the many
                                   clients.

                                   Modularity

                                   It may be easier to organize a complex task into separate subtasks, and then have different
                                   processes or threads running each subtask.


                                          Example: A single server process dedicated to a single client may have multiple threads
                                   running – each performing a different task for the client.
                                   Convenience


                                   An individual user can run several programs at the same time, to perform some task.

                                          Example: A network browser is open, while the user has a remote terminal program
                                   running (such as telnet), and a word processing program editing data.

                                   Cooperation between processes requires mechanisms that allow processes to communicate data
                                   between each other and synchronize their actions so they do not harmfully interfere with each
                                   other. The purpose of this note is to consider ways that processes can communicate data with
                                   each other, called Inter-process Communcation (IPC).




                                      Note    Another note will discuss process synchronization, and in particular, the most
                                     important means of synchronizing activity, the use of semaphores.

                                   4.5 Inter-process Communication


                                   Inter-process Communication (IPC) is a set of techniques for the exchange of data among two
                                   or more threads in one or more processes. It involves sending information from one process
                                   to another. Processes may be running on one or more computers connected by a network. IPC
                                   techniques are divided into methods for message passing, synchronization, shared memory, and
                                   Remote Procedure Calls (RPC). The method of IPC used may vary based on the bandwidth and
                                   latency of communication between the threads, and the type of data being communicated.
                                   Two processes might want to co-operate in performing a particular task. For example a process
                                   might want to print to document in response to a user request, so it starts another process to
                                   handle the printing and sends a message to it to start printing. Once the process handling the

                                   printing request finishes, it sends a message back to the original process, which reads the message
                                   and uses this to pop up a dialog box informing the user that the document has been printed.
                                   There are other ways in which processes can communicate with each other, such as using a
                                   shared memory space.





          56                               LOVELY PROFESSIONAL UNIVERSITY
   58   59   60   61   62   63   64   65   66   67   68