os:lab11
Return to Home page
If you found any error, or if you want to partecipate to the editing of this wiki, please contact: admin [at] skenz.it
You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url: https://www.skenz.it/os/lab11?do=diff&rev2%255B0%255D=1558735304&rev2%255B1%255D=1578519424&difftype=sidebyside
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | os:lab11 [2024/04/08 22:35] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | Return to [[os: | ||
+ | ---- | ||
+ | ====== Operating Systems Course: Lab11 ====== | ||
+ | ===== Laboratory number 11 (pseudo-exam test) ===== | ||
+ | |||
+ | ==== Exercise 01 ==== | ||
+ | Implements with the semaphore primitives the prologue and the epilogue of 4 functions A, B, C, and D, so that the processes that call them respect the following //path expression//: | ||
+ | <code txt> | ||
+ | path ( A+B; {C}; D ) end | ||
+ | </ | ||
+ | The meaning of this path expression is that the set of processes can: | ||
+ | * call function A **or** function B in //mutual exclusion// (i.e., a process waits if the function is used by another process) | ||
+ | * then, it can call function C (that can be executed concurrently by all the processes) | ||
+ | * finally, it can call function D. | ||
+ | |||
+ | If, for instance, the first of all the functions called is function D, the process that called it, it is blocked until other processes have called A or B, and then C. | ||
+ | |||
+ | The //path expression// | ||
+ | |||
+ | **Suggestion**\\ | ||
+ | Refer to the solution of Readers & Writers. | ||
+ | |||
+ | |||
+ | ==== Exercise 02 ==== | ||
+ | Illustrate the characteristics, | ||
+ | |||
+ | |||
+ | ==== Exercise 03 ==== | ||
+ | Realize a bash script that receives two parameters: | ||
+ | * the name of a user of the system | ||
+ | * the name of a directory. | ||
+ | The script must recognize all the files of the specified user that are in the directory and its subdirectories, | ||
+ | |||
+ | In those files you need to: | ||
+ | * delete this row | ||
+ | * append to the name of the file the string "'' | ||
+ | |||
+ | Check the correct passage of the parameters. | ||
+ | |||
+ | |||
+ | ==== Exercise 04 ==== | ||
+ | Write a multi-thread program that sorts a vector of integer numbers using the algorithm merge-sort and using concurrency instead of recursion. | ||
+ | |||
+ | Each thread, starting from the initial one must: | ||
+ | * receive a vector to sort of dimension '' | ||
+ | * subdivide the vector in two parts of dimension '' | ||
+ | * activate a thread on each part of the vector | ||
+ | * wait for the termination of both threads | ||
+ | * merge the two received parts of dimension '' | ||
+ | |||
+ | Note that the termination condition occurs when a thread receives a vector of dimension '' | ||
+ | |||
+ | The vector and its dimension can be read from the keyboard, from a file, or generated randomly. | ||
+ | |||
+ | |||
+ | ==== Exercise 05 ==== | ||
+ | Given the following processes, with the relative arrival times and their duration: | ||
+ | <code txt> | ||
+ | P1 0 11 | ||
+ | P2 2 9 | ||
+ | P3 4 7 | ||
+ | P4 6 5 | ||
+ | P5 8 3 | ||
+ | </ | ||
+ | Report the Gantt charts and calculate the average waiting times for the algorithms FCFS, SJF and SRTF. | ||
+ | |||
+ | |||
+ | ==== Exercise 06 ==== | ||
+ | With reference to deadlock prevention through the hierarchical use of resources, describe the technique and demonstrate that it cannot lead to deadlock. |
If you found any error, or if you want to partecipate to the editing of this wiki, please contact: admin [at] skenz.it
You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url: https://www.skenz.it/os/lab11?do=diff&rev2%255B0%255D=1558735304&rev2%255B1%255D=1578519424&difftype=sidebyside
/web/htdocs/www.skenz.it/home/data/pages/os/lab11.txt · Last modified: 2024/04/08 22:35 by 127.0.0.1