14 relationship between processes


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

14 relationship between processes

  1. 1. Understand Process Management • Relationship Between Processes 1
  2. 2. RecapIn the last class, you have learnt• Process Creation• Process Termination HOME PREVIOUS TOPIC NEXT PREVIOUS QUESTION PAPERS FOR OS CPP TUTORIALS 9CM402.14 2
  3. 3. ObjectivesOn 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
  4. 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. 5. Relationship Between ProcessesReasons for Process cooperation• Information sharing• Computation speedup• Modularity• Convenience 9CM402.14 5
  6. 6. Relationship Between ProcessesInformation 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 resourcesComputation 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. 7. Relationship Between ProcessesModularity:• For cooperating between systems we have to construct the system in a modular fashion• Dividing the system function into separate processes or threadsConvenience:• 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. 8. 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
  9. 9. 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
  10. 10. 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
  11. 11. Example• The producer process involves the insert( ) method when It wishes to enter an item in the buffer insert( ) methodPublic 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. 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. 13. SummaryIn this class, you have learnt• Relationship between the processes• Reasons for Process cooperation• Cooperating Processes 9CM402.14 13
  14. 14. Frequently Asked Questions1. Explain about cooperating process2. What are the several reasons for cooperating processes3. Explain about the relationship between processes 9CM402.14 14
  15. 15. Quiz1. A process is ____________ if it cannot affect or be affected by the other processes executing in the systema) Independentb) Dependentc) Cooperating 9CM402.14 15
  16. 16. Quiz2. A process is ________ if it can affect or be affected by other processes executing in the system.a) Cooperatingb) Independentc) Dependent 9CM402.14 16
  17. 17. Quiz3. A process that does not share any data with any other process isa)Independent Processb) Cooperatingc) Dependent 9CM402.14 17
  18. 18. Other subject materials• Web designing• Micro processors• C++ tutorials• javahome