PDC Lec 8
PDC Lec 8
Computing
Week 6
Content
Software Architecture
Threads and shared memory
Software
Architecture
• The architecture of a software system is a metaphor,
analogous to the architecture of a building.
3. The process view, which maps processes at system runtime, while looking at
aspects like synchronization and concurrency.
process.
Process and Thread cont…
Process and Thread cont…
Time for Processes require more time for creation. Threads require less time for creation.
creation
Time for Processes require more time for Threads require less time
termination termination. for
termination.
Process and Thread cont…
programming paradigm.
• Asynchronous paradigm.
defined as follows:
Process and Message Passing
The cont…
Building Blocks: Send and Receive
Operations
• send(void *sendbuf, int nelems, int dest)
The dest is the identifier of the process that receives the data
The source is the identifier of the process that sends the data
Process and Message Passing cont…
The Building Blocks: Send and Receive
Operations
Process and Message Passing
The cont…
Building Blocks: Send and Receive
Operations
• The important thing to note is that process P0 changes the value of a
• The semantics of the send operation require that the value received
100!
Process and Message Passing cont…
The Building Blocks: Send and Receive
Operations Blocking Message
Passing Operations
• A simple solution to the dilemma presented in the code fragment above is
for the send operation to return only when it is semantically safe to do so.
• It simply means that the sending operation blocks until it can guarantee
operation does not return until the matching receive has been
• When this happens, the message is sent and the send operation
• We start with a simple case in which the sender has a buffer pre-allocated for
communicating messages.
• On encountering a send operation, the sender simply copies the data into the
Process and Message Passing cont…
The Building Blocks: Send and Receive
Operations Blocking Message
Passing Operations
• The sender process can now continue with the program knowing that
• Note that at the receiving end, the data cannot be stored directly at
(a) presence of communication hardware (b) absence of communication hardware, sender interrupts
with buffers at send and receive ends receiver & deposits data in buffer at receiver end
Process and Message Passing cont…
The Building Blocks: Send and Receive
Operations Blocking Message
Passing Operations
• The sender process can now continue with the program knowing that
• Note that at the receiving end, the data cannot be stored directly at