Free Essay

Inter-Process Communication (Ipc)

In:

Submitted By salmituah
Words 2437
Pages 10
1. Inter-process Communication (IPC)
Introduction
Inter-Process Communication, which in short is known as IPC, deals mainly with the techniques and mechanisms that facilitate communication between processes. Now, why do we need special separate mechanisms or techniques for communicating between processes? Why isn't it possible to have information shared between two processes without using such special mechanisms?
Let us start from something primitive. Imagine you have two glasses completely filled with water. One glass contains hot water and the other contains cold water. What can you do to make the temperature of water in both the glasses equal? The simplest answer will be to mix the water from both the glasses in a glass with much bigger capacity. Once water is mixed, the temperature becomes equal after some time. If one can remember, this will be framed as a problem with some numerical data in a High-School Physics examination. If we go by principles, then the phenomenon here is conduction. If we go by our topic of IPC, then we can say that since the two glasses were full, we had to use another glass with a larger capacity to mix the contents in order to balance their heat energy.
We know that some medium or other is required for communication between different processes. Similarly, when it comes to computer programs, we need some mechanism or medium for communication. Primarily, processes can use the available memory to communicate with each other. But then, the memory is completely managed by the operating system. A process will be allotted some part of the available memory for execution. Then each process will have its own unique user space. In no way will the memory allotted for one process overlap with the memory allotted for another process. Imagine what would happen otherwise!
The operating system's kernel, which has access to all the memory available, will act as the communication channel. Similar to our earlier example, where the glass with hot water is one process address space, the glass with cold water is another, and the glass with the larger capacity is the kernel address space, so that we pour both hot water and cold water into the glass with larger capacity.
What next? There are different IPC mechanisms which come into use based on the different requirements. In terms of our water glasses, we can determine the specifics of both pouring the water into the larger glass and how it will be used after begin poured.
The IPC mechanisms can be classified into the following categories as given below:
a. pipes
b. fifos
c. message queues
d. Semaphores A. Pipes
Pipes were evolved in the most primitive forms of the Unix operating system. They provide unidirectional flow of communication between processes within the same system. In other words, they are half-duplex, that is, data flows in only one direction. A pipe is created by invoking the pipe system call, which creates a pair of file descriptors. These descriptors point to a pipe inode and the file descriptors are returned through the filedes argument. In the file descriptor pair, filedes[0] is used for reading whereas filedes[1] is used for writing.
Let me explain a scenario where we can use the pipe system call: consider a keyboard-reader program which simply exits after any alpha-numeric character is pressed on the keyboard. We will create two processes; one of them will read characters from the keyboard, and the other will continuously check for alpha-numeric characters. Let us see how the filedes returned by pipe can be of use in this scenario:
#include
#include
#include
#include
#include
#include

int filedes[2];

void *read_char()
{
char c; printf("Entering routine to read character.........\n"); while(1) { /* Get a character in 'c' except '\n'. */ c = getchar(); if(c == '\n') c = getchar(); write(filedes[1], &c, 1); if(isalnum(c)) { sleep(2); exit(1); } }
}

void *check_hit()
{
char c; printf("Entering routine to check hit.........\n"); while(1) { read(filedes[0], &c, 1); if(isalnum(c)) { printf("The key hit is %c\n", c); exit(1); } else { printf("key hit is %c\n", c); } }
}

