TSN2101/TOS2111 - Tutorial 2 (Operating System Structures)
TSN2101/TOS2111 - Tutorial 2 (Operating System Structures)
System calls allow user-level processes to request services of the operating system.
2. List five services provided by an operating system, and explain how each creates convenience for users. In
which cases would it be impossible for user-level programs to provide these services? Explain your
answer.
The five main services are, not inclusive of accounting, and protection and security:
Program execution
The operating system loads the contents (or sections) of a file into memory and begins its execution. A
userlevel program could not be trusted to properly allocate CPU time.
I/O operations
Disks, tapes, serial lines, and other devices must be communicated with at a very low level. The user need
only specify the device and the operation to perform on it, while the system converts that request into
device- or controller-specific commands. User-level programs cannot be trusted to access only devices
they should have access to and to access them only when they are otherwise unused.
File-system manipulation
There are many details in file creation, deletion, allocation, and naming that users should not have to
perform.
Blocks of disk space are used by files and must be tracked. Deleting a file requires removing the name file
information and freeing the allocated blocks. Protections must also be checked to assure proper file
access. User programs could neither ensure adherence to protection methods nor be trusted to allocate
only free blocks and deallocate blocks on file deletion.
Communications
Message passing between systems requires messages to be turned into packets of information, sent to
the network controller, transmitted across a communications medium, and reassembled by the
destination system. Packet ordering and data correction must take place. Again, user programs might not
coordinate access to the network device, or they might receive packets destined for other processes.
Error detection
Error detection occurs at both the hardware and software levels. At the hardware level, all data transfers
must be inspected to ensure that data have not been corrupted in transit. All data on media must be
checked to be sure they have not changed since they were written to the media. At the software level,
media must be checked for data consistency; for instance, whether the numbers of allocated and
unallocated blocks of storage match the total number on the device. There, errors are frequently process
independent (for instance, the corruption of data on a disk), so there must be a global program (the
operating system) that handles all types of errors. Also, by having errors processed by the operating
system, processes need not contain code to catch and correct all the errors possible on a system.
System programs can be thought of as bundles of useful system calls. They provide basic functionality to
users so that users do not need to write their own programs to solve common problems.
4. Describe three general methods for passing parameters to the operating system.
5. Would it be possible for the user to develop a new command interpreter using the system-call interface
provided by the operating system?
A user should be able to develop a new command interpreter using the system-call interface provided by
the operating system. The command interpreter allows a user to create and manage processes and also
determine ways by which they communicate (such as through pipes and files). As all of this functionality
could be accessed by a user level program using the system calls, it should be possible for the user to
develop a new command-line interpreter.
6. What is the main advantage of the microkernel approach to system design? How do user programs and
system services interact in a microkernel architecture? What are the disadvantages of using the
microkernel approach?
The modular kernel approach requires subsystems to interact with each other through carefully
constructed interfaces that are typically narrow (in terms of the functionality that is exposed to external
modules). The layered kernel approach is similar in that respect. However, the layered kernel imposes a
strict ordering of subsystems such that subsystems at the lower layers are not allowed to invoke
operations corresponding to the upper-layer subsystems. There are no such restrictions in the modular-
kernel approach, wherein modules are free to invoke each other without any constraints.
8. What is the relationship between a guest operating system and a host operating system in a system like
VMware? What factors need to be considered in choosing the host operating system?
A guest operating system provides its services by mapping them onto the functionality provided by the
host operating system. A key issue that needs to be considered in choosing the host operating system is
whether it is sufficiently general in terms of its system-call interface in order to be able to support the
functionality associated with the guest operating system.
References:
• Abraham Silberschatz, Peter Baer Galvin, Greg Gagne, “Operating System Concepts”, 9/E, John Wiley &
Sons, 2013.