Distributed and concurrent programming

Degree course: 
Corso di First cycle degree in COMPUTER SCIENCE
Academic year when starting the degree: 
2021/2022
Year: 
2
Academic year in which the course will be held: 
2022/2023
Course type: 
Compulsory subjects, characteristic of the class
Seat of the course: 
Como - Università degli Studi dell'Insubria
Credits: 
8
Period: 
Second semester
Standard lectures hours: 
72
Requirements: 

Students have to master sequential programming before tackling concurrent and distributed programming. Specifically, students must be able to program in Java.
The necessary knowledge and abilities should have been acquired in the first year in the Programming course, which has to be passed beforehand.

Exams aim at verifying that students have successfully acquired the knowledge and abilities described in the "Objectives" section, by evaluating the level of knowledge and the ability to apply in practice the programming techniques mentioned in section "Contents", possibly combining them.
The exam consists in a 90-minute session in the lab, in which the student has to has to answer a few questions and implement some programs, using the development environment already used during exercise lessons. The programs to be written require that the student owns the expected knowledge and is able to apply the techniques taught in the course, specifically concerning multi-thread programming, socket-based and RMI distributed programs. The exam includes 6–10 questions concerning the topics mentioned in section "Contents". Questions are usually closed-answer, and wrong answers are considered like non-given answers.
Only if there are still doubts on the actual preparation of the student an oral test will be carried out.
The knowledge of domain-specific terminology is tested implicitly, since the questions and the programming problem specifications use that terminology.
25% of the final mark is attributed based on the answers to questions. The remaining 75% is attributed based on the programs.
In specific conditions, the off-line execution of a simple project could be offered as an optional alternative to the lab session.

Assessment: 
Voto Finale

The course aims at enabling students to program concurrent and distributed software systems. To this aim, students will learn to recognize specific problems connected with concurrency and distribution, and will learn specific techniques to develop concurrent and distributed programs.
After successfully completing the course, the student will be able to
1. Understanding the characteristics and mechanisms of concurrent programs (i.e., programs involving multiple execution threads); recognizing conditions in which errors like Race Conditions, Deadlock and Starvation can occur.
2. Understand and apply primitive methods to create and manage threads, with specific reference to the communication and synchronization primitives; Understand and apply techniques that prevent errors like Race Conditions, Deadlock and Starvation.
3. Understand and implement the main inter-thread communication paradigms.
4. Understand the ISO/OSI communication protocol stack.
5. Understand the characteristics of distributed programs; understand and use sockets to implement inter-process communication.
6. Understand and use RMI to build distributed object-oriented programs.
7. Understand the basics of event-based programming in concurrent and distributed programs and write programs that react to events properly.
In addition, students will become autonomous in recognizing problems specifically connected with concurrency and distribution, and in choosing the proper techniques to obtain the desired behavior from concurrent and distributed software systems.
Finally, students will learn the terminology that is specific of the concurrent and distributed software domain.

Lessons will concern the following topics:
Multi-thread programming (6 hours, objective 1)
Introduction to Multi-thread programming; non-determinism.
Characteristics and behavior of concurrent programs; the situation of the memory during the execution of a multi-thread program.
Typical problems: Race Conditions, Deadlock, Livelock e Starvation and when they can occur.
Mechanisms for multi-thread programming (18 hours, objective 2)
Semaphores and monitors; equivalence of these mechanisms.
Preventing race conditions.
Primitives to suspend and resume threads (wait and notify).
Example: producer-consumer.
Deadlock prevention techniques.
Example: the dining philosophers.
Program design using UML.
Inter-thread communication paradigms (8 hours, objective 3)
Description and implementation of popular paradigms: signals, buffer, mailbox, broadcast, blackboard, barrier.
Examples illustrating the seen paradigms.
The ISO/OSI standard and communication protocols (8 hours, objective 4)
The ISO/OSI stack
The Internet protocol
TCP and UDP
Application protocols, HTTP
Distributed systems (4 hours, objective 5)
Introduction
The client-server architecture
Implementing distributed systems through sockets (8 hours, objective 5)
Java library functions for using socket
Serialization
Examples
Proxy and skeleton
Describing distributed systems via UML
Implementing distributed systems through RMI (12 hours, objective 6)
What RMI is for.
How RMI works.
Programming RMI.
Callback.
Event-based programming (8 hours, objective 7)
Event-based programming basics
Communication patterns for distributed systems
Events in GUI
All the aforementioned topics are treated using Java as the reference programming language. Nonetheless, the greatest part of the course contents are applicable in general, and the proposed techniques can be used with different programming languages.

See Section "contenuti" (contents)

The course includes frontal lessons (48 hours) and exercise lessons (24 hours).
Frontal lessons are dedicated to illustrating the elements of concurrent and distributed programming, of typical problems and of specific programming techniques.
During exercise lessons students participate in building concurrent and distributed programs through the practical usage of programming tools (especially Eclipse).

Office hours: by appointment to be requested via email to luigi.lavazza@uninsubria.it from the domain studenti.uninsubria.it.

Professors

CONTI GIAN ENRICO