Operating Systems M - Z

Academic Year 2024/2025 - Teacher: Salvatore CAVALIERI

Expected Learning Outcomes

Knowledge and understanding: Upon completion of the course, the student will have acquired the knowledge of the basic concepts inherent to the design of operating systems and the writing of programs that exploit System Calls in Linux / UNIX environment. At the end of the course the students: will have acquired knowledge of the structure of Operating Systems; the relevant project issues and policies used for virtualization and the management of resources (CPU, main memory, mass storage, peripherals); will have acquired knowledge about the concepts of process and thread and their management; will have acquired knowledge on management techniques of mutually exclusive resources; will have become familiar in the interaction with the Linux shell.

Applying knowledge and understanding: at the end of the course the students  will be able to write applications containing system calls for the: creation and management of processes and threads, management of files, signal management, interaction and communication between processes, manage competition over shared resources and creation of multithreaded applications.

Making judgements. On completion of the course, the student will be able to choose a suitable software solution based on Linux API  for each of the subjects treated inside the course.

Communication skills. On completion of the course, the student can communicate his conclusions and recommendations about design and use of operating systems  with the argumentation of the knowledge and rationale underpinning these, to both specialist and non-specialist audiences clearly and unambiguously.

Learning skills. On completion, the student will be able to continue to study in a manner that may be largely selfdirected or autonomous.

Course Structure

The course is essentially based on lectures, which include the development of exercises by the teacher. The proposed exercises are addressed by the teacher through the use of computer . The course also includes practical exercises carried out by the students. These exercises are carried out in the University's multimedia rooms. Each student is assigned a task that must be performed on the computer. The teacher supervises the work of the students by providing the explanations and teaching aids necessary to complete the assigned tasks. The methods of carrying out the teaching described above allow the achievement of the pre-established training objectives, which include the acquisition of knowledge and the ability to apply knowledge.


Required Prerequisites

Requirements necessary to successfully reach the goals of the course:

- Basic general knowledge of computer architecture, in particular: CPU, interrupts, registers, memories, multiprocessor architectures, I /O devices.

- Programming skills and knowledge of ANSI C language, with particular reference to: "use of argc and argv parameters in the main () function", "use of pointers, vectors and dynamic allocation", "use of structures", "use of functions and relative use of parameters by value and by reference"

- Knowledge of the main data structures: lists, stacks, queues, hash tables, trees and graphs and their implementation in ANSI C language


Attendance of Lessons

Attendance is recommended, but it is not mandatory. It is strongly suggested.

Detailed Course Content

UNIT 1: INTRODUCTION TO OPERATING SYSTEMS. GNU/LINUX. SYSTEM CALL. FILE SYSTEM. VIRTUALISATION.

  • Overview of  Operating Systems. Resource management. User interface. Kernel concept.
  • Some notes on Unix and POSIX standard.
  • Structure of operating systems: monolithic, microkernel, hybrid, kerenl modules.
  • Concept of System Calls and relevant realization.
  • Overview of Linux and relevant system calls.
  • File System and relevant System Calls in Linux  with execises in C Language.
  • Virtualization. Virtual machines. Hypervisor level 1 and 2. Example: Virtual Box.


UNIT 2: PROCESSES AND THREAD

  • Process concept. States of a process.
  • Interruptions hardware and software and their management in operating systems. Context Switching
  • System calls for the creation and management of processes: fork(), wait(), waitpid(). The exec() family. Examples of programs that use all the system calls mentioned.
  • Signals and their management. System calls kill(), sleep(), pause(), alarm(), wait(), sigaction(). Examples of programs in C language that use all the system calls mentioned.
  • Thread. General characteristics.
  • Thread implementation: user space, kernel space, hybrid (with reference to the design choices of the main OS).
  • The Pthreads library. Functions: pthread_create(), pthread_join(), pthread_exit(), pthread_detach(), pthread_attr_init ().
  • Exercises in C language


UNIT 3: SCHEDULING OF CPU

  • CPU scheduling. Aims. Classical algorithms: FIFO, Round-Robin. Scheduling based on priorities. Scheduling algortihms based on preemption. The problem of Starvation. Multiple queues.
  • Linux scheduling: Completely Fair Scheduler.

   
UNIT 4: SYNCHRONISATION.

  • Critical section. Mutual exclusion with busy waiting. Semaphores and Mutex.
  • Basic synchronisation probems: Producer-Consumer sharing data (sinlgle or multiple with limited size), reader-writer problems. Solutions based on semaphores and mutex.
  • Semaphores. Implementation in Linux using System V library: semget(), semop(), semctl()
  • Exercises in C language

UNIT 5: MEMORY MANAGEMENT.

  • Main Memory
  • Virtual Memory

UNIT 6: INTER PROCESS COMMUNICATION (IPC)

  • Introduction to the IPC on Linux.
  • Shared memory using SYSTEM V library: shmget(), shmat(), shmdt(), shmctl().
  • Communication in the client-server systems by sockets using POSIX library: socket(), bind(), listen(), accept(), connect()
  • Exercises in C language


 

