Lecture 5: Inter-process Communication II

9 September, 2010

While previous lecture focuses on mutual exclusion, this second lecture on inter-process communication (IPC) focuses on synchronization among processes. You will learn about using semaphore to solve the producer-consumer problem and dining philosopher problem. We will end the lecture on threads programming in C.

Having a hardcopy of slides during lecture would be helpful. Be prepare to take notes during lecture. Demo code will be shown during lecture and posted after the class along with screencast.

Download Slides: PDF

Reading:

  • Section 2.3.5 Semaphore
  • Section 2.3.6 Mutexes
  • Section 2.5.1 The Dining Philosophers Problem

Related Wikipedia entries are listed below. These are for students who are keen to go beyond what is covered in CS2106. Read the articles with a critical mind since Wikipedia is editable by anyone.

Here is a nice tutorial on phtread programming by Blaise Barney of Lowrence Livermore National Laboratory.

4 thoughts on “Lecture 5: Inter-process Communication II

  1. Hi prof,
    Sorry for asking this so late, but I was just revising this lecture and I came upon the part where you talk about the 5 states processes can be in and the transition between those states in the case of semaphores. I am confused at the part where the process might go from blocked to ready state when some other process calls up(). Why will the process go to the ready state? Won’t it go to the running state? Umm…maybe I am not very clear about the difference between ready and running states. Could you please elaborate that in this context?
    Thanks.

    • Assuming a uniprocessor system, there can only be one running process at a time. So when a process wakes up, it will not run immediately (unless noone else is using the CPU). Rather, it will wait in a queue until the scheduler selects it to run.

      A process that is waiting in a queue (FIFO, Priority Queue, MLFQ etc) is said to be in ready state.

  2. Hi Professor, so far for inter-process communication, we have been using pthreads to illustrate. How about communication between 2 process?

    Thanks!

Comments are closed.