-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
1/24
School of Computing & Informatics
University of Nairobi
CSC 322 Network and Distributed
Programming
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
2/24
Course Outline
Concurrent Programming:
Processes and threads,
process/thread interaction mechanisms;
classical problems in concurrent programming;
concurrent programming with threads;
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
3/24
Course Outline
Network programming:
TCP and UDP transport,
Introduction to software design models:
Client/server, peer-to-peer etc;
Server designs;
Networking APIs;
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
4/24
Course Outline
Sockets:
introduction to sockets,
socket options,
socket types,
Name and address conversions;
Non blocking I/O;
Daemons; Broadcasting and multicasting;
Network programming with TCP/IP;
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
5/24
Course Outline
Distributed Programming:
Middleware for distributed applications;
Remote Procedure Calls(RPC),
Distributed programming using RPC;
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
6/24
Course Outline
Distributed Object based systems:
Distributed objects,
Architecture;
Communication;
Distributed object programming systems:
Java RMI, CORBA, DCOM;
Distributed object based programming using JavaRMI and CORBA.
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
7/24
Course Outline
Pre-requisites
CSC221 Object-oriented Analysis, Design and
Programming
CSC223 Operating Systems
CSC225 Computer Networks
CSC315 Distributed Systems
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
8/24
Course Outline
Delivery
Lectures
Tutorials and
Lab sessions
Core Texts
UNIX Network Programming Volume 1: The
Sockets Networking API by W.R. Stevens UNIX Network Programming Volume 2:
Interprocess communication by W.R. Stevens
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
9/24
Course Outline
Assessment
Examination 50%
Coursework 50%
Lectures and Lab sessions
Attendance
Electronic handouts provided
Linux Computing Environment
Projects
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
10/24
Administrative
Collaboration and Cheating
Discussions
Hand in only your own work
Writeups must be completed independently
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
11/24
Processes and Threads
A process: An execution stream in the contextof a particular process state.
Execution stream: A sequence of instructions
executed one at a time. A process state: A set of things that can affect or
can be affected by a process.
Includes: Code, data, registers, stack, open file
tables, network connections, memory allocations. Processes are separated.
Process is a key OS abstraction to the users.
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
12/24
Processes
Process concepts
Uniprogramming: Runs only one process at a time
Multiprogramming: Multiple processes at a time.
Processes share resources.
Context switch: Save and restore hardware state.
Save the state in PCB (Process Control Block).
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
13/24
Process Creation
Caused by the following events
Initiation of a batch job
Execution of a process creation system e.g. System
initialization
User initiated request to create a new process
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
14/24
Process States
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
15/24
Process Termination
Under the following conditions
Normal exit (e.g. exit(0))
Exit on Error (e.g. exit(1))
Fatal error (e.g. segmentation falt)
Killed by another process (kill system call)
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
16/24
Threads
A thread:
A unit of sequential execution.
An execution stream in the context of a thread state.
Unlike processes, multiple threads share parts of theirstate. E.g. Multiple threads can read and write thesame memory location.
Each thread still has its own registers, stack, programcounter but other threads can read and write thestack memory.
Thread Control Block: Typically Registers owned by athread.
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
17/24
Threads
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
18/24
Threads
Thread Stack Each thread has its own
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
19/24
Threads Implementation
Three approaches:
User-level managed threads
Kernel level managed threads
Hybrid management approach
Multiplexing user level threads onto kernel level
threads
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
20/24
Threads
User-level threads
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
21/24
Threads
Kernel managed threads
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
22/24
Threads
Hybrid implementation approaches
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
23/24
Process/Thread interaction
mechanisms
-
7/30/2019 CSC322 NETWORK AND DISTRIBUTED PROGRAMMING.pptx
24/24
Classical Problems in concurrent
programming
Producer-Consumer problem
Race condition.
Semaphores
Mutex Locks
Monitors
Dining Philosphers
Readers and Writers
Sleeping Barber