Understand Process Management
       • Relationship Between Processes




                                          1
Recap

In the last class, you have learnt
• Process Creation

• Process Termination


     HOME     PREVIOUS TOPIC
     NEXT
     PREVIOUS QUESTION PAPERS
     FOR OS
     CPP TUTORIALS
                     9CM402.14       2
Objectives


On completion of this class, you will be able to
  know

• Relationship between Processes

• Reasons for providing an environment that allows
  Process cooperation



                        9CM402.14                    3
Relationship Between Processes
• Concurrent processes executing in the operating system may be


 either “Independent processes” or “Cooperating processes”
• A process is independent if it cannot affect or be affected by the
 other processes executing in the system
• A process that does not share any data with any other process is
 independent Process
• A Process is a cooperating, if it can affect or be affected by the
 other processes executing in the system
• Any process that shares data with other processes is a
                            9CM402.14                           4
 cooperating process
Relationship Between Processes

Reasons for Process cooperation

• Information sharing

• Computation speedup

• Modularity

• Convenience



                        9CM402.14         5
Relationship Between Processes
Information Sharing
• Several users may be interested in same piece of information,
  Ex. Shared file
• Must provide an environment to allow concurrent access to
  these types of resources
Computation Speedup
• To run a particular task faster, we must break it into subtasks
• Each of the subtask will execute in parallel with others
• This is possible only if computer has multiple processing
  elements ( CPU or I/O channels)
                             9CM402.14                         6
Relationship Between Processes

Modularity:
• For cooperating between systems we have to construct the
  system in a modular fashion
• Dividing the system function into separate processes or
  threads
Convenience:
• Even an individual user may work on many tasks at the same
  time
• For instance, a user may be editing, printing and compiling in
  parallel


                             9CM402.14                         7
Cooperating Processors

• Concurrent execution that requires cooperation among the
  processes requires mechanisms to allow processes
  communicate with one another
• To illustrate the concept of cooperating processes look at the
   – Example: Producers-consumers problem
• A producer process produces information that is consumed by
  a consumer process
   – Example :
       • A print program produces character that are consumed
         by the printer driver9CM402.14                        8
Cooperating Processes
• To concurrently run producers and consumers processes we
  must have a buffer of items that can be filled by the producer
  and emptied by the consumer
• A producer can produces one item while the consumer is
  consuming another item
• The producer and consumer must be synchronized, so that
   – the consumer does not try to consume an item that has not yet been
     produced

• The consumer must wait until an item is produced
                                9CM402.14                                 9
Example
• Solutions to producer-consumer problem may implement the
  buffer interface shown follows
   Interface for buffer implementation
  Public interface Buffer
  {
   // producers call this method
  public abstract void insert (object item);
   // consumers call this method
   public abstract object remove( );
  }
                               9CM402.14                     10
Example
• The producer process involves the insert( ) method when It
  wishes to enter an item in the buffer
 insert( ) method
Public void insert (object item){
 While (count= = BUFFER SIZE)
     ; // do nothing - - no free buffers
       + + count;
       buffer [in]=item;
       in=(in+1) % BUFFER -SIZE;
 }
                                9CM402.14                      11
Example
•   The consumer calls the remove( ) method when it wants to consume an item
    from the buffer
    remove method
    Public object remove ( ) {
    Object item;
    While (count= = 0)
        ; // do nothing - - nothing to consume
        // remove an item from the buffer
        --count;
        item=buffer [out];
        out=(out+1) % BUFFER _ SIZE;

         return item; }              9CM402.14                           12
Summary

In this class, you have learnt
• Relationship between the processes

• Reasons for Process cooperation
• Cooperating Processes




                             9CM402.14   13
Frequently Asked Questions

1.   Explain about cooperating process

2.   What are the several reasons for cooperating processes

3.   Explain about the relationship between processes




                           9CM402.14                          14
Quiz

1.   A process is ____________ if it cannot affect or be
     affected by the other processes executing in the system
a)   Independent
b)   Dependent
c)   Cooperating




                           9CM402.14                           15
Quiz


2.   A process is ________ if it can affect or be affected by
     other processes executing in the system.
a)   Cooperating
b)   Independent
c)   Dependent




                            9CM402.14                           16
Quiz


3. A process that does not share any data with any
  other process is
a)Independent Process
b) Cooperating
c) Dependent




                    9CM402.14                   17
