Professional Documents
Culture Documents
Faculty of Engineering
Computer and Systems Engineering
Fall 2014
Homework 1
CS333: Operating Systems
Assigned: October 18, 2014
Due: October 29, 2014
Solution:
User visible registers: available to OS and user programs. used to hold data, addresses,
conditions.
Control and status registers: available to OS and not user programs. used to control
the processor operation or by the OS to manage process execution. Example: PC.
Solution: Interrupts is a mechanism by which other modules (I/O, memory) may interrupt
the normal sequencing of the processor.
The two approaches to deal with interrupts are as follows:
Disabling interrupts while an interrupt is being processed. A disabled interrupt simply means that the processor ignores any new interrupt request signal. If an interrupt
occurs during this time, it generally remains pending and will be checked by the processor after the processor has reenabled interrupts.
Define priorities for interrupts and to allow an interrupt of higher priority to cause a
lower-priority interrupt handler to be interrupted.
Solution:
Convenience: An OS makes a computer more convenient to use.
Efficiency: An OS allows the computer system resources to be used in an efficient manner.
Ability to evolve: An OS should be constructed in such a way as to permit the effective
development, testing, and introduction of new system functions with- out interfering
with service.
1 of 5
4. In a multiprogramming and time-sharing environment, several users share the system simultaneously. List two security problems that can occur in these environments.
Solution:
Confidentiality: Assures that users cannot read data for which access is unauthorized.
For example, reading (stealing) other process data or files.
Data integrity: Protection of data from unauthorized modification. For example, a process should not modify the code for another process.
Solution:
Batch. Jobs are are grouped (batched) together sequentially and submitted to the computer. Each program is constructed to branch back to the monitor (operating system)
when it completes processing, at which point the monitor automatically begins loading
the next program. Utilization of the processor is expected to improve.
Interactive. User input is required to complete these jobs. The requirement for an interactive computing facility can be, and often is, met by the use of a dedicated personal
computer or workstation.
Time-sharing. At regular time intervals, the current user (process/job) would be preempted and another user (process/job) loaded in.
Distributed. Multiple independent machines (shared nothing) cooperate to finish a
computation.
Real-time. A fast response time (or within a prespecified short time interval) is required
for user queries.
2 of 5
3 of 5
10. Explain the distinction between a real address and a virtual address.
Solution: A real address is the physical or actual address of a memory location. Virtual
memory is a facility that allows programs to address memory from a logical point of view,
without regard to the amount of main memory physically available. Therefore, a virtual
address is a logical address that needs to be mapped to a physical address.
Solution: Processes that are ready for execution will be given equal time on the processor in
turn.
12. Explain the difference between a monolithic kernel and a microkernel.
Solution: In a monolithic kernel, most of the OS functionality is provided in one large kernel
(one process with all its functions sharing the same address space). The OS functionality include scheduling, file system, networking, device drivers, memory management, and more.
A microkernel architecture assigns only a few essential functions to the kernel, including address spaces, interprocess communication (IPC), and basic scheduling. Other OS services are
provided by processes.
Solution:
Privileged instructions: Set value of timer, Clear memory, Turn off interrupts, Switch
from user to kernel mode, Access I/O device.
Non privileged instructions: Read the clock.
4 of 5
14. An I/O-bound program is one that, if run alone, would spend more time waiting for I/O than using the processor. A processor-bound program is the opposite. Suppose a short-term scheduling
algorithm favors those programs that have used little processor time in the recent past. Explain
why this algorithm favors I/O-bound programs and yet does not permanently deny processor
time to processor-bound programs.
Solution: A typical trace of an I/O bound program will show execution of few instructions
and then a long waiting for I/O devices. The described scheduling algorithm will favor
I/O bound programs because they use the processor less and therefore they will be chosen
first. However, since the blocking time is long, most of the I/O bound programs can all be
in the blocked state, and hence a chance is given for processor-bound programs to seize the
processor.
15. What is the purpose of system calls, and how do system calls relate to the OS and to the concept
of dual-mode (kernel-mode and user-mode) operation?
Solution: The system call is the means by which a process requests a specific kernel service.
A process runs in user mode, if an operation is privileged, a system call is made, and a switch
to kernel (system) mode is made.
5 of 5