funnymagic
Tuesday, 10 January 2012
Inter-Process communication( IPC)
Inter-process communication (IPC) is a set of methods for the exchange of data among multiple threads in one or more processes. Processes may be running on one or more computers connected by a network. IPC methods 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.
There are several reasons for providing an environment that allows process cooperation:
- Information sharing
- Speedup
- Modularity
- Convenience
- Privilege separation
IPC may also be referred to as inter-thread communication and inter-application communication.
The combination of IPC with the address space concept is the foundation for address space independence/isolation
• Processes can communicate through shared areas of memory
– the Mutual Exclusion problem and Critical Sections
• Semaphores - a synchronisation abstraction
• Monitors - a higher level abstraction
• Inter-Process Message Passing much more useful for information transfer
– can also be used just for synchronisation
– can co-exist with shared memory communication
• Two basic operations : send(message) and receive(message)
– message contents can be anything mutually comprehensible
» data, remote procedure calls, executable code etc.
– usually contains standard fields
» destination process ID, sending process ID for any reply
» message length
» data type, data etc.
• Fixed-length messages:
– simple to implement - can have pool of standard-sized buffers
» low overheads and efficient for small lengths
copying overheads if fixed length too long
– can be inconvenient for user processes with variable amount of data to pass
» may need a sequence of messages to pass all the data
» long messages may be better passed another way e.g. FTP
copying probably involved, sometimes multiple copying into kernel and out
• Variable-length messages:
– more difficult to implement - may need a heap with garbage collection
» more overheads and less efficient, memory fragmentation
– more convenient for user processes
• Communication links between processes
– not concerned with physical implementation e.g. shared memory, processor bus, network etc.
– rather with issues of its logical implementation
• Issues:
– how are links established?
– can a link be associated with more than two processes?
– how many links can there be between every pair of processes?
– what is the capacity of a link?
» i.e. buffer space and how much
– fixed v. variable length messages
– unidirectional v. bidirectional ?
» can messages flow in one or both directions between two linked processes
» unidirectional if each linked process can either send orreceive but not both and each link has at least one receiver process connected to it
• Naming of links - direct and indirect communications
• Direct:
– each process wanting to communicate must explicitly name the recipient or sender of the communication
– send and receive primitives defined:
send ( P, message ) : send a message to process P
receive ( Q, message ) : receive a message from process Q
– a link established automatically between every pair of processes that want to communicate
» processes only need to know each other’s identity
– link is associated with exactly two processes
– link is usually bidirectional but can be unidirectional
– Process A Process B
while (TRUE) { while (TRUE) {
produce an item receive ( A, item )
send ( B, item ) consume item
} }
while (TRUE) { while (TRUE) {
produce an item receive ( A, item )
send ( B, item ) consume item
} }
– Wide Variety of interprocess communication (IPC) mechanisms – e.g.,
» Pipes & streams
» Sockets & Messages
» Remote Procedure Call
» Shared memory
– OS dependent
– Depends on whether the communicating processes share all or part of an address space