Other subject materials
•   Web designing
•   Micro processors
•   C++ tutorials
•   java

home

14 relationship between processes

  • 1.
    Understand Process Management • Relationship Between Processes 1
  • 2.
    Recap In the lastclass, you have learnt • Process Creation • Process Termination HOME PREVIOUS TOPIC NEXT PREVIOUS QUESTION PAPERS FOR OS CPP TUTORIALS 9CM402.14 2
  • 3.
    Objectives On completion ofthis class, you will be able to know • Relationship between Processes • Reasons for providing an environment that allows Process cooperation 9CM402.14 3
  • 4.
    Relationship Between Processes •Concurrent processes executing in the operating system may be either “Independent processes” or “Cooperating processes” • A process is independent if it cannot affect or be affected by the other processes executing in the system • A process that does not share any data with any other process is independent Process • A Process is a cooperating, if it can affect or be affected by the other processes executing in the system • Any process that shares data with other processes is a 9CM402.14 4 cooperating process
  • 5.
    Relationship Between Processes Reasonsfor Process cooperation • Information sharing • Computation speedup • Modularity • Convenience 9CM402.14 5
  • 6.
    Relationship Between Processes InformationSharing • Several users may be interested in same piece of information, Ex. Shared file • Must provide an environment to allow concurrent access to these types of resources Computation Speedup • To run a particular task faster, we must break it into subtasks • Each of the subtask will execute in parallel with others • This is possible only if computer has multiple processing elements ( CPU or I/O channels) 9CM402.14 6
  • 7.
    Relationship Between Processes Modularity: •For cooperating between systems we have to construct the system in a modular fashion • Dividing the system function into separate processes or threads Convenience: • Even an individual user may work on many tasks at the same time • For instance, a user may be editing, printing and compiling in parallel 9CM402.14 7
  • 8.
    Cooperating Processors • Concurrentexecution that requires cooperation among the processes requires mechanisms to allow processes communicate with one another • To illustrate the concept of cooperating processes look at the – Example: Producers-consumers problem • A producer process produces information that is consumed by a consumer process – Example : • A print program produces character that are consumed by the printer driver9CM402.14 8
  • 9.
    Cooperating Processes • Toconcurrently run producers and consumers processes we must have a buffer of items that can be filled by the producer and emptied by the consumer • A producer can produces one item while the consumer is consuming another item • The producer and consumer must be synchronized, so that – the consumer does not try to consume an item that has not yet been produced • The consumer must wait until an item is produced 9CM402.14 9
  • 10.
    Example • Solutions toproducer-consumer problem may implement the buffer interface shown follows Interface for buffer implementation Public interface Buffer { // producers call this method public abstract void insert (object item); // consumers call this method public abstract object remove( ); } 9CM402.14 10
  • 11.
    Example • The producerprocess involves the insert( ) method when It wishes to enter an item in the buffer insert( ) method Public void insert (object item){ While (count= = BUFFER SIZE) ; // do nothing - - no free buffers + + count; buffer [in]=item; in=(in+1) % BUFFER -SIZE; } 9CM402.14 11
  • 12.
    Example • The consumer calls the remove( ) method when it wants to consume an item from the buffer remove method Public object remove ( ) { Object item; While (count= = 0) ; // do nothing - - nothing to consume // remove an item from the buffer --count; item=buffer [out]; out=(out+1) % BUFFER _ SIZE; return item; } 9CM402.14 12
  • 13.
    Summary In this class,you have learnt • Relationship between the processes • Reasons for Process cooperation • Cooperating Processes 9CM402.14 13
  • 14.
    Frequently Asked Questions 1. Explain about cooperating process 2. What are the several reasons for cooperating processes 3. Explain about the relationship between processes 9CM402.14 14
  • 15.
    Quiz 1. A process is ____________ if it cannot affect or be affected by the other processes executing in the system a) Independent b) Dependent c) Cooperating 9CM402.14 15
  • 16.
    Quiz 2. A process is ________ if it can affect or be affected by other processes executing in the system. a) Cooperating b) Independent c) Dependent 9CM402.14 16
  • 17.
    Quiz 3. A processthat does not share any data with any other process is a)Independent Process b) Cooperating c) Dependent 9CM402.14 17
  • 18.
    Other subject materials • Web designing • Micro processors • C++ tutorials • java home