(Latest Revision:
April 26, 2021
)
Study Question Answers
Homework Assignment #1
Chapter #01 -- Introduction
- Question (#1) on Chapter #1:
Write 500 words or more describing the interplay between operating system
software and the interrupt mechanism. In your writing show that you
understand A) how interrupts "drive" the actions of the operating system,
and B) how the interrupt mechanism in a modern computing system actually
works (what hardware devices do to cause an interrupt and the sequence of
events that take place between the time that the currently running
program is interrupted and the time that program resumes
execution).
- Answer Ideas:
The essay could touch on some of these points:
- Operating system code does not execute continually. It executes only
when it is needed. After the boot sequence, the only thing that ever
causes OS code to execute is a software interrupt (trap) or a
hardware interrupt. That is why we say that the OS is
interrupt driven.
- In a modern operating system, a user process that needs to do I/O
makes a system call to request service from the OS. Typically it
does this by first placing parameters in locations where the OS will
be able to find them, and then executing a special system call
instruction that has the effect of interrupting the CPU.
- The interrupt causes a series of switches in the CPU to fire off.
The effect is to preserve context of the current process and then
cause the CPU to jump to operating system code for servicing the I/O
request.
- Typically the OS suspends the process P that requested the I/O. It
does this by inserting P's process control block (PCB) in a
wait-queue associated with the device that has to perform the I/O for
P.
- If the device is not busy, the OS requests an I/O operation, in
behalf of one of the processes in the wait-queue (which could be the
process P that just made the system call). Typically the OS makes
the request by writing values into registers within the controller of
the device and then triggering the start of the operation by sending
a signal on a control line of the system bus.
- After the OS makes an I/O request, the controller acts independently
of the OS until the I/O operation has completed.
- After putting P in the device queue and (possibly) making an I/O
request to the controller, the OS may take care of some system tasks
that need doing. Eventually the OS checks to see if the ready queue
is empty. If not, it schedules a process to run and dispatches it to
the CPU. If no processes are ready, the OS may do more system tasks,
or even execute a 'busy loop' temporarily, until a hardware interrupt
comes in.
- After a device controller completes an I/O operation, it interrupts
the CPU. The effect of this kind of (hardware) interrupt is
basically the same as that of the system-call interrupt (trap)
described above. After preserving some context of the current
process, the CPU jumps into OS code for servicing the interrupt.
- In response to the interrupt, the OS may need to copy data from a
buffer in the controller to a buffer in primary memory owned by the
process P that requested the I/O.
- At that point P is probably ready to run, in which case the OS moves
it from the I/O wait-queue to the ready queue. Once in the ready
queue P will eventually be scheduled by the OS to run again in the
CPU.
- Typically the OS will then check to see if the wait-queue of the
device is empty. If not, the OS will select a process from the
queue and request the controller to perform its desired I/O
operation.
Homework Assignment #2
Chapter #02 -- Operating Systems Structures
- Question #1 on Chapter #2:
Using information gleaned from chapters one and two, write 500 words or
more describing the important functions and responsibilities of a modern
multi-user, time-sharing operating system.
- Answer Ideas:
The essay could touch on some of these points:
- Operating systems make for more efficient usage of the hardware -
helping to keep the CPU and I/O processors doing useful work more
often - thus helping make the computer more cost effective - making it
pay for itself.
- An OS makes the system more convenient for the user - for example by
taking over error-prone I/O tasks and providing high level commands
that the bare hardware can not provide.
- The OS provides a collection of services that are needed in common by
all or most programs, and thereby saves all the programmers using the
system from having to write code to perform those services -- which
would be a lot of extra work.
- Operating systems must
- schedule jobs for execution,
- load jobs into memory and set them to running,
- operate all the I/O devices on behalf of user programs,
- perform context switching in a multiprogramming or time-sharing
environment,
- manage memory allocation/deallocation for the various user
processes,
- facilitate the communication and synchronization of concurrent
processes that interact,
- maintain an on-line file system and all the accompanying
structure,
- handle swapping (medium term scheduling),
- do all the copying and memory allocation required by virtual
memory systems,
- help protect users from each other - for example it must prevent
user processes from accessing each other's primary and secondary
memory resources,
- protect OS resources from user processes, and
- protect network server processes from network-based attacks.
- Question #2 on Chapter #2:
Using information from section 2.7 write 250 words or more describing
several different approaches to designing operating system structure.
Discuss the advantages and disadvantages of each approach.
- Answer Ideas:
The essay could touch on some of these points:
- Operating System Structuring
- Some OS's are not very modular
- Some are built in layers to make them more modular.
- Each layer is only allowed to call upon layers beneath it for services.
- layered design facilitates testing.
- It's not easy to design layers so that a lower layer never
has to ask a higher layer for a service.
- Microkernel design puts just a few essential services (say process &
memory management plus process communication) in the kernel and the
rest is pushed to "user-level"
- A recent design innovation involves utilizing dynamically
loadable modules. There is a core kernel module resembling a
micro-kernel. The dynamic modules can communicate directly with
each other through well-defined interfaces.
- With microkernel architecture it becomes fairly easy (if not
maximally efficient) to emulate many different operating systems "on
top of" the microkernel. The idea is to interpret foreign system
calls with microkernel system calls.
###########################################################################
###########################################################################