Unit 2 Processes Flashcards
What distinguishes the difference between a program and a process?
(Part 2) A program is static and an abstraction of the desired program behaviour. A process is the dynamic representation of a program, it represents the program’s execution.
What are the key requirements for operating systems?
(Part 2) There are three key requirements for operating systems:
- Keeping systems busy
- Keeping users productive (responsiveness)
- Sharing resources between users and processes
Why is compiled code typically not portable from one platform to another?
(Part 2) Compilation creates platform-dependent machine code, targeted at a particular processor and so it is not portable.
What is the difference between user mode and supervisor mode?
(Part 2) 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.
What is the purpose of the system bus?
(Part 2) The system bus allows the processing unit to communicate with devices through their respective device controllers.
What is the relationship between registers, main memory, disk storage and cache?
(Part 2) 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, butis smaller and can be accessed by the CPU much fastet 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.
What is a machine code instruction?
A machine code instruction is the fundamental instruction that a CPU works with and executes without interruption.
What are the three software interfaces that link a user program to a device controller?
(Part 2) The three interfaces are:
- The interface between the program and its runtime system (provided by system 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)
How does an operating system interface to a device, and what is the role of a device driver?
(Part 2) An operating system provides a high-level interface to hardware that hides the specific details of how each device is programmed. Within each 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.
What is the device controller and what is its purpose?
(Part 2) 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.
What is an interrupt? What actions must an operating system take when an interrupt occurs?
(Part 3) 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) befor resuming the original process.
What are the advantages and disadvantages of handling devices by a polliing scheme compared with an interrupt-driven approach? In what kinds of system does the application dictate the approach to be taken?
(Part 3) In a polling shceme 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.
What happens if a user program attempts to execute a privileged instructions (via a system call)?
(Part 3) 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 ode via another context switch.
Why is it useful to have a system of priorities associated with interrupts?
(Part 3) Prioritised interrupts enable the operating system to react more quickly to some events than others.
What are the advantages of using a buffer for communication?
(Part 3) A buffer can be used to smooth out differences in operating speeds of the sending and receiving processes of 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.