int main()
{
int i; pthread_t tid1, tid2; pipe(filedes); /* Create thread for reading characters. */ i = pthread_create(&tid1, NULL, read_char, NULL); /* Create thread for checking hitting of any keyboard key. */ i = pthread_create(&tid2, NULL, check_hit, NULL); if(i == 0) while(1); return 0;
}
The read_char function simply reads a character other than '\n' from the keyboard and writes it to filedes[1]. We have the thread check_hit, which continuously checks for the character in filedes[0]. If the character in filedes[0] is an alpha-numeric character, then the character is printed and the program terminates.
One major feature of pipe is that the data flowing through the communication medium is transient, that is, data once read from the read descriptor cannot be read again. Also, if we write data continuously into the write descriptor, then we will be able to read the data only in the order in which the data was written. One can experiment with that by doing successive writes or reads to the respective descriptors.
So, what happens when the pipe system call is invoked? A good look at the manual entry for pipe suggests that it creates a pair of file descriptors. This suggests that the kernel implements pipe within the file system. However, pipe does not actually exist as such - so when the call is made, the kernel allocates free inodes and creates a pair of file descriptors as well as the corresponding entries in the file table which the kernel uses. Hence, the kernel enables the user to use the normal file operations like read, write, etc., which the user does through the file descriptors. The kernel makes sure that one of the descriptors is for reading and another one if for writing. B. FIFOs
FIFOs (first in, first out) are similar to the working of pipes. FIFOs also provide half-duplex flow of data just like pipes. The difference between fifos and pipes is that the former is identified in the file system with a name, while the latter is not. That is, fifos are named pipes. Fifos are identified by an access point which is a file within the file system, whereas pipes are identified by an access point which is simply an allotted inode. Another major difference between fifos and pipes is that fifos last throughout the life-cycle of the system, while pipes last only during the life-cycle of the process in which they were created. To make it more clear, fifos exist beyond the life of the process. Since they are identified by the file system, they remain in the hierarchy until explicitly removed using unlink, but pipes are inherited only by related processes, that is, processes which are descendants of a single process.
Let us see how a fifo can be used to detect a keypress, just as we did with pipes. The same program where we previously used a pipe can be modified and implemented using a fifo.
#include
#include
#include
#include
#include
#include
#include
#include
#include

extern int errno;

void *read_char()
{
char c; int fd; printf("Entering routine to read character.........\n"); while(1) { c = getchar(); fd = open("fifo", O_WRONLY); if(c == '\n') c = getchar(); write(fd, &c, 1); if(isalnum(c)) { exit(1); } close(fd); }
}

int main()
{
int i; pthread_t tid1; i = mkfifo("fifo", 0666); if(i < 0) { printf("Problems creating the fifo\n"); if(errno == EEXIST) { printf("fifo already exists\n"); } printf("errno is set as %d\n", errno); } i = pthread_create(&tid1, NULL, read_char, NULL); if(i == 0) while(1); return 0;
}
Compile this program using cc -o write_fifo filename.c. This program reads characters (keypresses), and writes them into the special file fifo. First the program creates a fifo with read-write permissions using the function mkfifo. See the manual page for the same. If the fifo exists, then mkfifo will return the corresponding error, which is set in errno. The thread read_char continuously tries to read characters from the keyboard.
Note that the fifo is opened with the O_WRONLY (write only) flag .
Once it reads a character other than '\n', it writes the same into the write end of the fifo. The program that detects it is given below:
#include
#include
#include
#include
#include
#include
#include
#include
#include

extern int errno;

void *check_hit()
{
char c; int fd; int i; printf("Entering routine to check hit.........\n"); while(1) { fd = open("fifo", O_RDONLY); if(fd < 0) { printf("Error opening in fifo\n"); printf("errno is %d\n", errno); continue; } i = read(fd, &c, 1); if(i < 0) { printf("Error reading fifo\n"); printf("errno is %d\n", errno); } if(isalnum(c)) { printf("The key hit is %c\n", c); exit(1); } else { printf("key hit is %c\n", c); } }
}

