Unit 2 Flashcards
SAQ 1 - A
Distinguish between a program and a process.
A program is static and an abstraction of the desired program behaviour. A process is the dynamic representation of a program, that is, it represents the program’s execution.
SAQ 1 - B
What are the key requirements for operating systems?
There are three key requirements for operating systems:
1 Keeping systems busy.
2 Keeping users productive (responsiveness).
3 Sharing resources between users and processes.
SAQ 2 - A
Why is compiled code typically not portable from one platform to another?
Compilation creates platform-dependent machine code, targeted at a particular processor, therefore it is not portable.
SAQ 2 - B
What is the difference between user mode and supervisor mode?
Certain processor instructions, known as privileged instructions, cannot be executed when the processor is in user mode. User programs run in user mode and request supervisor mode instructions, where necessary, via library calls.
SAQ 3 - A
What is the purpose of the system bus?
The system bus allows the processing unit to communicate with devices through their respective device controllers.
SAQ 3 - B
What is the relationship between registers, main memory, disk storage, and cache?
Registers are storage locations inside the CPU which hold a machine instruction and
the data that it works on during a fetch–execute cycle.
A cache is similar to main memory, but is smaller and can be accessed by the CPU much faster than normal main memory. It is therefore used to hold data that is likely to be frequently accessed by the CPU.
Main memory consists of the storage locations for holding machine instructions and
data that the CPU will transfer into its registers as part of the fetch–execute cycle.
Disk storage is a device attached to a computer that holds files and programs which must be loaded into main memory before they can be worked on or executed. It is a form of persistent (non-volatile) storage.
SAQ 3 - C
What is a machine code instruction?
A machine code instruction is the fundamental instruction that a CPU works with and executes without interruption.
SAQ 4 - A
What are the three software interfaces that link a user program to a device controller?
- the interface between the program and its runtime system (provided by library
calls) ; - the interface between the runtime system and the operating system (provided by
system calls); - the interface between the operating system and the device controller (provided
by device calls).
SAQ 4 - B
How does an operating system interface to a device, and what is the role of a device driver?
An operating system provides a high-level interface to hardware that hides the specific details of how each device is programmed. Within the operating system, it is the device driver for a particular device that knows how to interface with the device controller and translates high-level requests into lower-level interactions with the device.
SAQ 4 - C
What is a device controller
and what is its purpose?
A device controller has its own simple processor, memory and registers, so that it can execute in parallel with the CPU and provide two-way communication with a hardware device. The operating system interfaces with the device controller via a device driver making device calls.
SAQ 5 - A
What is an interrupt? What actions must an operating system take when an interrupt occurs?
An interrupt is a mechanism by which a device or software signals to the processor that some event has occurred. If the interrupt is of high enough priority, the processor must perform a context switch. The processor must then execute a routine to deal with the interrupt (such as transfer data to a device) before resuming the original process.
SAQ 5 - B
What are the advantages and disadvantages of handling devices by a polling scheme compared with an interrupt-driven approach? In what kinds of system does the application dictate the approach to be taken?
In a polling scheme every device is guaranteed to be served within a specified time, but prioritisation is difficult. In an interrupt-driven system, urgent requests can be dealt with very quickly by assigning priorities to types of request, but non-urgent requests may have to wait for a long time while more urgent requests are dealt with.
Interrupt-driven systems are preferable in interactive systems and real-time systems, which require immediate responses to critical events.
SAQ 5 - C
What happens if a user program attempts to execute a privileged instruction (via a system call)?
A supervisor call interrupt is generated. A context switch takes place to put the processor into supervisor mode and execute the interrupt handler. At this point the interrupt handler may decide to execute the user code or not. Subsequently the processor returns to running in user mode via another context switch.
SAQ 5 - D
Why is it useful to have a system of priorities associated with interrupts?
Prioritised interrupts enable the operating system to react more quickly to some events than others.
SAQ 5 - E
What are the advantages of using a buffer for communication?
A buffer can be used to smooth out differences in operating speeds of the sending and receiving processes or devices, so that communication is more efficient – given a large enough buffer neither the sending nor the receiving process (or device) will need to wait after depositing data in the buffer before proceeding with other work.