Lompat ke konten Lompat ke sidebar Lompat ke footer

CS604 Assignment 2 Solution 2021 || CS 604 Assignment No 1 Solution Spring 2021 || CS - 604 Asignmnt


 

Click on Button:

Use of FIFOs :

We continue to discuss the API for using FIFOs for IPC between UNIX/Linux processes. We call these processes client and server. The server process creates two FIFOs, FIFO1 and FIFO2, and opens FIFO1 for reading and FIFO2 for writing. The client process opens FIFO1 for writing and FIFO2 for reading. The client process writes a message to the server process and waits for a response from the server process. The server process reads the message sent by the client process and displays it on the monitor screen. It then sends a message to the client through FIFO2, which the client reads and displays on the monitor screen. The server process then closes the two FIFOs and terminates. The client, after displaying server’s message, deletes the two FIFOs and terminates. The protocol for the client-server interaction.

In the session shown in Figure 10.4, we show how to compile and run the client-server software. We run the server process first so it could create the two FIFOs to be used for communication between the two processes. Note that the server process is run in the background by terminating its command line with an ampersand (&).

The Advantages and Disadvantages of Threads  Four main advantages of threads are:

1. Responsiveness:  Multithreading an interactive application may allow a program to continue running even if part of it is blocked or is performing a lengthy operation, thereby increasing responsiveness to the user.

2. Resource sharing: By default, threads share the memory and the resources of the process to which they belong. Code sharing allows an application to have several different threads of activity all within the same address space.

3. Economy: Allocating memory and resources for process creation is costly. Alternatively, because threads share resources of the process to which they belong, it is more economical to create and context switch threads.

4. Utilization of multiprocessor architectures: The benefits of multithreading of multithreading can be greatly increased in a multiprocessor environment, where each thread may be running in parallel on a different processor. A single threaded process can only run on one CPU no matter how many are available. Multithreading on multi-CPU machines increases concurrency. 

Some of the main disadvantages of threads are:

1. Resource sharing: Whereas resource sharing is one of the major advantages of threads, it is also a disadvantage because proper synchronization is needed between threads for accessing the shared resources (e.g., data and files).

2. Difficult programming model: It is difficult to write, debug, and maintain multithreaded programs for an average user. This is particularly true when it comes to writing code for synchronized access to shared resources.


Posting Komentar untuk "CS604 Assignment 2 Solution 2021 || CS 604 Assignment No 1 Solution Spring 2021 || CS - 604 Asignmnt"