int main()
{
int i; i = mkfifo("fifo", 0666); if(i < 0) { printf("Problems creating the fifo\n"); if(errno == EEXIST) { printf("fifo already exists\n"); } printf("errno is set as %d\n", errno); } pthread_t tid2; i = pthread_create(&tid2, NULL, check_hit, NULL); if(i == 0) while(1); return 0;
}
Here, again, it first tries to create a fifo which is created if it does not exist. We then have the thread check_hit which tries to read characters from the fifo. If the read character is alphanumeric, the program terminates; otherwise the thread continues reading characters from the fifo.
Here, the fifo is opened with the flag O_RDONLY.
Compile this program with cc -o detect_hit filename.c. Now run the two executables in separate terminals, but in the same working directory. Irrespective of the order in which you run, look for the message fifo already exists on the console. The first program (either of the two) that you run will not give any error message for creation of the fifo. The second program that you run will definitely give you the error for creation of the fifo. In the terminal where you run write_fifo, give input to standard output from your keyboard. You will get the message regarding the key hit on the keyboard on the terminal running the executable detect_hit. Analyze the working of the two programs by hitting several keys.
I have used two different programs for exhibiting the usage of fifos. This can be done within a single program by forking the routines which are called in the two program as threads. But I did this to show that unlike pipes, fifos can be used for communication between unrelated processes.
Now try running the program again. You will get the message that the fifo already exists even when you first run either of the two programs. This shows that fifos are persistent as long as the system lives. That is, the fifos will have to be removed manually - otherwise they will be permanently recognized by the file system. This is unlike pipes which are inherited as long as the process that created the pipe is running. Once this process dies, the kernel also removes the identifiers (file descriptors) for the pipe from the the file tables.
The usage is rather simple and the main advantage is that there is no need for any synchronization mechanism for accesses to the fifo. There are certain disadvantages: they can only be used for communication between processes running on the same host machine. Let us explore other IPC mechanisms to see what have they in store.

C. Message Queues
Message queues are one of the three different types of System V IPC mechanisms. This mechanism enables processes to send information to each other asynchronously. The word asynchronous in the present context signifies that the sender process continues with its execution without waiting for the receiver to receive or acknowledge the information. On the other side, the receiver does not wait if no messages are there in the queue. The queue being referred to here is the queue implemented and maintained by the kernel.
Let us now take a look at the system calls associated with this mechanism. msgget: This, in a way similar to shmget, gets a message queue identifier. The format is int msgget(ket_t key, int msgflg);
The first argument is a unique key, which can be generated by using ftok algorithm. The second argument is the flag which can be IPC_CREAT, IPC_PRIVATE, or one of the other valid possibilities (see the man page); the permissions (read and/or write) are logically ORed with the flags. msgget returns an identifier associated with the key. This identifier can be used for further processing of the message queue associated with the identifier. msgctl: This controls the operations on the message queue. The format is int msgctl(int msqid, int cmd, struct msqid_ds *buf);
Here msqid is the message queue identifier returned by msgget. The second argument is cmd, which indicates which action is to be taken on the message queue. The third argument is a buffer of type struct msqid_ds. Each message queue has this structure associated with it; it is composed of records for queues to be identified by the kernel. This structure also defines the current status of the message queue. If one of the cmds is IPC_SET, some fields in the msqid_ds structure (pointed by the third argument) will be set to the specified values. See the man page for the details. msgsnd: This is for sending messages. The format is int msgsnd(int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg);
The first argument is the message queue identifier returned by msgget. The second argument is a structure that the calling process allocates. A call to msgsnd appends a copy of the message pointed to by msgp to the message queue identified by msqid. The third argument is the size of the message text within the msgbuf structure. The fourth argument is the flag that specify one of several actions to be taken as and when a specific situation arises. msgrcv: This is for receiving messages. The format is ssize_t msgrcv(int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp, int msgflg);
Besides the four arguments mentioned above for msgsnd, we also have msgtyp, which specifies the type of message requested.
Let's take a look at an example of using message queues.
#include
#include
#include
#include
#include
#include
#include

#define NMSGS 5

extern int errno;

struct msgbuf { long mtype; char mtext[100];
};

