os:lab01
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/lab01?rev=1564406650&do=diff
Differences
This shows you the differences between two versions of the page.
— | os:lab01 [2024/04/08 22:35] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | Return to [[os: | ||
+ | ---- | ||
+ | ====== Operating Systems Course: Lab01 ====== | ||
+ | ===== Laboratory number 01 ===== | ||
+ | |||
+ | |||
+ | ==== Exercise 01: Management of files and directories ==== | ||
+ | |||
+ | === Part 01 === | ||
+ | Produce the following tree of directories in your home directory: | ||
+ | < | ||
+ | | ||
+ | | | ||
+ | ------------------------ | ||
+ | | | ||
+ | | ||
+ | | | | ||
+ | | ||
+ | | ||
+ | include | ||
+ | </ | ||
+ | |||
+ | === Part 02 === | ||
+ | * Download the file: [[https:// | ||
+ | * Copy the file in the directory '' | ||
+ | * Check the existence of the files previously created, and check their rights. | ||
+ | * Use the commands '' | ||
+ | * Use the command '' | ||
+ | * Without changing the current (working) directory, cancel using relative paths all the files previously created. | ||
+ | * Repeat the same sequence of operations starting from father directory of '' | ||
+ | |||
+ | === Part 03 === | ||
+ | Executing all the commands from the root of your user (i.e., ''/ | ||
+ | * Copy all the directory tree named '' | ||
+ | * Cancel all the content of '' | ||
+ | * Repeat both the //copy// and the //cancel// operations by using the // | ||
+ | |||
+ | === Part 04 === | ||
+ | Check what they do and for what the following commands are used: | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | For any problem, remember that you can use the following command to obtain an online help manual for a specific '' | ||
+ | * '' | ||
+ | |||
+ | |||
+ | ==== Exercise 02: Permissions management ==== | ||
+ | |||
+ | Verify and reply to the following questions: | ||
+ | * the '' | ||
+ | * the position of your home directory within the file system hierarchy of the system you are using | ||
+ | * the structure of your ''/ | ||
+ | * the rights of reading and writing on the various directories of the file system. Is it possible to modify access rights to your '' | ||
+ | * what happens if //reading// or // | ||
+ | |||
+ | How is it possible to modify in the same way the access rights to **all** the files and directories of a directory tree (for example, to eliminate the //read// right to all, user, group, and other of the directory '' | ||
+ | |||
+ | |||
+ | ==== Esercise 03: Link and comparisons between files ==== | ||
+ | |||
+ | * Download the file [[https:// | ||
+ | * In the same directory where the file is stored, you have to create: | ||
+ | * A copy of the file with the name '' | ||
+ | * A hard-link to the file with name '' | ||
+ | * A soft-link to the file with name '' | ||
+ | * View files information with the command '' | ||
+ | * What can you see in the second column of the output? | ||
+ | * Why don't all the files have the same size? | ||
+ | * Check that the content of the three created files is the same as the original file using the '' | ||
+ | * Why does the '' | ||
+ | * Open and modify the content of the file '' | ||
+ | * How do you expect information related to the size and the date of last modification of the file will be changed? Why? | ||
+ | * Verify your answer using the command '' | ||
+ | * What changes are expected regarding the content of the files? Why? | ||
+ | * Check the response by comparing the three files created with the original one. Use again the '' | ||
+ | * Rename the file '' | ||
+ | * What can you see now from the output of the '' | ||
+ | * Compare the content of the file '' | ||
+ | * Create a new empty file named '' | ||
+ | * What is the current expected content of the file '' | ||
+ | * Check with the command '' | ||
+ | |||
+ | **Observation: | ||
+ | The command\\ | ||
+ | '' | ||
+ | allows to update date and time of the last modification performed on a file.\\ | ||
+ | In the case the specified file does not exist, it creates an empty file with that name. | ||
+ | |||
+ | |||
+ | ==== Exercise 04: C programs and compilation ==== | ||
+ | |||
+ | Perform the following tasks using: | ||
+ | * an editor of your choice (e.g., '' | ||
+ | * the '' | ||
+ | |||
+ | === Part 01 === | ||
+ | Write a C language program that, using the ANSI C I/O primitives ('' | ||
+ | The name of the two files is received on the command line, so that the program can be executed using a command that specifies three parameters: | ||
+ | '' | ||
+ | |||
+ | === Part 02 === | ||
+ | Compile the source files using '' | ||
+ | * Eliminate possible warnings.\\ | ||
+ | * Try to compile the file by directly generating the executable, or first the object code and then the executable. | ||
+ | * Run the program using the [[https:// | ||
+ | * Verify the program using as program arguments both //relative paths// and //absolute paths// to specify input and output files. | ||
+ | * Verify the correct copy of the files (i.e., '' | ||
+ | |||
+ | === Part 03 === | ||
+ | How does the written program behave if you try to copy a binary file? | ||
+ | * Use the object file or the executable file of the program written to perform a check. | ||
+ | * Test its correct functioning using the '' | ||
+ | |||
+ | === Part 04 === | ||
+ | Change the program using | ||
+ | * ANSI C '' | ||
+ | * '' | ||
+ | * Test its correct functioning using the '' | ||
+ | |||
+ | ==== Exercise 05: Compilation and makefile ==== | ||
+ | * Compile the program of the previous exercise using a Makefile containing only the compilation target. | ||
+ | * Edit the previous Makefile by adding the '' | ||
+ | - create a directory, sibling of the work directory and named '' | ||
+ | - move the created executable in this directory | ||
+ | * Edit the previous Makefile by adding the '' | ||
+ | * Edit the previous Makefile by adding the '' | ||
+ | * Edit the previous Makefile using variables to specify the compiler, the compilation options, and the file name. | ||
+ | |||
+ | Take as reference the example analyzed in classroom: [[https:// | ||
+ | |||
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/lab01?rev=1564406650&do=diff