Engine 2018
Engine 2018
Engine 2018
Kasinge
Nota bene:
This compilation contains only questions with 99% probability of appearance in the exam
If you want to score 100%, look for the missing questions in other reliable sources
Credit to paul@shaotz, rehema@h.mwawado, lilian@mkonyi, and angelica@kayanda
In general terms, what are the four distinct actions that a machine instruction can specify?
Processor-memory: Data may be transferred from processor to memory or from memory to
processor.
Processor-I/O: Data may be transferred to or from a peripheral device by transferring
between the processor and an I/O module.
Data processing: The processor may perform some arithmetic or logic operation on data.
Control: An instruction may specify that the sequence of execution be altered.
1
Compiled by S.O.M.M. Kasinge
What is an interrupt?
An interrupt is a signal from generated from within the currently executing program or other
modules (I/O, memory) which disrupt the normal sequencing of the processor. It is a signal that
prompts the operating system to stop work on one process and start work on another. When an
interrupt occurs, control is transferred to the operating system, which determines the action to
be taken.
2
Compiled by S.O.M.M. Kasinge
Give two reasons why caches are useful. What problems do they solve? What problems do they
cause? If a cache can be made as large as the device for which it is caching (for instance, a cache
as large as a disk), why not make it that large and eliminate the device?
Caches are useful when two or more components need to exchange data, and the
components perform transfers at differing speeds.
Caches solve the transfer problem by providing a buffer of intermediate speed between
components. If the fast device finds the data it needs in the cache, it need not wait for the
slower device.
The data in the cache must be kept consistent with the data in the components. If a
component has a data value change, and the datum is also in the cache, the cache must also
be updated. This is especially a problem on multiprocessor systems where more than one
process may be accessing a datum.
A component may be eliminated by an equal-sized cache, but only if:
(a) The cache and the component have equivalent-saving capacity (that is if the component
retains its data when electricity is removed, the cache must retain data as well), and
(b) The cache is affordable, because faster storage tends to be more expensive.
Describe the differences between symmetric and asymmetric multiprocessing. What are three
advantages and one disadvantage of multiprocessor systems?
Symmetric multiprocessing treats all processors as equals, and I/O can be processed on any CPU.
Asymmetric multiprocessing has one master CPU and the remainder CPUs are slaves. The master
distributes tasks among the slaves, and I/O is usually done by the master only.
Multiprocessors can save money by not duplicating power supplies, housings, and peripherals.
They can execute programs more quickly and can have increased reliability. They are also more
complex in both hardware and software than uniprocessor systems.
3
Compiled by S.O.M.M. Kasinge
What is the purpose of interrupts? What are the differences between a trap and an interrupt?
Can traps be generated intentionally by a user program? If so, for what purpose?
An interrupt is a hardware-generated change-of-flow within the system. An interrupt handler is
summoned to deal with the cause of the interrupt; control is then returned to the interrupted
context and instruction. A trap is a software-generated interrupt. An interrupt can be used to
signal the completion of an I/O to obviate the need for device polling. A trap can be used to call
operating system routines or to catch arithmetic errors.
Direct memory access (DMA) is used for high-speed I/O devices in order to avoid increasing the
CPU’s execution load.
a. How does the CPU interface with the device to coordinate the transfer?
b. How does the CPU know when the memory operations are complete?
c. The CPU is allowed to execute other programs while the DMA controller is transferring
data. Does this process interfere with the execution of the user programs? If so, describe what
forms of interference are caused.
The CPU can initiate a DMA operation by writing values into special registers that can be
independently accessed by the device. The device initiates the corresponding operation once it
receives a command from the CPU. When the device is finished with its operation, it interrupts
the CPU to indicate the completion of the operation.
Both the device and the CPU can be accessing memory simultaneously. The memory controller
provides access to the memory bus in a fair manner to these two entities. A CPU might therefore
be unable to issue memory operations at peak speeds since it has to compete with the device in
order to obtain access to the memory bus.
4
Compiled by S.O.M.M. Kasinge
Describe a mechanism for enforcing memory protection in order to prevent a program from
modifying the memory associated with other programs.
The processor could keep track of what locations are associated with each process and limit
access to locations that are outside of a program’s extent. Information regarding the extent of a
program’s memory could be maintained by using base and limits registers and by performing a
check for every memory access.
In virtually all systems that include DMA modules, DMA access to main memory is given higher
priority than processor access to main memory. Why?
If a processor is held up in attempting to read or write memory, usually no damage occurs except
a slight loss of time. However, a DMA transfer may be to or from a device that is receiving or
sending data in a stream (e.g., disk or tape), and cannot be stopped. Thus, if the DMA module is
held up (denied continuing access to main memory), data will be lost.
A computer consists of a CPU and an I/O device D connected to main memory M via a shared
bus with a data bus width of one word. The CPU can execute a maximum of 106 instructions
per second. An average instruction requires five processor cycles, three of which use the
memory bus.
A memory read or write operation uses one processor cycle. Suppose that the CPU is
continuously executing “background” programs that require 95% of its instruction execution
rate but not any I/O instructions.
Assume that one processor cycle equals one bus cycle. Now suppose that very large blocks of
data are to be transferred between M and D.
(a) If programmed I/O is used and each one-word I/O transfer requires the CPU to execute two
instructions, estimate the maximum I/O data transfer rate, in words per second, possible
through D.
(b) Estimate the same rate if DMA transfer is used.
(a) The processor can only devote 5% of its time to I/O. Thus the maximum I/O instruction
execution rate is 106 × 0.05 = 50,000 instructions/second. The I/O transfer rate is therefore
25,000 words/second.
(b) The number of machine cycles available for DMA control is 10^6 × (0.05 × 5 + 0.95 × 2) =
2.15 × 10^6.
5
Compiled by S.O.M.M. Kasinge
What is multiprogramming?
When one job needs to wait for I/O, the processor can switch to the other job which is likely not
waiting for I/O, to ensure fully utilization of processor.
What is a process?
A process is a program in execution. It is an instance of a program running on a computer. It is
the entity that can be assigned to and executed on a processor. A unit of activity characterized
by a single sequential thread of execution, a current state, and an associated set of system
resources.
6
Compiled by S.O.M.M. Kasinge
Explain the distinction between the real address and a virtual address.
A logical address is a reference to a memory location independent of the current assignment of
data to memory. It is a combination of page number and an offset within a page. A translation
must be made to a physical address before the memory access can be achieved.
A physical address, or absolute address, is an actual location in main memory.
7
Compiled by S.O.M.M. Kasinge
A microkernel architecture assigns only a few essential functions to the kernel, including address
spaces, inter-process communication (IPC), and basic scheduling. Other OS services are provided
by processes, sometimes called servers that run in user mode and are treated like any other
application by the microkernel.
What is multithreading?
Multithreading is a technique in which a process, executing an application, is divided into threads
that can run concurrently.
What are five major activities of an operating system with regard to process management?
Creating and Deleting of processes: Some of the processes on your computer may run for
short periods of time, with others running continuously over longer periods. The operating
system manages the creation and deletion of all running processes.
Suspending and Resuming of processes: Although the processes on a computer may appear
to be running continuously, they will often enter paused states for short periods of time. If a
process is not currently executing, for example, if it is waiting for an input or output operation
to complete it may be suspended
A mechanism for process synchronization: A computer has a finite range of processing
resources that must be shared between all running processes. The operating system carries
out process synchronization to keep any running programs functional and available for user
interaction.
A mechanism for process communication: In order to keep the running processes
synchronized and receiving the necessary resources, the operating system must be able to
communicate with the processes.
A mechanism for deadlock handling: When a number of running processes are all in a paused
state, each one waiting for resources currently being used by another running process,
deadlock can occur. The operating system can take steps both to avoid and end deadlock
should it occur.
What are three major activities of an operating system with regard to memory management?
Keep track of which part of memory are currently being used and by whom.
Decide which process are loaded into memory when memory space becomes available.
Allocate and deallocate memory space as needed.
8
Compiled by S.O.M.M. Kasinge
What are three major activities of an operating system with regard to secondary-storage
management?
Managing the free space available on the secondary-storage device.
Allocation of storage space when new files have to be written.
Disk scheduling requests for memory access.
What are five major activities of an operating system with regard to file management?
The creation and deletion of files.
The creation and deletion of directions.
The support of primitives for manipulating files and directions.
The mapping of files onto secondary storage.
The backup of files on stable storage media.
What is the purpose of the command interpreter? Why is it usually separate from the kernel?
Command interpreter is an interface of the operating system with the user. It reads commands
from the user or from a file of commands and executes them, usually by turning them into one
or more system calls. It is usually not part of the kernel since multiple command interpreters
(shell, in UNIX terminology) may be supported by an operating system, and they do not really
need to run in kernel mode. Hence the command interpreter is subject to changes.
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.
Program execution: The operating system loads the contents (or sections) of a file into
memory and begins its execution. A user-level 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.
9
Compiled by S.O.M.M. Kasinge
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?
Benefits typically include the following: (a) adding a new service does not require modifying the
kernel, (b) it is more secure as more operations are done in user mode than in kernel mode, and
(c) a simpler kernel design and functionality typically results in a more reliable operating system.
User programs and system services interact in a microkernel architecture by using interprocess
communication mechanisms such as messaging. These messages are conveyed by the operating
system.
The primary disadvantages of the microkernel architecture are the overheads associated with
interprocess communication and the frequent use of the operating system’s messaging functions
in order to enable the user process and the system service to interact with each other.
What are the advantages and disadvantages of using the same system call interface for
manipulating both files and devices?
Advantages: Each device can be accessed as though it was a file in the file system. Since most of
the kernel deals with devices through this file interface, it is easy to add a new device driver by
implementing the hardware-specific code to support this abstract file interface. This benefits the
development of both user program code, which can be written to access devices and files in the
same manner, and device-driver code, which can be written to support a well-defined API.
The disadvantage is that it might be difficult to capture the functionality of certain devices within
the context of the file access API, thereby resulting in either loss of functionality or a loss of
performance. Some of this could be overcome by the use of the ioctl operation that provides a
general purpose interface for processes to invoke operations on devices.
10
Compiled by S.O.M.M. Kasinge
Would it be possible for the user 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). 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.
What are the two models of inter-process communication? What are the strengths and
weaknesses of the two approaches?
Shared memory: Reading and writing data to a shared memory.
Strength Is faster than message passing model when the processes are on the same machine
because message passing model requires more system calls.
Weakness: Different processes need to ensure that they are not writing to the same location
simultaneously.
Message passing: Messages are exchanged between the cooperating processes.
Strength: Easier to implement than shared memory model.
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. Explain why this algorithm does
not permanently deny processor time to processor-bound programs.
The algorithm favors I/O bound processes because these will be much less likely to have used the
processor recently. As soon as they are done with an I/O burst, they will get to execute on the
processor.
This algorithm does not permanently deny processor time to processor-bound programs,
because once they have been prevented from using the processor for some time they will be
favored by the scheduling algorithm
11
Compiled by S.O.M.M. Kasinge
12
Compiled by S.O.M.M. Kasinge
For what types of entities does the OS maintain tables of information for management
purposes?
Memory tables are used to keep track of both main (real) and secondary (virtual) memory.
Some of main memory is reserved for use by the OS; the remainder is available for use by
processes.
I/O tables: Used by the OS to manage the I/O devices and channels of the computer.
File tables: These tables provide information about existence of files, location on secondary
memory and current Status
Process tables: To manage processes the OS needs to know details of the processes current
state, process ID, location in memory.
13
Compiled by S.O.M.M. Kasinge
14
Compiled by S.O.M.M. Kasinge
List reasons why a mode switch between threads may be cheaper than a mode switch between
processes.
Switching process requires OS to process more information.
Memory is shared by threads, so there's no need to exchange memory or data during thread
creation or switching. Thread switching does not require kernel to get involved, which in turn
saves time on switching user to kernel mode
What are the two separate and potentially independent characteristics embodied in the
concept of process?
Resource ownership: A process includes a virtual address space to hold the process image. From
time to time, a process may be allocated control or ownership of resources, such as main
memory, I/O channels, I/O devices, and files. The OS performs a protection function to prevent
unwanted interference between processes with respect to resources.
Scheduling/execution: The execution of a process follows an execution path (trace) through one
or more programs. This execution may be interleaved with that of other processes. Thus, a
process has an execution state (Running, Ready, etc.) and a dispatching priority and is the entity
that is scheduled and dispatched by the OS.
Give four general examples of the use of threads in a single-user multiprocessing system.
Foreground and background work: For example, in a spreadsheet program, one thread could
display menus and read user input, while another thread executes user commands and
updates the spreadsheet. This arrangement often increases the perceived speed of the
application by allowing the program to prompt for the next command before the previous
command is complete.
Asynchronous processing: Asynchronous elements in the program can be implemented as
threads. For example, as a protection against power failure, one can design a word processor
to write its random access memory (RAM) buffer to disk once every minute. A thread can be
created whose sole job is periodic backup and that schedules itself directly with the OS; there
is no need for fancy code in the main program to provide for time checks or to coordinate
input and output.
Speed of execution: A multithreaded process can compute one batch of data while reading
the next batch from a device. On a multiprocessor system, multiple threads from the same
process may be able to execute simultaneously. Thus, even though one thread may be
blocked for an I/O operation to read in a batch of data, another thread may be executing.
15
Compiled by S.O.M.M. Kasinge
16
Compiled by S.O.M.M. Kasinge
Give examples of services and functions found in a typical monolithic OS that may be external
subsystems to a microkernel OS
Device drivers,
File systems,
Virtual memory manager,
Windowing system,
Security services.
List and briefly explain seven potential advantages of a microkernel design compared to a
monolithic design.
Uniform interfaces: processes need not distinguish between kernel-level and user-level
services because all such services are provided by means of message passing.
Extensibility: Allowing the addition of new services as well as the provision of multiple
services in the same functional area.
Flexibility: Not only can new features be added to the operating system, but existing features
can be subtracted to produce a smaller, more efficient implementation.
Portability: All or least much of the processor-specific code is in the microkernel. Changes
needed to port the system to a new processor are fewer and tend to be arranged in logical
groupings.
Reliability: A small microkernel can be rigorously tested. Its use of a small number of
application programming interfaces (APIs) improves the chance of producing quality code for
the operating system services outside the kernel
17
Compiled by S.O.M.M. Kasinge
Distributed system support: Message are sent without knowing what the target machine is
Object-oriented operating system: Components are objects with clearly defined interfaces
that can be interconnected to form software
List three functions you would expect to find even in a minimal microkernel OS.
Low-level memory management,
Inter-process communication (IPC), and
I/O and interrupt management
What is the basic form of communications between processes or threads in a microkernel OS?
Message
List three degrees of awareness between processes and briefly define each.
Processes unaware of each other: These are independent processes that are not intended to
work together. Although the processes are not working together, the OS needs to be
concerned about competition for resources. For example, two independent applications may
both want access the same disk or file or printer. The OS must regulate these accesses.
Process indirectly ware of each other: These are processes that are not necessarily aware of
each other by their respective process IDs but that share access to some object, such as an
I/O buffer. Such processes exhibit cooperation in sharing the common object.
Processes directly aware of each other: These are processes that are able to communicate
with each other by process ID and that are designed to work jointly on some activity. Again,
such processes exhibit cooperation
18
Compiled by S.O.M.M. Kasinge
List the three control problems associated with competing processes and briefly define each.
Mutual exclusion: Suppose two or more processes require access to a single non-sharable
resource, such as a printer. During the course of execution, each process will be sending
commands to the I/O device, receiving status information, sending data, and/or receiving data.
We will refer to such a resource as a critical resource, and the portion of the program that uses
it a critical section of the program. It is important that only one program at a time be allowed in
its critical section.
Deadlock: For example, consider two processes, P1 and P2, and two resources, R1 and R2.
Suppose that each process needs access to both resources to perform part of its function. Then
it is possible to have the following situation: the OS assigns R1 to P2, and R2 to P1. Each process
is waiting for one of the two resources. Neither will release the resource that it already owns
until it has acquired the other resource and performed the function requiring both resources.
Starvation: The OS may grant access to resources to a number of processes while neglecting
another
19
Compiled by S.O.M.M. Kasinge
When no process is in a critical section, any process that requests entry to its critical section
must be permitted to enter without delay.
No assumptions are made about relative process speeds or number of processors.
A process remains inside its critical section for a finite time only.
Explain why Windows, Linux, and Solaris implement multiple locking mechanisms. Describe the
circumstances under which they use spinlocks, mutex locks, semaphores, adaptive mutex
locks, and condition variables. In each case, explain why the mechanism is needed.
These operating systems provide different locking mechanisms depending on the application
developers’ needs. Spinlocks are useful for multiprocessor systems where a thread can run in a
busy-loop (for a short period of time) rather than incurring the overhead of being put in a sleep
queue. Mutexes are useful for locking resources. Solaris 2 uses Adaptive mutexes, meaning that
the mutex is implemented with a spin lock on multiprocessor machines. Semaphores and
condition variables are more appropriate tools for synchronization when a resource must be held
for a long period of time, since spinning is inefficient for a long duration
What is the meaning of the term busy waiting? What other kinds of waiting are there in an
operating system? Can busy waiting be avoided altogether? Explain your answer.
Busy waiting means that a process is waiting for a condition to be satisfied in a tight loop without
relinquishing the processor. Alternatively, a process could wait by relinquishing the processor,
and block on a condition and wait to be awakened at some appropriate time in the future.
Busy waiting can be avoided but incurs the overhead associated with putting a process to sleep
and having to wake it up when the appropriate program state is reached
20
Compiled by S.O.M.M. Kasinge
The Linux kernel has a policy that a process cannot hold a spinlock while attempting to acquire
a semaphore. Explain why this policy is in place.
You cannot hold a spin lock while you acquire a semaphore, because you might have to sleep
while waiting for the semaphore, and you cannot sleep while holding a spin lock
What is the difference between strong and weak semaphores?
A strong semaphore includes FIFO policy to remove processes from the queue, such that the
process that has been blocked the longest is released from the queue first.
A semaphore that does not specify the order in which processes are removed from the queue is
a weak semaphore.
What is a monitor?
Is a programming language construct that encapsulates variables, access procedures and
initialization code within an abstract data type. The monitor’s variable may only be accessed via
its access procedures and only one process may be actively accessing the monitor at any one
time. The monitor is a programming-language construct that provides equivalent functionality to
that of semaphores and that is easier to control. They both provide mechanism for enforcing
mutual exclusion and for coordinating processes.
What is the distinction between blocking and nonblocking with respect to messages?
Blocking send, blocking receive: Both the sender and receiver are blocked until the message is
delivered; this is sometimes referred to as a rendezvous. This combination allows for tight
synchronization between processes.
Nonblocking send, blocking receive: Although the sender may continue on, the receiver is
blocked until the requested message arrives. This is probably the most useful combination. It
allows a process to send one or more messages to a variety of destinations as quickly as possible.
A process that must receive a message before it can do useful work needs to be blocked until
such a message arrives. An example is a server process that exists to provide a service or resource
to other processes.
Nonblocking send, nonblocking receive: Neither party is required to wait.
21
Compiled by S.O.M.M. Kasinge
What are the three conditions that must be present for deadlock to be possible?
In order for deadlock to be possible, the following three conditions must be present in the
computer:
Mutual exclusion: only one process may use a resource at a time
Hold-and-wait: a process may hold allocated resources while awaiting assignment of others
No preemption: no resource can be forcibly removed from a process holding it
22
Compiled by S.O.M.M. Kasinge
List three examples of deadlocks that are not related to a computer system environment.
Two cars crossing a single-lane bridge from opposite directions.
A person going down a ladder while another person is climbing up the ladder.
Two trains traveling toward each other on the same track.
Two carpenters who must pound nails. There is a single hammer and a single bucket of nails.
Deadlock occurs if one carpenter has the hammer and the other carpenter has the nails.
Can a system detect that some of its processes are starving? If you answer “yes,” explain how
it can. If you answer “no,” explain how the system can deal with the starvation problem.
23
Compiled by S.O.M.M. Kasinge
For the purposes of this question, we will define starvation as the situation whereby a process
must wait beyond a reasonable period of time T, perhaps indefinitely before receiving a
requested resource. One way of detecting starvation would be to first identify a period of time
that is considered unreasonable. When a process requests a resource, a timer is started. If the
elapsed time exceeds T, then the process is considered to be starved.
One strategy for dealing with starvation would be to adopt a policy where resources are assigned
only to the process that has been waiting the longest.
MEMORY MANAGEMENT:
What requirements memory management required to satisfy?
Relocation - A process that has been swapped out to a disk can be moved to a different
memory location than the one it was in previously.
Protection - Each process should be protected from unwanted interference by other
processes, so programs in other processes should not be able to reference memory locations
in a process for reading or writing purposes without permission; satisfied by the processor
(hardware)
Sharing - Allowing several processes to access the same portion of main memory. Memory
management system must allow controlled access to shared areas of memory without
compromising essential protection
Logical organization - Enabling the OS and computer hardware to deal with user programs
and data in the form of modules of some sort
Physical organization - The organization of the flow of information between main and
secondary memory
24
Compiled by S.O.M.M. Kasinge
What are some reasons to allow two or more processes to all have access to a particular region
of memory?
If a number of processes are executing the same program, it is advantageous to allow each
process to access the same copy of the program rather than have its own copy. Processes that
are cooperating on some task may need to share access to the same data structure.
In fixed partitioning scheme, what are the advantages of using un-equal sized partition
scheme?
Processes are assigned in such a way as to minimize wasted memory within a partition (internal
fragmentation). Larger programs can be accommodated without overlay.
25
Compiled by S.O.M.M. Kasinge
VIRTUAL MEMORY
What is the difference between simple paging and virtual memory paging?
Both are memory management (partitioning) techniques.
Simple Paging: Main memory is divided into a number of equal-size frames. Each process is
divided into a number of equal-size pages of the same length as frames. A process is loaded by
loading all of its pages into available, not necessarily contiguous, frames.
Virtual Memory Paging: As with simple paging, except that it is not necessary to load all of the
pages of a process. Nonresident pages that are needed are brought in later automatically.
Explain Thrashing.
Thrashing is when the system spends most of its time swapping pieces of a process rather than
executing instructions. To overcome this, the OS essentially guesses which pieces are least likely
to be used in the near future, based on recent history, and will swap those out of main memory.
26
Compiled by S.O.M.M. Kasinge
of time. This also means that it should be possible to make intelligent guesses about which pieces
of a process will be needed in the near future, which avoids thrashing. These two things mean
that virtual memory is an applicable concept and that it is worth implementing.
What elements are typically found in a page table entry? Briefly define each element.
Frame number: Which contains the frame number of the corresponding page in main
memory
A present (P) bit: Which indicates whether the corresponding page is in main memory or not.
A modify (M) bit: Which indicates whether the contents of the corresponding page have been
altered since the page was last loaded into main memory.
What is the difference between resident set management and page replacement policy?
Resident set management - how many page frames are to be allocated to each active process,
and whether the set of pages to be considered for replacement should be limited to those of the
process that caused the page fault or encompass all the page frames in main memory.
Replacement policy - Among the set of pages considered, which particular page should be
selected for replacement.
27
Compiled by S.O.M.M. Kasinge
What is the relationship between FIFO and Clock page replacement algorithms?
Both treat the page frames allocated to a process as a circular buffer, with which a pointer is
associated.
Why is it not possible to combine a global replacement policy and a fixed allocation policy?
A fixed allocation policy gives a process a fixed number of frames in main memory. This number
is decided at initial load time (process creation time). In this policy, when a page fault occurs in
the execution of a process, one of the pages of that process must be replaced.
A global replacement policy considers all unlocked pages in main memory as candidates for
replacement, regardless of which process owns a particular page.
28
Compiled by S.O.M.M. Kasinge
Under what circumstances do page faults occur? Describe the actions taken by the operating
system when a page fault occurs.
A page fault occurs when an access to a page that has not been brought into main memory takes
place. The operating system verifies the memory access, aborting the program if it is invalid. If it
is valid, a free frame is located and I/O is requested to read the needed page into the free frame.
Upon completion of I/O, the process table and page table are updated and the instruction is
restarted.
UNIPROCESSOR SCHEDULING
29
Compiled by S.O.M.M. Kasinge
Response time is the time from the submission of a request until the response begins to be
received. Often a process can begin producing some output to the user while continuing to
process the request Thus, this is a better measure than turnaround time from the user's point of
view.
For process scheduling, does a low-priority value represent a low priority or a high priority?
In UNIX and many other systems, lower priority values represent higher priority processes.
30
Compiled by S.O.M.M. Kasinge
31
Compiled by S.O.M.M. Kasinge
Preemptive smallest number of threads first - Highest priority is given to jobs with the
smallest number of unscheduled threads. An arriving job with a smaller number of threads
than an executing job will preempt threads belonging to the scheduled job.
List and briefly define five general areas of requirements for a real-time Operating System.
Determinism - An OS is deterministic to the extent that it performs operations at fixed,
predetermined times or within predetermined time intervals.
Responsiveness - Concerned with how long, after acknowledgment, it takes an OS to service
an interrupt. Responsiveness includes amount of time to begin execution of the interrupt and
amount of time to perform the interrupt.
User control - In a real-time system, it is essential to allow the user fine-grained control over
task priority. The user should be able to distinguish between hard and soft tasks and to specify
relative priorities within each class.
Reliability - Loss or degradation of performance in a real-time system can have catastrophic
consequences, because a real-time system is responding to and controlling events in real
time.
Fail-soft operation - refers to the ability of a system to fail in such a way as to preserve as
much capability and data as possible.
32
Compiled by S.O.M.M. Kasinge
33
Compiled by S.O.M.M. Kasinge
What is the difference between block-oriented devices and stream-oriented devices? Give a
few examples of each.
A block-oriented device stores info in blocks that are usually of fixed size, and transfers are made
one block at a time. Generally, it is possible to reference data by its block number. Disks and USB
keys are examples of these devices.
A stream-oriented device transfers data in and out as a stream of bytes, with no block structure.
Terminals, printers, mouse and other pointing devices, and most other devices that are not
secondary storage are stream oriented.
How does DMA increase system concurrency? How does it complicate hardware design?
DMA increases system concurrency by allowing the CPU to perform tasks while the DMA system
transfers data via the system and memory buses. Hardware design is complicated because the
DMA controller must be integrated into the system and the system must allow the DMA
controller to be a bus master. Cycle stealing may also be necessary to allow the CPU and DMA
controller to share use of the memory bus.
Why would you expect improved performance using a double buffer rather than a single buffer
for I/O?
Because a process is now transferring data to (or from) one buffer while the OS empties (or fills)
the other.
When multiple interrupts from different devices appear at about the same time, a priority
scheme could be used to determine the order in which the interrupts would be serviced.
Discuss what issues need to be considered in assigning priorities to different interrupts.
A number of issues need to be considered in order to determine the priority scheme. Interrupts
raised by devices should be given higher priority than traps generated by the user program; a
device interrupt can therefore interrupt code used for handling system calls.
34
Compiled by S.O.M.M. Kasinge
Second, interrupts that control devices might be given higher priority than interrupts that simply
perform tasks such as copying data served up a device to user/kernel buffers, since such tasks
can always be delayed.
Third, devices that have realtime constraints on when its data is handled should be given higher
priority than other devices. Also, devices that do not have any form of buffering for its data would
have to be assigned higher priority since the data could be available only for a short period of
time.
FILE MANAGEMENT
What is the difference between a field and a record?
A field is the basic element of data. An individual field contains a single value, such as a last name.
A record is a collection of related fields that can be treated as a unit by some application program.
35
Compiled by S.O.M.M. Kasinge
Why is the average search time to find a record in a file less for an indexed sequential file than
for a sequential file?
The index provides a lookup capability to reach quickly the vicinity of a desired record, something
the sequential file does not have.
36
Compiled by S.O.M.M. Kasinge
What are typical access rights that may be granted or denied to a particular user for a particular
file?
None: User may not even know of the files existence
Knowledge: User can only determine that the file exists and who its owner is
Execution: The user can load and execute a program but cannot copy it.
Reading: The user can read the file for any purpose, including copying and execution.
Appending: The user can add data to the file but cannot modify or delete any of the file’s
contents
Updating: The user can modify, delete, and add to the file’s data.
Changing protection: User can change access rights granted to other users
Deletion: User can delete the file.
37
Compiled by S.O.M.M. Kasinge
entry for each portion allocated to the file. Allocation is on the basis of either fixed-size blocks
or variable-size portions.
38
Compiled by S.O.M.M. Kasinge
COMPUTER SECURITY
39
Compiled by S.O.M.M. Kasinge
40
Compiled by S.O.M.M. Kasinge
Explain the difference between a simple memory card and a smart card.
Memory cards can only store store but not process data. Smart cards can process data and store
it, they contain an entire microprocessor, including processor, memory, and I/O ports.
List and briefly describe the principle physical characteristics used for biometric identification.
Facial: Define characteristics based on relative location and shape of key facial features, such as
eyes
Fingerprints: A fingerprint is the pattern of ridges and furrows on the surface of the fingertip.
Fingerprints are believed to be unique across the entire human population.
Hand geometry: Hand geometry systems identify features of the hand, including shape, and
lengths and widths of fingers.
Retinal pattern: The pattern formed by veins beneath the retinal surface is unique and therefore
suitable for identification.
Iris structure: Another unique physical characteristic is the detailed structure of the iris
Signature: Each individual has a unique style of handwriting, and this is reflected especially in the
signature, which is typically a frequently written sequence.
Voice: voice patterns are more closely tied to the physical and anatomical characteristics of the
speaker
41
Compiled by S.O.M.M. Kasinge
Explain the difference between anomaly intrusion detection and signature intrusion detection.
Anomaly approach attempts to define normal behaviors, while signature attempts to define
proper behavior.
What are the main differences between capability lists and access lists?
An access list is a list for each object consisting of the domains with a nonempty set of access
rights for that object. A capability list is a list of objects and the operations allowed on those
objects for each domain.
What is the purpose of using a “salt” along with the user-provided password? Where should
the “salt” be stored, and how should it be used?
When a user creates a password, the system generates a random number (which is the salt) and
appends it to the user-provided password, encrypts the resulting string and stores the encrypted
result and the salt in the password file. When a password check is to be made, the password
42
Compiled by S.O.M.M. Kasinge
presented by the user is first concatenated with the salt and then encrypted before checking for
equality with the stored password. Since the salt is different for different users, a password
cracker cannot check a single candidate password, encrypt it, and check it against all of the
encrypted passwords simultaneously.
What are the two broad categories of defenses against buffer overflows?
Compile-time defenses - harden programs to resist attacks in new programs.
Run time defenses - detect and abort attacks in existing programs.
CLIENT-SERVER COMPUTING
What distinguishes client/server computing from any other form of distributed data
processing?
User has control over timing and style of computer usage
Emphasis on centralizing corporate databases and many network management and utility
functions
Commitment to open and modular systems
Networking is fundamental to the operation
43
Compiled by S.O.M.M. Kasinge
Discuss the rationale for locating applications on the client, the server, or split between client
and server.
You want to optimize the use of resources. Different cases, depending on application needs, the
bulk of application software executes at the server, while in other cases, it executes at the client.
What are fat clients and thin clients, and what are the differences in philosophy of the two
approaches?
Fat client - considerable fraction of the load is on the client. It takes advantage of desktop power,
offloading application processing from servers and making them more efficient and less likely to
bottleneck.
Thin client - much smaller load of work is on the client, mimics the traditional host-centered
approach.
Suggest pros and cons for fat client and thin client strategies.
**Answer will come soon
What is middleware?
Is a set of tools (standard API and protocols) that provide a uniform means and style of access to
system resources across all platforms. Middleware makes it easy to implement the same
application on a variety of server types and workstation types.
List some benefits and disadvantages of blocking and nonblocking primitives for message
passing.
Blocking - Pro: assures the receiver is ready and waiting for the message.
Con: takes longer than non-blocking.
44
Compiled by S.O.M.M. Kasinge
Non-blocking - Pro: automatically sends message to the receiver when the sender is ready to
send.
Con: the receiver may not be ready for the message being passed, and thus some
of the information may not be picked up by the receiver.
45