Textbook Information

For the theory: [1] Abraham Silberschatz, Peter Baer Galvin, Greg Gagne, “Operating System Concepts”, Pearson.

or: [2] Andrew S. Tanenbaum, “I moderni sistemi operativi", Pearson.

For the technical examples and exercitations: [3] R. Stones, N. Matthew, “Beginning Linux Programming”, 4th edition, Wrox Press, 2007.

Course Planning

 SubjectsText References
1 Overview of  Operating Systems. Resource management. User interface. Kernel concept. [1] Sections 1,2 - [2] Section 1
2 Structure of operating systems: monolithic, microkernel, hybrid, kernel modules. [1] Section 2 - [2] Section 1
3Some notes on Unix and POSIX standard[1] Section 1 - handouts
4 Concept of System Calls and relevant realization. Overview of Unix/Linux system calls. [1] Section 2 - [2] Section 1
5Virtualization. Virtual machines. Hypervisor level 1 and 2. Example: Virtual Box. [1] Section 16 - [2] Section 1
6 File System and relevant Unix/Linux System Calls. [1] Sections 11 e 13 - [2] Section 4
7 Process concept. States of a process. [1] Section 3 - [2] Section 2
8Hardware and software Interruptions and their management in operating systems. Context Switching.[1] Section 3 - [2] Section 2
9System calls for the creation and management of processes: fork(), wait(), waitpid(). The exec() family. [1] Section 3 e [3] Section 11
10Signals and their management. System calls kill(), sleep(), pause(), alarm(), wait(), sigaction(). [3] Section 11
11 Thread. General characteristics. Thread implementation: user space, kernel space, hybrid (with reference to the design choices of the main OS). [1] Section 4 - [2] Section 2
12 The POSIX Thread. Functions: pthread_create(), pthread_join(), pthread_exit(), pthread_detach(), pthread_cancel(). Examples of programs that use the Pthreads library. [3] Section 12 - [2] Section 2
13 Process synchonization. Critical section. Mutual exclusion with busy waiting. Semaphores and Mutex. [1] Section 5 - [3] Section 14 - [2] Section 2
14 Basic synchronisation probems: Producer-Consumer sharing data (single or multiple with limited size), reader-writer problem. Solutions based on semaphores and mutex. [1] Section 5 - [2] Section 2
15Semaphores in Linux System V: semget(), semop(), semctl().  Example of programs using semaphores.[3] Section 14
16 Memory Management. Main and virtual memory[1] Sections 9-10
17 Process Communication in the client-server systems: sockets using POSIX library. [3] Section 15
18Process Communication : shared memory. Libraries in Linux: shmget(), shmat(), shmdt(), shmctl()[1] Section 3 - [3] Section 14
19 CPU scheduling. Aims. Classical algorithms: FIFO, Round-Robin. Scheduling based on priorities. Scheduling algortihms based on preemption. The problem of Starvation. Multiple queues. [1] Section 6 - [2] Section 2
20 Linux scheduling: Completely Fair Scheduler. [1] Section 6

Learning Assessment

Learning Assessment Procedures

The exams are fixed in agreement with the CdS in compliance with the procedures established by the academic calendar.

Reservations are required through the University portal. The closing date for reservations is usually fixed a few days before the exam, in order to allow the teacher to book the computer rooms of adequate capacity for the number of registered students.

The exam consists of a written test and oral test, both mandatory.

The written test is made up by two sections. The first section is relevant to the realization of one or more programs in C language using the system calls studied inside the course; for  this reason it requires the use of a computer made available to the students by the university. The second section consists of one or more theoretical questions. The first section allows to achieve a total value of 18/30 points; the second sections allows to achieve a total value of 12 /30 points. The written test, lasting 3 hours,  is passed if the sum of the two values is greater than or equal to 18/30; furthermore, it is necessary for the student to have acquired at least 6/30 points in theory and at least 12/30 points in practice (calculator work).

The oral test is mandatory and it is made up by the discussion of the written test in order to further evaluate the nature of the errors made by the student; to this end, the oral test can be completed by further questions given by the teacher on the topics of the written test. For this reason, the vote  of the written test may be subject to change based on the result of this discussion. In addition to this discussion, the student may also ask to be examined on other topics of the program (chosen by the teacher) other than those present in the written test. The final vote will take into account the written test, the result of the discussion and the result of any additional oral exam requested by the student.

On the portal used as repository during the course,  a template of the written test that specifies both the types of sections and the relative points, is present.

To ensure equal opportunities and in compliance with current laws, interested students may request a personal interview in order to plan any compensatory and/or dispensatory measures based on educational objectives and specific needs. Students can also contact the CInAP (Centro per l’integrazione Attiva e Partecipata - Servizi per le Disabilità e/o i DSA) referring teacher within their department.

 

Examples of frequently asked questions and / or exercises

On the portal used during the course as repository, there are examples of frequently asked questions and exercises. For each question, the corresponding correct answer is provided. All the texts of the exams assigned in previous sessions are also available on the same site. The corresponding solutions are provided.


VERSIONE IN ITALIANO