SlideShare uma empresa Scribd logo
1 de 12
1-Information sharing
2-Computation speedup
3-Modularity
4-Convenience
5-allows exchanged data and informations
Two IPC Models
1. Shared memory- is an OS provided abstraction which allows
a memory region to be simultaneously accessed by multiple
programs with an intent to provide communication among them.
One process will create an area in RAM which other processes
can accessed
2. Message passing - is a form of communication used in
interprocess communication. Communication is made by the
sending of messages to recipients. Each process should be able
to name the other processes. The producer typically uses send()
system call to send messages, and the consumer uses
receive()system call to receive messages
Shared memory
Faster than message passing
After establishing shared memory, treated as routine memory
accesses
Message passing
Useful for exchanging smaller amounts of data
Easy to implement, but more time-consuming task of kernel
intervention
Bounded-Buffer Problem Producer Process
do {
...
produce an item in nextp
...
wait(empty);
wait(mutex);
...
add nextp to buffer
...
signal(mutex);
signal(full);
} while (true);
Bounded-Buffer Problem Consumer Process
do {
wait(full);
wait(mutex);
...
remove an item from buffer to nextc
...
signal(mutex);
signal(empty);
...
consume the item in nextc
...
} while (true);
client-server model, the client sends out requests to the
server, and the server does some processing with the request(s)
received, and returns a reply (or replies)to the client.
Since Socket can be described as end-points for communication.
we could imagine the client and server hosts being connected by
a pipe through which data-flow takes place.
1-sockets use a client-server while Server waits for incoming
client requests by listening to a specified port.
2-After receiving a request, the server accepts a connection
from the client socket to complete the connection
3-then Remote procedure call (RPC) abstracts procedure call
mechanism for use between systems with network connections
4-and pipes acts as a conduit allowing two processes to
communicate
A process is different than a program
- Program is static code and static data
- Process is Dynamic instance of code and data
-Program becomes process when executable file loaded into
memory
No one-to-one mapping between programs and processes
-can have multiple processes of the same program
-one program can invoke multiple process
Execution of program started via GUI mouse clicks and
command line entry of its name
The process state transition
As a process executes, The process is being created, then The
process is waiting to be assigned to a processor therefore,
Instructions are being executed then The process is waiting for
some event to occur,thereafter The process has finished
execution
Parent process creates children processes, which, in turn create
other processes, forming a tree of processes
The new child process is a complete copy of the executing
program
Generally, process identified and managed via a process
identifier (pid)
getpid ()
The new child process has a new process identifier.
fork () returns the child’s PID to the parent, 0 to the child.
When calling exec (), all data in the original program is lost,
and replaced with a running copy of the new program:
Overlaying
UNIX examples
fork () system call creates new process
exec () system call used after a fork() to replace the process’
memory space with a new program
/**
* Programming Languages: Implementation and Design.
*
* A Simple Compiler Adapted from Sebesta (2010) by Josh
Dehlinger further modified by Adam Conover
* (2012-2015)
*
* A simple compiler used for the simple English grammar in
Section 2.2 of Adam Brooks Weber's
* "Modern Programming Languages" book. Parts of this code
was adapted from Robert Sebesta's
* "Concepts of Programming Languages".
*
* This compiler assumes that the source file containing the
sentences to parse is provided as the
* first runtime argument. Within the source file, the compiler
assumes that each sentence to parse
* is provided on its own line.
*
* NOTE: A "real" compiler would more likely treat an entire
file as a single stream of input,
* rather than each line being an independent input stream.
*/
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Compiler {
/**
* It is assumed that the first argument provided is the name
of the source file that is to be
* "compiled".
*/
public static void main(String[] args) throws IOException {
//args = new String[]{"<some hard coded path for
testing>"};
//args = new
String[]{"D:Version_Controlled_SVN_NewtonCOS420J
avaParserSampleinput.txt"};
if (args.length < 1) {
System.out.println("Need a filename!");
} else {
// Java 7 "try-with-resource" to create the file input
buffer.
try (BufferedReader br = new BufferedReader(new
FileReader(args[0]))) {
// Create the new lexer.
LexicalAnalyzer lexer = new LexicalAnalyzer();
// Start lexing and parsing.
processFile(lexer, br);
}
}
}
/**
* Reads each line of the input file and invokes the lexer and
parser for each.
*/
static void processFile(LexicalAnalyzer lexer,
BufferedReader br) throws IOException {
String sourceLine;
// Read each line in the source file to be compiled as a
unique sentence
// to check against the grammar.
while ((sourceLine = br.readLine()) != null) {
// Ignore empty lines and comments.
if (sourceLine.trim().length() <= 0) {
continue;
}
if (sourceLine.trim().startsWith("#")) {
System.out.println("Comment: " +
sourceLine.substring(1).trim());
continue;
}
// Create a new syntax analyzer over the provided lexer.
SyntaxAnalyzer parser = new SyntaxAnalyzer(lexer);
// Parse the given sentence against the given grammar.
We assume that the
// sentence, <S>, production is the start state.
try {
// Start the lexer...
lexer.start(sourceLine);
// Start the parser...
parser.analyze();
// No exceptions, so we must be good!
System.out.printf("The sentence '%s' follows the
BNF grammar.%n", sourceLine);
} catch (ParseException error) {
// If a syntax error was found, print that the sentence
does not follow the grammar.
System.out.printf("SYNTAX ERROR while
processing: '%s'%n", sourceLine);
System.out.printf("ERROR MSG: %s%n",
error.getErrMsg());
}
System.out.println("------------------------------------------
-----------------");
}
}
}
Assume we start with a simple "sentence" grammar as follows:
<S> ::= <NP><V><NP>
<NP> ::= <A> <N>
<V> ::= loves | hates | eats
<A> ::= a | the
<N> ::= dog | cat | rat
Part A:
Show the BNF above with the following additional grammar
elements:
· Adjectives: (0 or more Adjectives separated by commas may
precede any Noun. A comma may or may not be preceded by a
space.)
· furry
· fast
· slow
· delicious
· Adverbs: (0 or 1 Adverb may precede any Verb)
· quickly
· secretly
· Conjunctions: (0 or more may appear in any sentence
· and
· or
· Sentence terminator (The terminator may or may not be
preceded by a space.)
· . (a single period)
· ! (a single period)
·
Part B:
Show/Draw the syntax diagrams for each of the grammar
elements above. Hyperlink reference not valid.
Part C:
Show the parse trees (which can be generated in ANTLRWorks)
for each of the following sentences:
Examples of SYNTACTICALLY VALID Input Strings:
a dog loves the cat.
the cat eats the slow rat and the slow , furry dog secretly hates
the cat and a dog loves the rat !
Examples of SYNTACTICALLY INVALID Input Strings (where
do they fail):
a dog barks at the cat.
the fast furry cat eats quickly
NOTE: You can generate the full parse trees from
ANTLRWorks (as can be done with the attached sample for the
base grammar) or simply draw out the cooresponding AST's
(Abstract Syntax Trees) "by hand" on paper or with a simple
drawing tool. The point of this is to have something that you
can then verify against the parse trees generated by your own
code (in the next part).
Part D:
Modify the (attached) sample code to accept valid sentences
based upon the newly defined grammar above. The parser
should also "reject" invalid sentences with a descriptive error
message. Note that the program should still accept a filename
from the "Command Line" as illustrated in the example. Please
no HARD-CODED file paths in the source.

Mais conteúdo relacionado

Semelhante a 1-Information sharing 2-Computation speedup3-Modularity4-.docx

Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptxHarsha Patel
 
Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2mona_hakmy
 
Operating System 4
Operating System 4Operating System 4
Operating System 4tech2click
 
Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008guestd9065
 
Networked APIs with swift
Networked APIs with swiftNetworked APIs with swift
Networked APIs with swiftTim Burks
 
Unix Shell and System Boot Process
Unix Shell and System Boot ProcessUnix Shell and System Boot Process
Unix Shell and System Boot ProcessArvind Krishnaa
 
Concisely describe the following terms 40 1. Source code 2. Object c.pdf
Concisely describe the following terms 40 1. Source code 2. Object c.pdfConcisely describe the following terms 40 1. Source code 2. Object c.pdf
Concisely describe the following terms 40 1. Source code 2. Object c.pdffeelinggift
 
02 fundamentals
02 fundamentals02 fundamentals
02 fundamentalssirmanohar
 
File Input and output.pptx
File Input  and output.pptxFile Input  and output.pptx
File Input and output.pptxcherryreddygannu
 
Introto netthreads-090906214344-phpapp01
Introto netthreads-090906214344-phpapp01Introto netthreads-090906214344-phpapp01
Introto netthreads-090906214344-phpapp01Aravindharamanan S
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdfAkarTaher
 
CocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsCocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsTim Burks
 
CSC 451551 Computer Networks Fall 2016Project 4 Softwar.docx
CSC 451551 Computer Networks Fall 2016Project 4 Softwar.docxCSC 451551 Computer Networks Fall 2016Project 4 Softwar.docx
CSC 451551 Computer Networks Fall 2016Project 4 Softwar.docxannettsparrow
 

Semelhante a 1-Information sharing 2-Computation speedup3-Modularity4-.docx (20)

Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptx
 
Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2
 
Operating System 4
Operating System 4Operating System 4
Operating System 4
 
Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008
 
Ipc in linux
Ipc in linuxIpc in linux
Ipc in linux
 
Ipc in linux
Ipc in linuxIpc in linux
Ipc in linux
 
Computer Science Assignment Help
Computer Science Assignment HelpComputer Science Assignment Help
Computer Science Assignment Help
 
Networked APIs with swift
Networked APIs with swiftNetworked APIs with swift
Networked APIs with swift
 
Unix Shell and System Boot Process
Unix Shell and System Boot ProcessUnix Shell and System Boot Process
Unix Shell and System Boot Process
 
Linux
LinuxLinux
Linux
 
Concisely describe the following terms 40 1. Source code 2. Object c.pdf
Concisely describe the following terms 40 1. Source code 2. Object c.pdfConcisely describe the following terms 40 1. Source code 2. Object c.pdf
Concisely describe the following terms 40 1. Source code 2. Object c.pdf
 
Linux basics
Linux basicsLinux basics
Linux basics
 
02 fundamentals
02 fundamentals02 fundamentals
02 fundamentals
 
Report_Ines_Swayam
Report_Ines_SwayamReport_Ines_Swayam
Report_Ines_Swayam
 
File Input and output.pptx
File Input  and output.pptxFile Input  and output.pptx
File Input and output.pptx
 
Introto netthreads-090906214344-phpapp01
Introto netthreads-090906214344-phpapp01Introto netthreads-090906214344-phpapp01
Introto netthreads-090906214344-phpapp01
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdf
 
CocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsCocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIs
 
CSC 451551 Computer Networks Fall 2016Project 4 Softwar.docx
CSC 451551 Computer Networks Fall 2016Project 4 Softwar.docxCSC 451551 Computer Networks Fall 2016Project 4 Softwar.docx
CSC 451551 Computer Networks Fall 2016Project 4 Softwar.docx
 
MultiThreading in Python
MultiThreading in PythonMultiThreading in Python
MultiThreading in Python
 

Mais de SONU61709

Please respond to the followingAnalyze ONE of the Neo-Piageti.docx
Please respond to the followingAnalyze ONE of the Neo-Piageti.docxPlease respond to the followingAnalyze ONE of the Neo-Piageti.docx
Please respond to the followingAnalyze ONE of the Neo-Piageti.docxSONU61709
 
Please respond to the followingBased on the discussion prepar.docx
Please respond to the followingBased on the discussion prepar.docxPlease respond to the followingBased on the discussion prepar.docx
Please respond to the followingBased on the discussion prepar.docxSONU61709
 
Please respond to the following in an approx. 5-6 page paper, double.docx
Please respond to the following in an approx. 5-6 page paper, double.docxPlease respond to the following in an approx. 5-6 page paper, double.docx
Please respond to the following in an approx. 5-6 page paper, double.docxSONU61709
 
Please respond to the followingImagine you have recently .docx
Please respond to the followingImagine you have recently .docxPlease respond to the followingImagine you have recently .docx
Please respond to the followingImagine you have recently .docxSONU61709
 
Please respond to one (1) the followingRead the article e.docx
Please respond to one (1) the followingRead the article e.docxPlease respond to one (1) the followingRead the article e.docx
Please respond to one (1) the followingRead the article e.docxSONU61709
 
Please respond to the followingResearch on the Internet a rec.docx
Please respond to the followingResearch on the Internet a rec.docxPlease respond to the followingResearch on the Internet a rec.docx
Please respond to the followingResearch on the Internet a rec.docxSONU61709
 
Please respond to Question One (bolded) and one additional ess.docx
Please respond to Question One (bolded) and one additional ess.docxPlease respond to Question One (bolded) and one additional ess.docx
Please respond to Question One (bolded) and one additional ess.docxSONU61709
 
Please respond to the following in a substantive post (3–4 paragraph.docx
Please respond to the following in a substantive post (3–4 paragraph.docxPlease respond to the following in a substantive post (3–4 paragraph.docx
Please respond to the following in a substantive post (3–4 paragraph.docxSONU61709
 
Please respond to the followingDebate if failing to reje.docx
Please respond to the followingDebate if failing to reje.docxPlease respond to the followingDebate if failing to reje.docx
Please respond to the followingDebate if failing to reje.docxSONU61709
 
Please respond to the followingCharts and graphs are used.docx
Please respond to the followingCharts and graphs are used.docxPlease respond to the followingCharts and graphs are used.docx
Please respond to the followingCharts and graphs are used.docxSONU61709
 
Please respond to the followingAppraise the different approac.docx
Please respond to the followingAppraise the different approac.docxPlease respond to the followingAppraise the different approac.docx
Please respond to the followingAppraise the different approac.docxSONU61709
 
Please respond to the following discussion with a well thought out r.docx
Please respond to the following discussion with a well thought out r.docxPlease respond to the following discussion with a well thought out r.docx
Please respond to the following discussion with a well thought out r.docxSONU61709
 
Please respond to each classmate if there is a need for it and als.docx
Please respond to each classmate if there is a need for it and als.docxPlease respond to each classmate if there is a need for it and als.docx
Please respond to each classmate if there is a need for it and als.docxSONU61709
 
please respond to both discussion in your own words in citation plea.docx
please respond to both discussion in your own words in citation plea.docxplease respond to both discussion in your own words in citation plea.docx
please respond to both discussion in your own words in citation plea.docxSONU61709
 
please respond In your own words not citations1. The Miami blu.docx
please respond In your own words not citations1. The Miami blu.docxplease respond In your own words not citations1. The Miami blu.docx
please respond In your own words not citations1. The Miami blu.docxSONU61709
 
Please respond in 300 words the followingWe see SWOT present.docx
Please respond in 300 words the followingWe see SWOT present.docxPlease respond in 300 words the followingWe see SWOT present.docx
Please respond in 300 words the followingWe see SWOT present.docxSONU61709
 
Please respond to the followingReflect on the usefulness .docx
Please respond to the followingReflect on the usefulness .docxPlease respond to the followingReflect on the usefulness .docx
Please respond to the followingReflect on the usefulness .docxSONU61709
 
Please respond to the followingLeadership talent is an or.docx
Please respond to the followingLeadership talent is an or.docxPlease respond to the followingLeadership talent is an or.docx
Please respond to the followingLeadership talent is an or.docxSONU61709
 
Please respond to the followingHealth care faces critic.docx
Please respond to the followingHealth care faces critic.docxPlease respond to the followingHealth care faces critic.docx
Please respond to the followingHealth care faces critic.docxSONU61709
 
Please respond to the followingMNCs, IOs, NGOs, and the E.docx
Please respond to the followingMNCs, IOs, NGOs, and the E.docxPlease respond to the followingMNCs, IOs, NGOs, and the E.docx
Please respond to the followingMNCs, IOs, NGOs, and the E.docxSONU61709
 

Mais de SONU61709 (20)

Please respond to the followingAnalyze ONE of the Neo-Piageti.docx
Please respond to the followingAnalyze ONE of the Neo-Piageti.docxPlease respond to the followingAnalyze ONE of the Neo-Piageti.docx
Please respond to the followingAnalyze ONE of the Neo-Piageti.docx
 
Please respond to the followingBased on the discussion prepar.docx
Please respond to the followingBased on the discussion prepar.docxPlease respond to the followingBased on the discussion prepar.docx
Please respond to the followingBased on the discussion prepar.docx
 
Please respond to the following in an approx. 5-6 page paper, double.docx
Please respond to the following in an approx. 5-6 page paper, double.docxPlease respond to the following in an approx. 5-6 page paper, double.docx
Please respond to the following in an approx. 5-6 page paper, double.docx
 
Please respond to the followingImagine you have recently .docx
Please respond to the followingImagine you have recently .docxPlease respond to the followingImagine you have recently .docx
Please respond to the followingImagine you have recently .docx
 
Please respond to one (1) the followingRead the article e.docx
Please respond to one (1) the followingRead the article e.docxPlease respond to one (1) the followingRead the article e.docx
Please respond to one (1) the followingRead the article e.docx
 
Please respond to the followingResearch on the Internet a rec.docx
Please respond to the followingResearch on the Internet a rec.docxPlease respond to the followingResearch on the Internet a rec.docx
Please respond to the followingResearch on the Internet a rec.docx
 
Please respond to Question One (bolded) and one additional ess.docx
Please respond to Question One (bolded) and one additional ess.docxPlease respond to Question One (bolded) and one additional ess.docx
Please respond to Question One (bolded) and one additional ess.docx
 
Please respond to the following in a substantive post (3–4 paragraph.docx
Please respond to the following in a substantive post (3–4 paragraph.docxPlease respond to the following in a substantive post (3–4 paragraph.docx
Please respond to the following in a substantive post (3–4 paragraph.docx
 
Please respond to the followingDebate if failing to reje.docx
Please respond to the followingDebate if failing to reje.docxPlease respond to the followingDebate if failing to reje.docx
Please respond to the followingDebate if failing to reje.docx
 
Please respond to the followingCharts and graphs are used.docx
Please respond to the followingCharts and graphs are used.docxPlease respond to the followingCharts and graphs are used.docx
Please respond to the followingCharts and graphs are used.docx
 
Please respond to the followingAppraise the different approac.docx
Please respond to the followingAppraise the different approac.docxPlease respond to the followingAppraise the different approac.docx
Please respond to the followingAppraise the different approac.docx
 
Please respond to the following discussion with a well thought out r.docx
Please respond to the following discussion with a well thought out r.docxPlease respond to the following discussion with a well thought out r.docx
Please respond to the following discussion with a well thought out r.docx
 
Please respond to each classmate if there is a need for it and als.docx
Please respond to each classmate if there is a need for it and als.docxPlease respond to each classmate if there is a need for it and als.docx
Please respond to each classmate if there is a need for it and als.docx
 
please respond to both discussion in your own words in citation plea.docx
please respond to both discussion in your own words in citation plea.docxplease respond to both discussion in your own words in citation plea.docx
please respond to both discussion in your own words in citation plea.docx
 
please respond In your own words not citations1. The Miami blu.docx
please respond In your own words not citations1. The Miami blu.docxplease respond In your own words not citations1. The Miami blu.docx
please respond In your own words not citations1. The Miami blu.docx
 
Please respond in 300 words the followingWe see SWOT present.docx
Please respond in 300 words the followingWe see SWOT present.docxPlease respond in 300 words the followingWe see SWOT present.docx
Please respond in 300 words the followingWe see SWOT present.docx
 
Please respond to the followingReflect on the usefulness .docx
Please respond to the followingReflect on the usefulness .docxPlease respond to the followingReflect on the usefulness .docx
Please respond to the followingReflect on the usefulness .docx
 
Please respond to the followingLeadership talent is an or.docx
Please respond to the followingLeadership talent is an or.docxPlease respond to the followingLeadership talent is an or.docx
Please respond to the followingLeadership talent is an or.docx
 
Please respond to the followingHealth care faces critic.docx
Please respond to the followingHealth care faces critic.docxPlease respond to the followingHealth care faces critic.docx
Please respond to the followingHealth care faces critic.docx
 
Please respond to the followingMNCs, IOs, NGOs, and the E.docx
Please respond to the followingMNCs, IOs, NGOs, and the E.docxPlease respond to the followingMNCs, IOs, NGOs, and the E.docx
Please respond to the followingMNCs, IOs, NGOs, and the E.docx
 

Último

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 

Último (20)

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 

1-Information sharing 2-Computation speedup3-Modularity4-.docx

  • 1. 1-Information sharing 2-Computation speedup 3-Modularity 4-Convenience 5-allows exchanged data and informations Two IPC Models 1. Shared memory- is an OS provided abstraction which allows a memory region to be simultaneously accessed by multiple programs with an intent to provide communication among them. One process will create an area in RAM which other processes can accessed 2. Message passing - is a form of communication used in interprocess communication. Communication is made by the sending of messages to recipients. Each process should be able to name the other processes. The producer typically uses send() system call to send messages, and the consumer uses receive()system call to receive messages Shared memory Faster than message passing After establishing shared memory, treated as routine memory accesses Message passing Useful for exchanging smaller amounts of data
  • 2. Easy to implement, but more time-consuming task of kernel intervention Bounded-Buffer Problem Producer Process do { ... produce an item in nextp ... wait(empty); wait(mutex); ... add nextp to buffer ... signal(mutex); signal(full); } while (true); Bounded-Buffer Problem Consumer Process do { wait(full); wait(mutex); ... remove an item from buffer to nextc ... signal(mutex); signal(empty); ... consume the item in nextc ... } while (true);
  • 3. client-server model, the client sends out requests to the server, and the server does some processing with the request(s) received, and returns a reply (or replies)to the client. Since Socket can be described as end-points for communication. we could imagine the client and server hosts being connected by a pipe through which data-flow takes place. 1-sockets use a client-server while Server waits for incoming client requests by listening to a specified port. 2-After receiving a request, the server accepts a connection from the client socket to complete the connection 3-then Remote procedure call (RPC) abstracts procedure call mechanism for use between systems with network connections 4-and pipes acts as a conduit allowing two processes to communicate A process is different than a program - Program is static code and static data - Process is Dynamic instance of code and data -Program becomes process when executable file loaded into memory No one-to-one mapping between programs and processes -can have multiple processes of the same program -one program can invoke multiple process Execution of program started via GUI mouse clicks and command line entry of its name The process state transition
  • 4. As a process executes, The process is being created, then The process is waiting to be assigned to a processor therefore, Instructions are being executed then The process is waiting for some event to occur,thereafter The process has finished execution Parent process creates children processes, which, in turn create other processes, forming a tree of processes The new child process is a complete copy of the executing program Generally, process identified and managed via a process identifier (pid) getpid () The new child process has a new process identifier. fork () returns the child’s PID to the parent, 0 to the child. When calling exec (), all data in the original program is lost, and replaced with a running copy of the new program: Overlaying UNIX examples fork () system call creates new process exec () system call used after a fork() to replace the process’ memory space with a new program
  • 5. /** * Programming Languages: Implementation and Design. * * A Simple Compiler Adapted from Sebesta (2010) by Josh Dehlinger further modified by Adam Conover * (2012-2015) * * A simple compiler used for the simple English grammar in Section 2.2 of Adam Brooks Weber's * "Modern Programming Languages" book. Parts of this code was adapted from Robert Sebesta's * "Concepts of Programming Languages". * * This compiler assumes that the source file containing the sentences to parse is provided as the * first runtime argument. Within the source file, the compiler assumes that each sentence to parse * is provided on its own line.
  • 6. * * NOTE: A "real" compiler would more likely treat an entire file as a single stream of input, * rather than each line being an independent input stream. */ import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Compiler { /** * It is assumed that the first argument provided is the name of the source file that is to be * "compiled". */ public static void main(String[] args) throws IOException { //args = new String[]{"<some hard coded path for testing>"}; //args = new
  • 7. String[]{"D:Version_Controlled_SVN_NewtonCOS420J avaParserSampleinput.txt"}; if (args.length < 1) { System.out.println("Need a filename!"); } else { // Java 7 "try-with-resource" to create the file input buffer. try (BufferedReader br = new BufferedReader(new FileReader(args[0]))) { // Create the new lexer. LexicalAnalyzer lexer = new LexicalAnalyzer(); // Start lexing and parsing. processFile(lexer, br); } } } /**
  • 8. * Reads each line of the input file and invokes the lexer and parser for each. */ static void processFile(LexicalAnalyzer lexer, BufferedReader br) throws IOException { String sourceLine; // Read each line in the source file to be compiled as a unique sentence // to check against the grammar. while ((sourceLine = br.readLine()) != null) { // Ignore empty lines and comments. if (sourceLine.trim().length() <= 0) { continue; } if (sourceLine.trim().startsWith("#")) { System.out.println("Comment: " + sourceLine.substring(1).trim()); continue; }
  • 9. // Create a new syntax analyzer over the provided lexer. SyntaxAnalyzer parser = new SyntaxAnalyzer(lexer); // Parse the given sentence against the given grammar. We assume that the // sentence, <S>, production is the start state. try { // Start the lexer... lexer.start(sourceLine); // Start the parser... parser.analyze(); // No exceptions, so we must be good! System.out.printf("The sentence '%s' follows the BNF grammar.%n", sourceLine); } catch (ParseException error) { // If a syntax error was found, print that the sentence
  • 10. does not follow the grammar. System.out.printf("SYNTAX ERROR while processing: '%s'%n", sourceLine); System.out.printf("ERROR MSG: %s%n", error.getErrMsg()); } System.out.println("------------------------------------------ -----------------"); } } } Assume we start with a simple "sentence" grammar as follows: <S> ::= <NP><V><NP> <NP> ::= <A> <N> <V> ::= loves | hates | eats <A> ::= a | the <N> ::= dog | cat | rat Part A: Show the BNF above with the following additional grammar elements: · Adjectives: (0 or more Adjectives separated by commas may precede any Noun. A comma may or may not be preceded by a space.)
  • 11. · furry · fast · slow · delicious · Adverbs: (0 or 1 Adverb may precede any Verb) · quickly · secretly · Conjunctions: (0 or more may appear in any sentence · and · or · Sentence terminator (The terminator may or may not be preceded by a space.) · . (a single period) · ! (a single period) · Part B: Show/Draw the syntax diagrams for each of the grammar elements above. Hyperlink reference not valid. Part C: Show the parse trees (which can be generated in ANTLRWorks) for each of the following sentences: Examples of SYNTACTICALLY VALID Input Strings: a dog loves the cat. the cat eats the slow rat and the slow , furry dog secretly hates the cat and a dog loves the rat ! Examples of SYNTACTICALLY INVALID Input Strings (where do they fail): a dog barks at the cat. the fast furry cat eats quickly NOTE: You can generate the full parse trees from ANTLRWorks (as can be done with the attached sample for the base grammar) or simply draw out the cooresponding AST's (Abstract Syntax Trees) "by hand" on paper or with a simple drawing tool. The point of this is to have something that you can then verify against the parse trees generated by your own
  • 12. code (in the next part). Part D: Modify the (attached) sample code to accept valid sentences based upon the newly defined grammar above. The parser should also "reject" invalid sentences with a descriptive error message. Note that the program should still accept a filename from the "Command Line" as illustrated in the example. Please no HARD-CODED file paths in the source.