Back
ExamFull examExam paper only

01 07 15

Full exam for Advanced Operating Systems in the Computer Engineering degree programme at Politecnico di Milano. The document covers: Politecnico di Milano FACOLTÀ DI INGEGNERIA DELL’INFORMAZIONE Advanced Operating Systems A.A. 2014-2015 – Exam date: 1 July 2015 Prof. William FORNACIARI Surname (readable)........................................ Name (readable)............................

Advanced Operating SystemsFull exam

Document information

What's included in this study material

Full exam for Advanced Operating Systems in the Computer Engineering degree programme at Politecnico di Milano. The document covers: Politecnico di Milano FACOLTÀ DI INGEGNERIA DELL’INFORMAZIONE Advanced Operating Systems A.A. 2014-2015 – Exam date: 1 July 2015 Prof. William FORNACIARI Surname (readable)........................................ Name (readable)............................

Import quality: text was extracted directly from the original document.

Extracted content from the document

Representative passages recognised in different parts of the material. The full extracted text remains available to search, while this compact preview makes the page easier to read.

Page 1

Politecnico di Milano FACOLTÀ DI INGEGNERIA DELL’INFORMAZIONE Advanced Operating Systems A.A. 2014-2015 – Exam date: 1 July 2015 Prof. William FORNACIARI Surname (readable)........................................ Name (readable)............................ Matr................................................................. Signature........................................ Q1 Q2 Q3 TOT NOTES It is forbidden to refer to texts or notes of any kind as well as interact with their neighbors. Anyone found in possession of documents relating to the course, although not directly relevant to the subject of the examination will cancel the test. It is not allowed to leave during the first half hour, the task must still be returned, even if it is withdrawn. The presence of the writing (not delivered) implies the renunciation of any previous ratings. Question Q1 Describe what is a context switch by specifying its purposes and detailing a generic and common implementation. 1/9 Question Q2 Consider the following multithreaded C program. 1) Describe the program flow from start to finish detailing the synchronizations that happen between the threads. 2) Write what the program prints on the standard output. 3) Fix the bug in the program. #include <stdio.h> #include <stdlib.h> #include <pthread.h> struct Param { int *slice; int size; int *result; }; void *thread(void *arg) { struct Param *p=(struct Param*)arg; int i; int sum=0; for(i=0;i<p­>size;i++) sum+=p­>slice[i]; *(p­>result)+=sum; free(p); return NULL; } int main() { const int N=10; int data[N][N]; int i,j; for(i=0;i<N;i++) for(j=0;j<N;j++) data[i][j]=i+j; int result=0; pthread_t threads[N]; for(i=0;i<10;i++) { struct Param *p=(struct Param*)malloc(sizeof(struct Param)); p­>slice=data[i]; p­>size=N; p­>result=&result;…

Preview

First page of the document.

First page: 01 07 15