You are on page 1of 2

University of Stuttgart

Institute of Parallel and Distributed Systems


Distributed Systems Department

Winter Term 2014/2015

Operating Systems
Assignment Sheet 1
Available:
Due Date:
Discussion:

Monday, October 27, 2014, 08:00 am


Monday, November 10, 2014, 08:00 am
Group 1: Friday, November 14, 2014, 11:30-13:00, Room V38.02

General remarks: The intent of the exercises is to help you get more familiar with fundamental
concepts of modern operating systems as presented in the lecture.
Work on the problems with your group and hand in a single solution which will be graded for all
members of the group. We will review your solution and hand out the graded version in the exercise
sessions. Everybody has to present at least once in the sessions. If you hand in a solution but are not
able to present it, no points will be given for the whole exercise! If we detect any plagiarism in your
solution, the whole group will not get points for the whole sheet.
Please read the SubmissionGuidlines.pdf and InformationOnExercises.pdf in ILIAS in the Course
Material folder. Especially, be concise and avoid long answers.
For additional reference, consult the text books cited in the lecture and explore the Web. You can
find additional information on lectures and exercises at the lecture homepage. If you have any questions,
you may contact us on the e-learning system ILIAS.
Questions
1. (5 points) Operating System Architecture
(a) Modern operating systems are one of the most complex pieces of software for computer systems.
Name two approaches for managing the complexity of operating systems and explain them
briefly. (2 points)
(b) Operating systems can be classified according to having a microkernel or monolithic kernel
design. Further, some operating systems employ the technique of loadable kernel modules.
Associate the following operating systems with whether they use a microkernel or monolithic
kernel design, and whether they support loadable modules. Justify your answers. (3 points)
-

FreeBSD 9.2
Linux 3.11
Mach 3
MINIX 3
Sun Solaris 11
Windows 8

2. (7 points) Memory Hierarchies


In a system with a memory hierarchy that consists of a cache, main memory and a disk, a reference
to a word takes 10ns if it is found in the cache. In order to copy a memory word from main memory
to cache 90ns are needed. Moreover, it takes 9900ns to copy the word from the disk to main memory.
(a) Explain what happens when a memory word is referenced. (1.5 points)
(b) Compute the average time of access to a word. Assume that the probability to find a word in
the cache is 0.6 and the probability to find a word in main memory (when it is not in the cache)
is 0.5. (2.5 points)

(c) Give an explanation of the terms spatial locality and temporal locality in the context of cache
memory. For both locality terms, give two examples: one for instructions and one for data. (3
points)
3. (5 points) Memory Protection
(a) Reading data from hard disk is implemented using a system call. The drawback of this solution
is that a context switch is needed which costs time. Explain which drawbacks would arise if a
process is granted direct access to the hardware. (2 points)
(b) Some processor instructions are only available in kernel mode but not in restricted mode. For
each of the following examples, state if the instruction is always available or only in kernel mode.
Give a short short explanation for each example. (3 points)
i. Jump instruction (JMP) to an address in memory
ii. Changing the configuration of the MMU
iii. Instructions that allow to switch from restricted to kernel mode.
iv. Changing the content of data registers
v. Stopping the CPU until the next hardware interrupt occurs (Think about a feasible solution)
vi. Deactivating the interrupt controller
4. (8 points) Implementation Task
The following two tasks need to be implemented in C on a Linux system. For each task, hand in a
single archive (zip-file) including only the sources of your program and the makefile.
All necessary tools are available on the machines in the main computer pools.
(a) Write a program that takes two command line integer parameters. The program calculates the
greatest common divisor of these two integers. Then, it prints the result five times in the console
using a loop. E.g., if the input is 25 and 15, the output is 5, 5, 5, 5, 5.
The name of the binary has to be gcd. The implementation of gcd should be in a separate
method (not in main). The printing of the result in the console should not be within the
gcd method. Create a makefile such that you can use make to build your program instead of
invoking the compiler manually. (3 points)
(b) Implement a program called my_duplicator which reads the first 50 bytes from a text file
input_text.txt, prints them on a console, and writes each of them twice into a file
duplicated_text.txt. For an input_text.txt file containing wasd the output file
duplicated_text.txt should contain wwaassdd. If the duplicated_text.txt file does not
exist, it should be created, otherwise it should be overwritten.
The required syscalls are open, close, read, and write (use only these). See the man pages
for examples on how to use these syscalls. Use a makefile for your project and include a clean
target which deletes the output file, any object files, and the executable. (5 points)

Page 2

You might also like