• Communicate information from one process to another via primitives:
send(dest, &message)
receive(source, &message)
• Receiver can specify ANY
• Receiver can choose to block or not
• Applicable to multiprocessor and distributed systems
void Producer() {
while (TRUE) {
/* produce item */
build_message(&m, item);
send(consumer, &m); /* send message */
receive(consumer, &m); /* wait for ack */
}
}
void Consumer {
while(TRUE) {
receive(producer, &m);
/* receive message */
extract_item(&m, &item);
send(producer, &m); /* send ack */
/* consume item */
}
– send ( ) operation
• Synchronous
– Returns after data is sent
– Blocks if buffer is full
• Asynchronous
– Returns as soon as I/O started
– Done?
» Explicit check
» Signal
– Blocks if buffer is full
– receive () operation
• Sync.
– Returns if there is a message
– Blocks if not
• Async.
– Returns if there is a message
– Returns indication if no message
– Indirect Communication – mailboxes
– Messages are sent to a named area – mailbox
– Processes read messages from the mailbox
– Mailbox must be created and managed
– Sender blocks if mailbox is full
– Enables many-to-many communication
– Scrambled messages (checksum)
– Lost messages (acknowledgements)
– Lost acknowledgements (sequence no.)
– Process unreachable (down, terminates)
– Naming
– Authentication
– Performance (copying, message building)
HTML Tages
| HTML Tag Chart | |||||||||||||||
| Tag | Name | Code Example | Browser View | ||||||||||||
| <!-- | comment | <!--This can be viewed in the HTML part of a document--> | Nothing will show | ||||||||||||
| <A - | anchor | <A HREF="http://www.yourdomain.com/">Visit Our Site</A> | Visit Our Site | ||||||||||||
| <B> | bold | <B>Example</B> | Example | ||||||||||||
| <BIG> | big (text) | <BIG>Example</BIG> | Example | ||||||||||||
| <BODY> | body of document | <BODY>The content of your page</BODY> | Contents of your webpage | ||||||||||||
| <BR> | line break | The contents of your page<BR>The contents of your page | The contents of your page The contents of your page | ||||||||||||
| <CENTER> | center | <CENTER>This will center your contents</CENTER> | This will center your contents | ||||||||||||
| <DD> | definition description | <DL> <DT>Definition Term <DD>Definition of the term <DT>Definition Term <DD>Definition of the term </DL> | Definition Term Definition of the term Definition Term Definition of the term | ||||||||||||
| <DL> | definition list | <DL> <DT>Definition Term <DD>Definition of the term <DT>Definition Term <DD>Definition of the term </DL> | Definition Term Definition of the term Definition Term Definition of the term | ||||||||||||
| <DT> | definition term | <DL> <DT>Definition Term <DD>Definition of the term <DT>Definition Term <DD>Definition of the term </DL> | Definition Term Definition of the term Definition Term Definition of the term | ||||||||||||
| <EM> | emphasis | This is an <EM>Example</EM> of using the emphasis tag | This is an Example of using the emphasis tag | ||||||||||||
| <EMBED> | embed object | <EMBED src="yourfile.mid" width="100%" height="60" align="center"> | |||||||||||||
| <EMBED> | embed object | <EMBED src="yourfile.mid" autostart="true" hidden="false" loop="false"> <noembed><bgsound src="yourfile.mid" loop="1"></noembed> | Music will begin playing when your page is loaded and will only play one time. A control panel will be displayed to enable your visitors to stop the music. | ||||||||||||
| <FONT> | font | <FONT FACE="Times New Roman">Example</FONT> | Example (Tip) | ||||||||||||
| <FONT> | font | <FONT FACE="Times New Roman" SIZE="4">Example</FONT> | |||||||||||||
| <FONT> | font | <FONT FACE="Times New Roman" SIZE="+3" COLOR="#FF0000">Example</FONT> | Example | ||||||||||||
| <FORM> | form | <FORM action="mailto:you@yourdomain.com"> Name: <INPUT name="Name" value="" size="10"><BR> Email: <INPUT name="Email" value="" size="10"><BR> <CENTER><INPUT type="submit"></CENTER> </FORM> | Top of Form Name: Email: Bottom of Form | ||||||||||||
| <H1> | heading 1 | <H1>Heading 1 Example</H1> | Heading 1 Example | ||||||||||||
| <H2> | heading 2 | <H2>Heading 2 Example</H2> | Heading 2 Example | ||||||||||||
| <H3> | heading 3 | <H3>Heading 3 Example</H3> | Heading 3 Example | ||||||||||||
| <H4> | heading 4 | <H4>Heading 4 Example</H4> | Heading 4 Example | ||||||||||||
| <H5> | heading 5 | <H5>Heading 5 Example</H5> | Heading 5 Example | ||||||||||||
| <H6> | heading 6 | <H6>Heading 6 Example</H6> | Heading 6 Example | ||||||||||||
| <HEAD> | heading of document | <HEAD>Contains elements describing the document</HEAD> | Nothing will show | ||||||||||||
| <HR> | horizontal rule | <HR> | Contents of your webpage | ||||||||||||
| <HR> | horizontal rule | <HR WIDTH="50%" SIZE="3"> | Contents of your webpage Contents of your webpage | ||||||||||||
| <HR> | horizontal rule | <HR WIDTH="50%" SIZE="3" NOSHADE> | Contents of your webpage Contents of your webpage | ||||||||||||
| <HR> (Internet Explorer) | horizontal rule | Contents of your webpage Contents of your webpage | |||||||||||||
| <HR> (Internet Explorer) | horizontal rule | Contents of your webpage Contents of your webpage | |||||||||||||
| <HTML> | hypertext markup language | <HTML><HEAD><META><TITLE>Title of your webpage</TITLE></HEAD><BODY>Webpage contents</BODY></HTML> | Contents of your webpage | ||||||||||||
| <I> | italic | <I>Example</I> | Example | ||||||||||||
| <IMG> | image | <IMG SRC="Earth.gif" WIDTH="41" HEIGHT="41" BORDER="0" ALT="a sentence about your site"> | | ||||||||||||
| <INPUT> | input field | Example 1: <FORM METHOD=post ACTION="/cgi-bin/example.cgi"> <INPUT type="text" size="10" maxlength="30"> <INPUT type="Submit" VALUE="Submit"> </FORM> | Top of Form Bottom of Form | ||||||||||||
| <INPUT> (Internet Explorer) | input field | Example 2: <FORM METHOD=post ACTION="/cgi-bin/example.cgi"> <INPUT type="text" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;" size="10" maxlength="30"> <INPUT type="Submit" VALUE="Submit"> </FORM> | Top of Form Bottom of Form | ||||||||||||
| <INPUT> | input field | Example 4: <FORM METHOD=post ACTION="/cgi-bin/example.cgi"> Enter Your Comments:<BR> <TEXTAREA wrap="virtual" name="Comments" rows=3 cols=20 MAXLENGTH=100></TEXTAREA><BR> <INPUT type="Submit" VALUE="Submit"> <INPUT type="Reset" VALUE="Clear"> </FORM> | Top of Form Bottom of Form | ||||||||||||
| <INPUT> | input field | Example 5: <FORM METHOD=post ACTION="/cgi-bin/example.cgi"> <CENTER> Select an option: <SELECT> <OPTION >option 1 <OPTION SELECTED>option 2 <OPTION>option 3 <OPTION>option 4 <OPTION>option 5 <OPTION>option 6 </SELECT><BR> <INPUT type="Submit" VALUE="Submit"></CENTER> </FORM> | Top of Form Bottom of Form | ||||||||||||
| <INPUT> | input field | Example 6: <FORM METHOD=post ACTION="/cgi-bin/example.cgi"> Select an option:<BR> <INPUT type="radio" name="option"> Option 1 <INPUT type="radio" name="option" CHECKED> Option 2 <INPUT type="radio" name="option"> Option 3 <BR> <BR> Select an option:<BR> <INPUT type="checkbox" name="selection"> Selection 1 <INPUT type="checkbox" name="selection" CHECKED> Selection 2 <INPUT type="checkbox" name="selection"> Selection 3 <INPUT type="Submit" VALUE="Submit"> </FORM> | Top of Form Example 6: (Tip) Select an option: Option 1 Option 2 Option 3 Select an option: Selection 1 Selection 2 Selection 3 Bottom of Form | ||||||||||||
| <LI> | list item | Example 1: <MENU> <LI type="disc">List item 1 <LI type="circle">List item 2 <LI type="square">List item 3 </MENU> Example 2: <OL type="i"> <LI>List item 1 <LI>List item 2 <LI>List item 3 <LI>List item 4 </OL> |
Example 2:
| ||||||||||||
| <LINK> | link | Visit our <A HREF="http://www.yourdomain.com/">site</A> | Visit our site | ||||||||||||
| <MARQUEE> (Internet Explorer) | scrolling text | ||||||||||||||
| <MENU> | menu | <MENU> <LI type="disc">List item 1 <LI type="circle">List item 2 <LI type="square">List item 3 </MENU> |
| ||||||||||||
| <META> | meta | <META name="Description" content="Description of your site"> <META name="keywords" content="keywords describing your site"> | Nothing will show | ||||||||||||
| <META> | meta | <META HTTP-EQUIV="Refresh" CONTENT="4;URL=http://www.yourdomain.com/"> | Nothing will show | ||||||||||||
| <META> | meta | <META http-equiv="Pragma" content="no-cache"> | |||||||||||||
| <META> | meta | <META name="rating" content="General"> | |||||||||||||
| <META> | meta | <META name="ROBOTS" content="ALL"> | |||||||||||||
| <META> | meta | <META NAME="ROBOTS" content="NOINDEX,FOLLOW"> | |||||||||||||
| <OL> | ordered list | Example 1: <OL> <LI>List item 1 <LI>List item 2 <LI>List item 3 <LI>List item 4 </OL> Example 2: <OL type="a"> <LI>List item 1 <LI>List item 2 <LI>List item 3 <LI>List item 4 </OL> | Example 1:
Example 2:
| ||||||||||||
| <OPTION> | listbox option | <FORM METHOD=post ACTION="/cgi-bin/example.cgi"> <CENTER> Select an option: <SELECT> <OPTION>option 1 <OPTION SELECTED>option 2 <OPTION>option 3 <OPTION>option 4 <OPTION>option 5 <OPTION>option 6 </SELECT><BR> </CENTER> </FORM> | Top of Form Bottom of Form | ||||||||||||
| <P> | paragraph | This is an example displaying the use of the paragraph tag. <P> This will create a line break and a space between lines. Attributes: Example 1:<BR> <BR> <P align="left"> This is an example<BR> displaying the use<BR> of the paragraph tag.<BR> <BR> Example 2:<BR> <BR> <P align="right"> This is an example<BR> displaying the use<BR> of the paragraph tag.<BR> <BR> Example 3:<BR> <BR> <P align="center"> This is an example<BR> displaying the use<BR> of the paragraph tag. | This is an example displaying the use of the paragraph tag. This will create a line break and a space between lines. Attributes: Example 1: This is an example displaying the use of the paragraph tag. Example 2: This is an example displaying the use of the paragraph tag. Example 3: This is an example displaying the use of the paragraph tag. | ||||||||||||
| <SMALL> | small (text) | <SMALL>Example</SMALL> | Example | ||||||||||||
| <STRONG> | strong emphasis | <STRONG>Example</STRONG> | Example | ||||||||||||
| <TABLE> | table | Example 1: <TABLE BORDER="4" CELLPADDING="2" CELLSPACING="2" WIDTH="100%"> <TR> <TD>Column 1</TD> <TD>Column 2</TD> </TR> </TABLE> Example 2: (Internet Explorer) <TABLE BORDER="2" BORDERCOLOR="#336699" CELLPADDING="2" CELLSPACING="2" WIDTH="100%"> <TR> <TD>Column 1</TD> <TD>Column 2</TD> </TR> </TABLE> Example 3: <TABLE CELLPADDING="2" CELLSPACING="2" WIDTH="100%"> <TR> <TD BGCOLOR="#CCCCCC">Column 1</TD> <TD BGCOLOR="#CCCCCC">Column 2</TD> </TR> <TR> <TD>Row 2</TD> <TD>Row 2</TD> </TR> </TABLE> | Example 1:
Example 2:
Example 3:
| ||||||||||||
| <TD> | table data | <TABLE BORDER="2" CELLPADDING="2" CELLSPACING="2" WIDTH="100%"> <TR> <TD>Column 1</TD> <TD>Column 2</TD> </TR> </TABLE> |
| ||||||||||||
| <TH> | table header | <DIV align="center"><TABLE> <TR> <TH>Column 1</TH> <TH>Column 2</TH> <TH>Column 3</TH> </TR> <TR> <TD>Row 2</TD> <TD>Row 2</TD> <TD>Row 2</TD> </TR> <TR> <TD>Row 3</TD> <TD>Row 3</TD> <TD>Row 3</TD> </TR> <TR> <TD>Row 4</TD> <TD>Row 4</TD> <TD>Row 4</TD> </TR> </TABLE> </DIV> |
| ||||||||||||
| <TITLE> | document title | <TITLE>Title of your webpage</TITLE> | Title of your webpage will be viewable in the title bar. | ||||||||||||
| <TR> | table row | <TABLE BORDER="2" CELLPADDING="2" CELLSPACING="2" WIDTH="100%"> <TR> <TD>Column 1</TD> <TD>Column 2</TD> </TR> </TABLE> |
| ||||||||||||
| <TT> | teletype | <TT>Example</TT> | Example | ||||||||||||
| <U> | underline | <U>Example</U> | Example | ||||||||||||
| <UL> | unordered list | Example 1:<BR> <BR> <UL> <LI>List item 1 <LI>List item 2 </UL> <BR> Example 2:<BR> <UL type="disc"> <LI>List item 1 <LI>List item 2 <UL type="circle"> <LI>List item 3 <LI>List item 4 </UL> </UL> | Example 1:
Example 2:
| ||||||||||||
| | |||||||||||||||
Subscribe to:
Comments (Atom)