Q: Define process
A: program in execution

Q: What is multiprogramming?
A: Multiple processes sharing a CPU (seen as a virtual CPU for each process).

Q: What is time-sharing?
A: Multiprogramming with simultaneous terminal access by several users.

Q: Where is the current system mode contained?
A: PSW (Program status word)

Q: What is the kernel?
A: Privileged part of the operating system.

Q: What are the two modes in most operating systems?
A: Kernel and User

Q: What happens when an interrupt occurs?
A: 1. Hardware saves the program counter, PSW, stack pointer etc.
A: 2. Replaces these with new values.
A: 3. Replacement PSW puts CPU into kernel mode.
A: 4. Replacement PC causes execution to resume at start of interrupt handler.
A: 5. Save the rest of the status of the current process.
A: 6. Service the interrupt.

Q: What is an 'Interrupt Vector'?
A: An area of memory that contains replacements for the PC, PSW and SP for use when an interrupt occurs.

Q: Describe the algorithms used within Multi-Level Feedback Queue for batch scheduling?
A: Top levels should be close to pure RR (for good response time), bottom queues should be close to pure FCFS (for good throughput). Both can be achieved if all levels are SRR with varying parameters.

Q: Where is the address of the interrupt vector?
A: Wired into the CPU.

Q: Describe the relation between an Interrupt Vector and devices?
A: The hardware interrupt signal specifies the source of the interrupt (what device generated it). The CPU uses this information to select the proper entry in the interrupt vector. There is ONE entry per device or class of devices.

Q: Where is the IPL contained?
A: In the PSW.

Q: What is a typical list of priorities [in order] for interrupts in an OS?
A: 1. Clock [Lost clock interrupts cannot be recovered.]
A: 2. Networks
A: 3. Tapes/Disks
A: 4. Terminals

Q: What is a pseudo-interrupt?
A: Pseudo-interrupts are interrupts generated from the CPU itself.

Q: What is an exception?
A: User programs generating pseudo-interrupts e.g. dividing by 0.

Q: Give two types of exceptions?
A: Faults or Traps

Q: What is a system call?
A: A request to execute privileged instructions and access privileged memory locations.

Q: Why are system calls important?
A: They preserve system integrity and security.

Q: How are pseudo interrupts and syscall instructions related?
A: Syscall causes pseudo-interrupt.

Q: Where is the 'syscall entry' located?
A: In the Interrupt Vector.

Q: What are the steps in System Call Invocation?
A: 1. Causes pseudo-interrupt.
A: 2. Syscall entry in the IV causes execution to resume in System Call Handler
A: 3. Invokes the appropriate kernel procedure from the Syscall Number
A: 4. Returns from Interrupt Instruction. [Execution resumes is user mode]

Q: Is there only one Blocked state or is there more?
A: More.
A: e.g. Waiting for terminal I/O, Waiting for Disk I/O etc.

Q: Where in the system is the process table stored?
A: In the kernel.

Q: What typical fields can be found in a process table?
A: Process ID
A: Process State
A: Pointers to memory areas [Code, Data, Stack]
A: Priority [Used by scheduler]
A: Registers [PC/SP/Status Register]
A: Interprocess Communication Information
A: CPU Time Used

Q: What determines how many user stacks are in user space?
A: There is one stack per process, therefore it is the number of processes.

Q: How many interrupt stacks are found in a system space?
A: One stack for the whole system, or one per interrupt priority.

Q: What is context switching?
A: If after an interrupt, the next process placed in running mode is not the one that was running before the interrupt. The old process was preempted.

Q: What are the four aims of scheduling?
A: 1. Fairness
A: 2. Throughput [Maximimise number of jobs processed / time]
A: 3. Response Time [Minimize waiting time for interactive users.]
A: 4. Turnaround time [Minimize waiting time for batch jobs.]

Q: What are the properties of FCFS and when is it suitable for scheduling in batch systems?
A: 1. Discriminates against short jobs until all long jobs before are finished.
A: 2. Poor turnaround time.
A: 3. Performs well if all jobs require the same time.

Q: What are the properties of SJF in batch scheduling, when does it fail?
A: 1. Good turnaround time.
A: 2. Discriminates against long jobs.
A: Starves long jobs if machine is heavily loaded.

Q: What is a quantum?
A: A time interval, or time slice used for batch scheduling systems, e.g. Round Robin.

Q: In Round Robin scheduling, Short Quantum results in:
A: 1. Good response time
A: 2. Poor throughput
A: Good for interactive systems.

Q: In Round Robin scheduling, Long Quantum results in:
A: 1. Poor response time
A: 2. Good throughput
A: Good for batch systems.

Q: How does Selfish Round Robin different from Round Robin?
A: SRR does not put new jobs into the ready queue until the demand for the CPU is acceptably low. Therefore, SRR can approximate either FCFS or RR.

Q: In what way does pure-priority scheduling systems differ from round robin algorithms? When is this property useful?
A: A running process is never preempted. This is useful in real- time systems.

Q: What batch-scheduling algorithm is usually used in time- sharing systems?
A: Priority level scheduling, with (possibly selfish) round robin in each level.

Q: Describe an appropriate priority system for general-purpose time-sharing. What can happen if demand for CPU gets too high?
A: 1. Processes awakened after terminal input
A: 2. Processes awakened after disk input/output.
A: 3. Processes preempted after a full quantum at priority 1 or 2
A: 4. Processes preempted after a full quantum at priority 3 or 4
A: If demand for CPU is high, starves some processes.

Q: What is a null process?
A: It is used to handle the case of no ready processes.

Q: Why is SJF a difficult algorithm to implement in practice?
A: It requires applications/users to supply time estimates or bounds for every job.

Q: With pure priority systems, can you recommend a technique for reducing overhead?
A: Introduce a variable containing the priority of the highest priority ready process to avoid excessive searching.

Q: What kind of 'tricks' could a process do to raise its priority in a batch job?
A: It could do an unnecessary disk I/O

Q: What is two-level scheduling?
A: 1. Deciding which processes should be in main memory. [Runs rarely]
A: 2. Deciding which of these should get the CPU. [Runs several times a second]

Q: What does the high-level scheduler do in two-level scheduling?
A: Decides which process should be in main memory.

Q: What does the low-level scheduler do in two-level scheduling?
A: Decides which of the processes should get the CPU.

Q: What is a dispatcher?
A: A part of low-level scheduling that runs the highest priority ready process after interrupts and system calls.

Q: What is a cooperative multitasking system?
A: An operating system without a scheduler. All processes running on the machine must test at frequent intervals whether any other job requires the CPU, or other programs must be able to get control at some interrupts. e.g. TSR.

Q: What is the primary problem with cooperative multitasking systems?
A: A problem with any process can lock up the system.
