INTERPROCESS COMMUNICATION TYPES DIRECT COMMUNICATION o SEND AND RECEIVE

Interprocess communication types direct communication

This preview shows page 21 - 29 out of 79 pages.

INTERPROCESS COMMUNICATION TYPES: + DIRECT COMMUNICATION o SEND AND RECEIVE PRIMITIVES ALWAYS SPECIFY PROCESS AS DESTINATION OR SOURCE send(P, message) <-SYMMETRIC send(P, message) receive(Q, message) receive(Q, message) + INDIRECT COMMUNICATION o SEND AND RECEIVE PRIMITIVES ALWAYS SPECIFY INTERMEDIARY ENTITY (THE MAILBOX OR PORT) o THE MAILBOX IS A SYSTEM OBJECT CREATE BY THE KERNEL o MAILBOX CAN BE: PRIVATE OR PUBLIC send(A, message) receive(A, message) INTERPROCESS COMMUNICATION
Image of page 21
TYPES: + BLOCKING (SYNCHRONOUS) o A BLOCKING SEND DOES NOT RETURN UNTIL THE MESSAGE HAS BEEN RECEIVED BY THE RECEIVING PROCESS o A BLOCKING RECEIVE DOES NOT RETURN UNTIL A MESSAGE HAS BEEN RECEIVED + NON-BLOCKING (ASYNCHRONOUS) o A NON-BLOCKING SEND RETURN AS SOON AS THE MESSAGE HAS BEEN ACCEPTED FOR DELIVERY BY THE OPERATING SYSTEM o A NON-BLOCKING RECEIVE RETURN AS SOON AS IT HAS EITHER RETRIEVED A MESSAGE OR LEARNED THAT THE MAILBOX IS EMPTY INTERPROCESS COMMUNICATION - BUFFERS + ZERO CAPACITY => RENDEZVOUS + BOUNDED CAPACITY + THEORETICALLY UNLIMITED CAPACITY REMOTE PROCEDURE CALLS
Image of page 22
USER PROGRAM USER STUB: PACKS ARGUMENT UNPACK REPLY PERFORMS REQUIRED DATA CONVERSION SEND A REQUEST AND WAIT COMMUNICATION PACKAGE SERVER STUB UNPACKS REQUEST PACK RESULTS PERFORMS REQUIRED DATA CONVERSION WAIT FOR INCOMING REQUESTS AND SENDS THE REPLY SERVER PROCEDURE EXCEPTIONS PROCESS TERMINATES LOST MESSAGES SCRAMBLED MESSAGES INTERPROCESS SYNCHRONIZATION PROBLEM : WHENEVER TWO OR MORE PROCESSES SHARE COMMON DATA (WHICH CAN BE STORED IN A
Image of page 23
FILE, OR SHARED MEMORY SEGMENT), UNPREDICTABLE RESULTS ARE LIKELY TO HAPPEN IF TWO OF THE PROCESS ATTEMPT TO ACCESS THE SARED DATA AT THE SAME TIME INTERPROCESS SYNCHRONIZATION CRITICAL SECTION EACH PROCESS HAS A SEGMENT CODE , CALLED A CRITICIAL SECTION, TO SHARE DATA WITH OTHER PROCESSES. WHEN ONE PROCESS IS EXECUTING IN ITS CRITICAL SECTION, NO OTHER PROCESS IS TO BE ALLOWED TO EXECUTE IN ITS CRITICAL SECTION SOLUTIONS
Image of page 24
DISABLE INTERRUPTS MUTUAL EXCLUSION CRITERIA TO SATISFY NO TWO PROCESSES MAY BE SIMULTANEOUSLY INTO THEIR CRITICAL SECTIONS FOR THE SAME SHARED DATA NO ASSUMPTIONS MAY BE MADE ABOUT THE SPEEDS AT WHICH THE PROCESSES WILL EXECUTE NO PROCESS SHOULD BE PREVENTED TO ENTER ITS CRITICAL SECTION WHEN NO OTHER PROCESS IS INSIDE ITS OWN CRITICAL SECTION FOR THE SAME SHARED DATA NO PROCESS SHOULD HAVE TO WAIT FOREVER TO ENTER ITS CRITICAL SECTION SOFTWARE SOLUTION LOCK VARIABLES
Image of page 25
STRIC ALTERNATION PETERSON ° S ALGORITHMS HARDWARE SOLUTION TEST AND SET INSTRUCTION SWAP
Image of page 26
PROBLEMS: THEY RELY ON BUSY WAITS (IT WASTES CPU CYCLES) THEY GENERATE UNNECESSARY CONTEXT SWITCHES SEMAPHORES TWO ATOMIC OPERATIONS APPLICATIONS: + MUTUAL EXCLUSION o INITIAL VALUE OF SEMAPHORE = 0 o ONE SEMAPHORE FOR EACH CRITICAL SECTION P(&MUTEX) V(&MUTEX) + FORCING A PROCESS TO WAIT FOR ANOTHER: o INITIAL VALUE OF SEMAPHORE = 1
Image of page 27
o THE PROCESS THAT WAITS => P(&sem) o THE PROCESS THAT TELLS IT IS READY => V(&sem) SEMAPHORES + FORCING TWO PROCESSES TO WAIT FOR EACH OTHER: o INITIAL VALUE OF SEMAPHORE = 1 o THE FIRST PROCESS
Image of page 28
Image of page 29

You've reached the end of your free preview.

Want to read all 79 pages?

  • One '20
  • Virtual memory

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors