Computer Systems – Week 5
Additional Exercises
• Question #1: What is an operating system?
An operating system is a type of software that is a combination of data and programs that manages
your whole computer. It is the link between the hardware and the software and ensures the different
aspects of the computer work well together and can run together.
• Question #2: Give examples of how we use an operating system in our daily routine?
An operating system acts as the middle man between your hardware and your software. If you are
typing on a keyboard for example, which is external hardware, it is your operating system that is making
sure the words appear on the screen and then the document, which is software, and is saved to the hard
drive, which is hardware again. You will then use your mouse to search through your document and
retrieve any work you wish to edit or re-read.
• Question #3: What are popular examples of operating systems?
The main one is Microsoft Windows, but Android, iOS, Linux and Mac OS X are becoming
increasingly popular. Microsoft Windows is what the majority of people will have on their home PCs
and laptops. It is what most people are familiar with and it is user friendly. Mac OS X is used on Apple
computers and is regarded very highly, although it can be fiddly for people using it for the first time.
Android is used in mobile phones other than the iPhone and Linux is known to be extremely fast and
runs the 10 fastest supercomputers in the world.
• Question #4: Why do we need an operating system?
An operating system performs a number of useful tasks for you. It provides drivers for your
hardware. It manages file systems. It allows multiple programs to share the system and interact. It loads
programs from various media and runs them.
You don’t need an operating system just like you don’t need transport to get around. You can walk
everywhere. You might find walking doesn’t suit you when you have to go a long way. In the same way,
programmers could do without an operating system, but then they would have to write all of the code to
make the peripherals work and other jobs the OS does.
One of the jobs of an OS is to hide the details of how particular devices work. For example, mass
storage could be handled by a network server, a hard disk, or a USB drive. The OS presents generic
access to these devices as files and folders allowing operations like load, save, rename, and delete.
• Question #5: How does the distinction between kernel mode and user mode function as a
rudimentary form of protection (security) system?
The distinction between kernel mode and user mode provides a rudimentary form of protection in the
following manner. Certain instructions could be executed only when the CPU is in kernel mode.
Similarly, hardware devices could be accessed only when the program is executing in kernel mode.
Control over when interrupts could be enabled or disabled is also possible only when the CPU is in kernel
mode. Consequently, the CPU has very limited capability when executing in user mode, there by
enforcing protection of critical resources.
• Question #6: Which of the following instructions should be privileged?
a) Set value of timer.
b) Read the clock.
c) Clear memory.
d) Issue a trap instruction.
e) Turn off interrupts.
f) Modify entries in device-status table.
g) Switch from user to kernel mode.
h) Access I/O device.
The following operations need to be privileged: a) Set value of timer, c) Clear memory, e) Turn
off interrupts, f) Modify entries in device-status table, h) Access I/O device. The rest can be
performed in user mode.
• Question #7: We have stressed the need for an operating system to make efficient use of the
computing hardware. When is it appropriate for the operating system to forsake this principle and
to “waste” resources? Why is such a system not really wasteful?
Single-user systems should maximize use of the system for the user. A GUI might “waste” CPU
cycles, but it optimizes the user’s interaction with the system.
• Question #8: What are the main differences between Batch operating systems and personal
computers operating systems?
Generally, operating systems for Batch systems have simpler requirements than for personal
computers. Batch systems do not have to be concerned with interacting with a user as much as a personal
computer. As a result, an operating system for a PC must be concerned with response time for an
interactive user. Batch systems do not have such requirements.
• Question #9: What is the difference between device drivers and device controllers?
A device driver is a computer program that operates or controls a particular type of device that is
attached to a computer. A driver provides a software interface to hardware devices, enabling operating
systems and other computer programs to access hardware functions without needing to know precise
details about the hardware being used.
• Question #10: Suppose that the processor has access to two levels of memory. Level 1 contains
1000 bytes and has an access time of 0.1µs; level 2 contains 100,000 bytes and has an access time
of 1µs. Assume that if a byte to be accessed is in level 1, then the processor accesses it directly.
If it is in level 2, then the byte is first transferred to level 1 and then accessed by the processor.
For simplicity, we ignore the time required for the processor to determine whether the byte is in
level 1 or level 2. Such a two level memory can be shown as in figure below:
We can define hit-ratio H, as the fraction of all memory accesses that are found in the faster memory
e.g. the cache memory. T1 is the access time to level 1 (cache) and T2 is the access time to level 2 (main
memory). Now suppose 95% of the memory accesses are found in the cache (H=0.95). Then what would
be the average time to access a byte from such a two-level memory sub-system? Hint, the graph below
shows the average access time to a two-level memory as a function of the hit-ratio H.
The above figure shows the average access time to a two-level memory as a function of the hit-ratio H.
H x T1 + (1 – H) x (T1 + T2)
0.95 x 0.1µs + 0.05 x (0.1µs + 1µs) = 0.095 + 0.055 = 0.15µs