int main()
{
int msgid; int i, nloop; struct msgbuf msgp;

char tmp_msg[100]; tmp_msg[0] = '\0';

msgid = msgget(9999, IPC_CREAT | 0666); if(msgid < 0) { printf("%d : Error number is %d\n", __LINE__, errno); exit(1); }

for(nloop=0;nloop

Similar Documents

Free Essay

Interprocesscommunication

... June 2014 ISSN (Print) : 0974-6846 ISSN (Online) : 0974-5645 A New Approach for Inter Process Communication with Hybrid of Message Passing Mechanism and Event based Software Architecture Farhad Soleimanian Gharehchopogh*, Esmail Amini and Isa Maleki Computer Engineering Department, Science and Research Branch, Islamic Azad University, West Azerbaijan, Iran; bonab.farhad@gmail.com, es.amini56@gmail.com, maleki.misa@gmail.com Abstract In this paper, we use software architecture style based on event-driven and message passing communication method and determine a framework for interaction among practicable processes on Operating System (OS). In the proposed method, the required data are sent to the process or other processes in a standard message frame and with determined structure to the OS, then, the OS distributes the received message considering its recipient processes in the system, rather a process communicates directly with other specific process. The major features of the proposed method include the synchronization among the processes, the simplicity of implementation, easy extensibility, remote access which finally can improve the interaction between the OS and processes. Along with producing the systems based on an integrated frame, we obtain a determined standard in Inter Process Communication (IPC) by mediating an OS. 1. Introduction Keywords: Event-driven, IPC, Message Passing, OS, Software Architecture The software architecture style based on...

Words: 6185 - Pages: 25

Premium Essay

Communication

...decoding process |   | How could the misunderstanding have been avoided? The miss understanding could have been avoided if I would have paid more attention to the end portion of the message. |   | 1. What did you learn about the communication process from this activity? What I learned about the communication process in this exercise is the complexity of the communication process steps. Every step is important to the complete success of the message leaving the sender and arriving to the receiver. In this example the message was distorted by distractions or noise that cause me to miscode the message during the decoding process. 2. What seemed to be the main causes of the misunderstandings? The main causes of the misunderstanding was the fact that I was excited and in a hurry to meet up with my friend that I didn’t pay enough attention to the details of the message and missed understood. Chart Two Who was the sender? Myself |   | Who was the receiver? Coworkers |   | What was the message? Grab large packages off the belt before they jam in curb. |   | What channel was used to send the message? Verbal channel was used. |   | What was the misunderstanding that occurred? Coworker didn’t understand which packages I was referring. |   | How could the misunderstanding have been avoided? The misunderstanding could have been avoided if my coworker paid more attention or had asked for clarification. |   | 1. What did you learn about the communication ...

Words: 380 - Pages: 2

Free Essay

Business Information Systems

...every company. The company I am choosing to write about is the Department of Veteran Affairs for which I work for. Information systems within the Department of Veteran Affairs make the job a lot easier. It simplifies the way we write letters to veterans because we have a program that once you put in the veterans file number it puts in all of his information into the letter such as his address and then it comes up with prompts to choose what to input in the letter. It requires little modification once you choose all the prompts. Information systems also stores most of the veterans information making it quicker to process claims because we don’t have to look into the veteran’s paper file all of the time. They also reduce the amount of mistakes that we make because if you input wrong information most of the time the system won’t process the claim, if it won’t process you know something isn’t matching up and you did something wrong. Our information systems also act as a tracking system. We have a program that can look up a veteran’s file anywhere in the country and can tell who has the file and when they scanned it in. Of course the accuracy of this program still relies on the human input but it is a VA policy that you must scan all the files into your desk as soon as they get to you and you are supposed to scan them to the next location when you send the file away. All the information systems at the VA are designed to store data, make the job easier, standardize processes, and...

Words: 445 - Pages: 2

Free Essay

Linux Chapter 5

...James F Sloan III 4/2/15 IT250 Chapter 5 1. The “who” command helps you determine who is logged in on a specific terminal. 2. Give the command “mesg n” to keep other ordinary users from writing to your terminal. You can take this action when you do not want to be disturbed or are viewing something on your screen that you do not want overwritten. 3. $ cp   to_do done – it will overwrite the   done file with the new file names to_do. $ mv   to_do done-   it will do the same as cp, the to_do file will overwrite the done file.  4. Give the command apropos editor. Most systems have vim, ex, ed, and more. 5. $ grep "Ace Electronics" phone $ sort phone $ uniq phone 6. When you compare binary files with diff, diff displays a message saying the files differ when the files differ or no message when the files are the same. The diff utility compares ASCII files on a line-by-line basis; it is not designed to compare binary files on a byte-by-byte basis. Use cmp to compare binary files in that manner. 7. The answer is system dependent. 8. The utility displays a message saying that the command you are looking for is not in the list of directories that are in your search path. For example, $ which me /usr/bin/which: no me in (/usr/local/bin:/bin:/usr/bin:/usr/X11R6bin:. 9. No. However, some commands that are built into a shell have an executable counterpart that exists as a file (for example, echo). 10. Approximately twenty, not counting...

Words: 283 - Pages: 2

Free Essay

Case Study

...This week I worked on virtual taxes for the first time. I did a few preps and a quality review, it is pretty much the same process but without the pressure of the clients in front of you. It was helpful when there were notes for some situations. For example, the calculations were already done for tuition so it made it easy to just input the numbers. I did run into one where they did not include their birthday or did not answer the healthcare portion, therefore, I was not able to continue with the return. Towards the end of the night I had a client that just recently got married last year and wanted to file separate. The problem I came across was that she did not know her husband’s social security. I was then informed we could not process her return at this time and to come back once she has the information. Amy also explained to me and the client that is always better to file jointly if the couple is married and on good terms and it could really only benefit them more versus filing separately. The highlight of this week of VITA for me was on one of my virtual returns a client wrote a sweet message at the end stating how thankful she was for the program and all of the volunteers. It really shows that what we are doing is so great and just knowing that we are helping people out is so heart...

Words: 253 - Pages: 2

Free Essay

Ummmm Yaaaa

...You can access the Main forum by singing into your student webpage. Once there you click on the Classroom tab and then the Discussion section. From here you will see a forums menu box you will then click on the section titled Main. You can access the Individual forum by singing into your student webpage. Once there you click on the Classroom tab and then the Discussion section. From here you will see a forums menu box you will then see a section titled Individual Forum you will click on your name under that section. To find the Orientation Workshop readings you will sign into your student webpage, click on the classroom then the materials section. All the reading materials you will need underlined in blue text and are clickable all beginning with the word Reading. After you log into your student webpage you will go to the classroom tab and then click on the Assignments section. From there you will click on the week you are doing the assignment for in the Assignments menu under the summary section. You then will see the list of assignments for the week; you will click on the due assignment and then upload it from your folder on your computer by clicking the browse button. It will automatically upload when you select the file from your computer. Class discussions for participation take place in the Discussion section in the Main Forum. For participation you will reply to the DQ threads two times a day for four days. To read replies in the main forum you will click the Discussion...

Words: 446 - Pages: 2

Free Essay

Communication

...Distributed Operating Systems Communication (II) Ewa Niewiadomska-Szynkiewicz ens@ia.pw.edu.pl Institute of Control and Computation Engineering Warsaw University of Technology E&IT Department, WUT DOS / Communication (II) – p. 1 Communication (II) 1. Message-oriented Communication 2. Stream-oriented Communication E&IT Department, WUT DOS / Communication (II) – p. 2 Message-oriented Communication – Introduction √ When it cannot be assumed that the receiving side is executing at the time a request (in RPC or RMI) is issued, alternative communication services are needed. The inherent synchronous nature of RPCs and RMIs, by which a client is blocked until its request has been processed, sometimes has to be replaced. Message-oriented communication is proposed. √ √ The message-passing paradigm is widely used approach for programming parallel machines, especially those with distributed memory. E&IT Department, WUT DOS / Communication (II) – p. 3 Message-passing Paradigm – Attributes Two key attributes characterizing the message-passing paradigm: √ it assumes a partitioned address space, √ it supports only explicit parallelization. The logical view of a machine supporting the message-passing paradigm consists of P processes, each with its own exclusive address space. E&IT Department, WUT DOS / Communication (II) – p. 4 Communication System (1) Assumption – communication system organized as follows: √ applications are executed...

Words: 3031 - Pages: 13

Free Essay

Computer

...Dynamic Computation Migration in Distributed Shared Memory Systems by Wilson Cheng-Yi Hsieh S.B., Massachusetts Institute of Technology (1988) S.M., Massachusetts Institute of Technology (1988) Submitted to the Department of Electrical Engineering and Computer Science in partial fulfillment of the requirements for the degree of Doctor of Philosophy in Computer Science at the MASSACHUSETTS INSTITUTE OF TECHNOLOGY September 1995 c Massachusetts Institute of Technology 1995. All rights reserved. Author : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Department of Electrical Engineering and Computer Science September 5, 1995 Certified by : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : M. Frans Kaashoek Assistant Professor of Computer Science and Engineering Thesis Supervisor Certified by : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : William E. Weihl Associate Professor of Computer Science and Engineering Thesis Supervisor Accepted by : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Frederic R. Morgenthaler Chairman, Departmental Committee on Graduate Students 1 2 Dynamic Computation Migration...

Words: 40765 - Pages: 164

Free Essay

Operating Systems

...Question#1 There is only two other possibilities 1. Process is blocked while it was in ready state. 2. Process running from blocked state. Only transition 2 is possible because when it is possible that process is waiting for input that is yet not available and it is also possible that operating system has decided to allocate CPU time to any other process. The transition 1 is not possible because when a process Is in ready state it cannot block itself while it is not waiting for input and only in ready state. Question#2 In this problem we have five process i.e. Customer, order takers, cook, packaging specialists, cashiers. We have sequential inter process communication between processes which uses pipes for communication between processes. Our chain of communication should be like this Customer Order Takers Cook packaging specialists Cashiers Question#3 In this problem T=Running time for any process S=switch time for a process Q=time Quantum (a) Q = infinite Process has infinite time quantum Q so it will run until it blocks itself CPU efficiency=Q/Q+S In reality it will be CPU efficiency=T/T+S Since it has infinite time quantum and switch time will be very little as compared to quantum Then efficiency will be CPU efficiency=T/T=1 (b) Q > T In this case CPU has also time quantum greater than process completion time then its efficiency will be CPU efficiency=Q/Q+S This will be CPU efficiency=T/T+S (c) S < Q < T Since Q<T ...

Words: 418 - Pages: 2

Premium Essay

Green Supplies Training Process

...dollars, once you consider the number of doors in, say, a 30-story office tower The order processing department is another example. Peter has a very specific and detailed way he wants the order written up, but most of the order clerks do not understand how to use the multipage order form. They simply improvise when it comes to a detailed question such as whether to classify the customer as industrial or commercial. The current training process is as follows. None of the jobs has a training manual, although several have somewhat out-of-date job descriptions. The training for new people is all on the job. Usually, the person leaving the company trains the new person during the 1- or 2-week overlap period, but if there is no overlap, the new person is trained as well as possible by other employees who have filled in occasionally on the job in the past. The training is the same throughout the company for machinists, secretaries, assemblers, engineers, and accounting clerks, for example. Questions: 1/ What do you think of Green Supplies training process? Could you explain why employees “do things their way”, and If so, how? 2/ What role should job descriptions play in training at Green supplies? 3. Explain in detail what you would do to improve the...

Words: 330 - Pages: 2

Free Essay

Random

...This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This is a temporary file to get an account. Really sorry about it. This...

Words: 924 - Pages: 4

Free Essay

Tech Operating System

...Operating Systems Question#1 There is only two other possibilities 1. Process is blocked while it was in ready state. 2. Process running from blocked state. Only transition 2 is possible because when it is possible that process is waiting for input that is yet not available and it is also possible that operating system has decided to allocate CPU time to any other process. The transition 1 is not possible because when a process Is in ready state it cannot block itself while it is not waiting for input and only in ready state. Question#2 In this problem we have five process i.e. Customer, order takers, cook, packaging specialists, cashiers. We have sequential inter process communication between processes which uses pipes for communication between processes. Our chain of communication should be like this Customer Order Takers Cook packaging specialists Cashiers Question#3 In this problem T=Running time for any process S=switch time for a process Q=time Quantum (a) Q = infinite Process has infinite time quantum Q so it will run until it blocks itself CPU efficiency=Q/Q+S In reality it will be CPU efficiency=T/T+S Since it has infinite time quantum and switch time will be very little as compared to quantum Then efficiency will be CPU efficiency=T/T=1 (b) Q > T In this case CPU has also time quantum greater than process completion time then its efficiency will be CPU efficiency=Q/Q+S This will be CPU efficiency=T/T+S (c) S < Q < T Since...

Words: 261 - Pages: 2

Premium Essay

Nt1310 Unit 9 Case Study

...Phase 1 is that, BTC of the node j parent node field. After broadcastingADV1 message, if a node receives any of the ADV1 message from any type of other node, then the all node compare its own ID with the parent node ID stored in the received broadcast the message. If its own ID is equal to that the parent node ID in received ADV1 message, the node declares itself as an internal node, If the node does not receive any type of the ADV1 message where its own ID is equal to the parent node ID stored in that broadcast message, after then the node declare itself as an leaf node. The algorithm to add second parent to each of the node,the tree constructed in phase 1 is given in the procedure BTC phase2 in which performs its all task as follows. At the starting of this phase, sink node broadcasts anADV2 message to all its neighbours,the node executes the following steps 1. If the node receives the ADV2 message from the sink node, then it computes the new cost by adding reciprocal of its left over power to the received cost, and sets its two cost fields to new cost and its stores the sink node ID in its both parent node fields. 2. If both the parent node fields of the receiving node are equal, then it stores that new cost value as computed in step 1 in the second cost field and stores the received node ID in the second parent node field. 3. If both the parent node fields of the receiving node are not equal, then it compares the new cost with that cost are stored in the second cost field,...

Words: 501 - Pages: 3

Free Essay

Control Plans

...Document design – a control plan in which source document is designed to make it easier to prepare the document initially and later to input data from the document. Written/electronic approvals – form of signature or initials on a document to indicate that someone has authorized the event. Preformatted screens – control the entry of data be defining the acceptable format of each data field. Online prompting – requests user input or asks questions that the user must answer. Populate input screens with master data – the clerk enters the identification code for an entity and the system retrieves data about that entity from the master data. Compare input data with master data – we can determine the accuracy and validity of the input data. Procedures for rejected inputs – designed to ensure that erroneous data are corrected and resubmitted for processing. Programmed edit checks – automatically performed by data entry programs upon entry of the input data. Reasonableness checks or limit checks – test whether the contents of the data entered fall within predetermined limits. Document/record hash totals – reflect a summarization of any numeric data field within the input document or record, such as item numbers or quantities on a customer order. Mathematical accuracy checks – compare calculations performed manually to those performed by the computer to determine whether a document has been entered correctly. Check digit verification – involves the inclusion...

Words: 504 - Pages: 3

Premium Essay

Ais Flowchart Write Up

...3/5/15 Salesperson SeeMeNow Inc. is a reseller of reflective running gear. It has six departments: salesperson, sales order entry, warehouse, shipping, billing, and A/R. The process begins with the salesperson making a sale. The inputs into the "create territory sales order process" are the sales person's password, and the inventory and customer master files. The output of this process is a territory sales order, which resides on a temporary holding file. The process then shifts to the to the Sales Order Entry department where they perform 2 processes. The first process is the "check credit" computer process. The inputs are sales order department's password, the territory sales order (transferred from salesperson using a communication link), and customer master file, A/R ledger, and the open sales order. The output of this process is a decision. If the customer fails credit a credit rejection document gets sent to the customer. If the customer passes credit, the sales order entry department performs "check inventory available". The inputs into this process are the sales order entry password, the preliminary territory sales order file, and the inventory transaction file. The outputs of this process are an updated open sales order file and updated back order file (both of which reside on a magnetic disk). The open sales order then gets sent in read only mode to the warehouse. Steps that reflect proper authorization: password is used as authorization for the sales...

Words: 422 - Pages: 2