This content can't be printed from the browser. Use Export PDF with Pro for an offline copy.
IB Syllabus Requirements for Operating systems and control systems
A1.3.1
The role of an operating system
A1.3.2
Operating system functions
A1.3.3
Comparing scheduling approaches
A1.3.4
Polling and interrupt handling
A1.3.1
THE ROLE OF AN OPERATING SYSTEM
An operating system (OS) is system software that manages a computer’s hardware resources and provides services for applications. It makes the hardware usable so that each application doesn't have to control it directly.
Hardware abstraction hides hardware-specific details behind a simpler, consistent interface. To save a file, for example, an application requests a service rather than controlling the storage device’s electronic operations itself.
Consider a drawing application saving an image. It supplies the image data and a destination, then asks the OS to save it. The OS handles access to storage through the appropriate device support. Different storage devices can therefore be used without rewriting the drawing application’s hardware-control logic.
Rather than letting applications use limited resources without control, the OS coordinates access to them. It allocates CPU time and memory. It also organizes stored files and controls access to connected devices.
These controls give applications an orderly environment in which to run. Hardware abstraction works alongside resource management: applications receive convenient services while the OS controls how the underlying hardware is used.
Key terms: operating system, hardware abstraction, system resources, CPU, memory, storage, input/output.
A1.3.2
OPERATING SYSTEM FUNCTIONS
An operating system serves applications and users while essential work continues in the background. Throughout this work, it must preserve system integrity: the system’s data and operation remain consistent and protected from unauthorized or accidental interference.
The table compares the required functions. They work together: opening a shared document, for example, can involve networking, security, memory management and the file system.
| Function | What the operating system does |
|---|---|
| Memory management | Tracks memory use and allocates space to programs, reclaiming it when it is no longer needed. It also controls which memory a program may access. |
| File system | Organizes files and directories and records where data is stored. It supports operations such as creating, reading, changing and deleting files. |
| Device management | Coordinates input/output devices through device drivers and controls requests to use them. A device driver provides hardware-specific support. |
| Scheduling | Selects which ready process receives CPU time and when. A process is a program in execution. |
| Security | Checks user identities and enforces permissions for access to data, programs and devices. |
| Accounting | Records resource use, such as CPU time or storage consumption. This allows usage to be monitored or attributed to users and processes. |
| Graphical user interface (GUI) | Gives users visual controls, such as windows, icons and menus, to operate the system. |
| Virtualization | Supports virtual versions of computing resources so software can use an environment separated from the underlying physical resources. |
| Networking | Manages network connections and supports data exchange with other systems. |
Background operations continue without a direct user action for each step. They include handling device requests, recording resource usage and carrying out scheduled security checks.
The OS must coordinate this work with applications. To prevent background activity from corrupting files or interfering improperly with another program, it protects memory boundaries and checks permissions. It also coordinates changes to shared data.
Key terms: system integrity, background operations, memory management, file system, device management, scheduling, security, accounting, graphical user interface (GUI), virtualization, networking.
A1.3.3
COMPARING SCHEDULING APPROACHES
Scheduling means selecting which processes receive CPU time. Each approach strikes a different balance between responsiveness and waiting time, fairness and the overhead of switching between processes.
Even when a process is ready to run, it may have to wait for another process to release the CPU. To improve system performance, the scheduler decides which process gets access and for how long.
| Approach | How CPU time is allocated | Strengths | Limitations |
|---|---|---|---|
| First-come first-served | Ready processes run in arrival order. In the basic approach, each process keeps the CPU until it finishes its CPU work or needs to wait for input/output. | Simple to manage and requires little scheduling overhead. The arrival order is clear. | One long process can hold up many short processes, leading to poor responsiveness. |
| Round robin | Each ready process gets a limited time slice. If it hasn't finished when the slice ends, it goes to the back of the ready queue. | Every process gets regular opportunities to run, which suits interactive use. | Short time slices mean frequent switches and greater overhead. With long slices, it behaves more like first-come first-served. |
| Multilevel queue scheduling | Processes enter separate queues based on their category. Each queue can use its own scheduling rule; another rule controls how CPU time is shared between queues. | Different kinds of work can be treated differently. | Lower-ranked queues may face long waits if higher-ranked queues always get preference. |
| Priority scheduling | The scheduler chooses a ready process based on its assigned priority. | Important or urgent work can run before less important work. | Low-priority processes may be delayed repeatedly. Priorities must reflect the system’s needs. |
Suppose a long report-generation process becomes ready just before a short search process. With first-come first-served, the search waits behind the report. Round robin lets the search take a turn before the report finishes. Responsiveness improves, but switching adds overhead.
If the search has higher priority, priority scheduling could run it first. Fairness isn't guaranteed, though. Multilevel queue scheduling could instead put interactive work and background work in separate queues, then allocate CPU time between them.
No approach is best for every workload. Short response times matter to an interactive system; a system processing background jobs may put more emphasis on completing work with low overhead.
Key terms: scheduling, process, CPU time, first-come first-served, round robin, time slice, multilevel queue scheduling, priority scheduling.
A1.3.4
POLLING AND INTERRUPT HANDLING
Polling means repeatedly checking a device or status indicator to see whether an event needs attention. The CPU starts every check, even when there’s nothing to handle.
Interrupt handling means responding to a signal requesting the CPU’s attention by temporarily transferring execution to an interrupt handler. Once the event has been serviced, the CPU normally returns to the work it paused.
| Factor | Polling | Interrupt handling |
|---|---|---|
| Event frequency | Frequent checks can be worthwhile when events occur almost continuously. | Efficient for occasional events. Very frequent interrupts, though, can repeatedly disrupt other work. |
| CPU processing overheads | Checks that find nothing waste CPU time. Tight polling loops can use much of the CPU’s capacity. | Avoids repeated empty checks. Each interrupt still creates overhead because the CPU must save state, run a handler and restore state. |
| Power source | Repeated checks can keep the CPU active, making polling less attractive for a battery-powered device. Mains power makes this less of a concern, but the CPU costs remain. | Can let the CPU sleep between events, helping battery life. Frequent interrupts can reduce that benefit. |
| Event predictability | Scheduled checks suit events expected at known intervals. | Suits events whose arrival time is unpredictable. |
| Controlled latency | A known checking interval can give a predictable maximum detection delay, as long as checks run on time. Longer intervals increase the delay. | Often responds quickly, but response time can vary if other work delays interrupt handling. |
| Security concerns | Checks and device data must be validated; malicious activity can still create excessive work. | A flood of interrupts can consume CPU time and disrupt useful processing. Handlers must validate inputs and preserve protected state. |
Latency is the delay between an event occurring and the system responding. Neither method guarantees low latency: the rest of the system’s workload must be considered too.
For a keyboard used intermittently, interrupts usually avoid wasting CPU time checking for input that isn’t there. A busy network interface presents a different problem. Handling an interrupt for every arrival may create substantial overhead, so polling during heavy activity can be more efficient. These examples illustrate the trade-offs; other device and system contexts exist.
Polling is attractive when frequent or predictable events justify regular checks and a controlled checking interval matters. For infrequent, unpredictable events, interrupt handling is attractive, particularly when conserving battery power matters. Security and the cost of delayed responses must also inform the decision.
Key terms: polling, interrupt handling, interrupt handler, event frequency, CPU processing overheads, power source, event predictability, controlled latency, security concerns.
A1.3.5
MANAGING MULTITASKING AND RESOURCES
Multitasking means managing multiple tasks so that they make progress over the same period. With a single CPU core, the OS switches execution between tasks; it does not execute them all at the same instant.
The OS decides which task runs and which resources it may use. These decisions are linked. Giving a task CPU time won't help it progress if it is waiting for a resource.
To switch tasks, the OS saves the current task’s execution state, then restores the selected task’s state. This context switch allows each task to pick up where it stopped.
Scheduling must balance responsiveness and fairness against switching overhead. Switch too rarely, and interactive tasks can appear unresponsive. Switch too frequently, and more time goes into managing execution, leaving less for useful work. A task waiting for input/output can give way to a ready task, improving CPU use.
When tasks compete for a limited resource, Resource contention occurs. Two document-processing tasks, for example, may both need the same printer.
To keep resource use orderly, the OS controls access and may queue requests. It also allocates memory and CPU time between tasks. Without this coordination, one task could monopolize a resource or interfere with another task’s data.
Deadlock occurs when tasks cannot proceed because each is waiting for a resource held by another task in the waiting cycle.
More CPU time won't solve this problem: the required resources remain unavailable. The OS can reduce deadlock risk by enforcing a consistent order for resource requests. Once a deadlock occurs, recovery may require terminating a task and reclaiming its resources. Unfinished work can be lost as a result.
Contention can cause a temporary wait while another task finishes. Deadlock is different: the tasks in the cycle cannot progress without intervention.
Key terms: multitasking, resource allocation, task scheduling, context switch, resource contention, deadlock.
A1.3.6
CONTROL SYSTEM COMPONENTS
A control system uses inputs and a decision-making process to influence how a physical system behaves. Its components link measurements and instructions to physical actions.
Information supplied to the control system, such as a measurement or a desired setting, is an Input. The Process uses those inputs to decide what action to take. The resulting command or physical action is the Output.
Feedback returns information about the actual output or controlled condition to the controller. With this information, the system can adjust later actions according to what actually happened.
| Component | Role in the system |
|---|---|
| Controller | Receives inputs and executes the control algorithm, then issues commands to output devices. |
| Sensor | Detects or measures a physical condition, such as temperature or moisture. |
| Actuator | Responds to a control signal by producing a physical action, such as moving a valve or operating a switch. |
| Transducer | Converts one form of energy or signal into another. Sensors commonly turn physical conditions into electrical signals; actuators turn control signals into physical effects. |
| Control algorithm | Sets out the rules the controller follows to decide what action to take using the available inputs. |
The terms can overlap. A temperature sensor is an input transducer. An electrically operated valve is an actuator that converts an electrical command into movement.
An open-loop system controls its output without feedback about the resulting controlled condition. It follows instructions but doesn't check whether it has achieved the intended result.
A closed-loop system adjusts its actions using feedback about the controlled condition. To do this, the controller compares the measured condition with a desired value, often called the set point.
Open-loop control is simpler, but it cannot correct for an unexpected change in the controlled condition. Closed-loop control can compensate for changes, though it depends on suitable sensors and an appropriate control algorithm.
Key terms: input, process, output, feedback, open-loop, closed-loop, controller, sensors, actuators, transducers, control algorithm.
A1.3.7
CONTROL SYSTEMS IN PRACTICE
Control systems link sensing and decision-making to physical actions, allowing equipment to operate automatically. For a system to be useful, its inputs, control algorithm and actuators must suit the condition it controls.
A temperature sensor in a community centre’s heating system measures room temperature and sends the reading to a thermostat controller. The controller then compares it with the temperature the user wants.
If the room is too cold, the control algorithm tells an actuator to switch the heater on. Once the room reaches the desired temperature, it tells the heater to switch off. Readings continue to provide feedback, allowing the system to respond if the room cools again.
This is closed-loop control: the actual room temperature affects what the system does next. With feedback, it can respond to disturbances such as an opened window. But the controller acts on the measurement it receives. If the sensor is inaccurate or poorly positioned, the resulting heating decisions may be unsuitable.
In a school growing area, a soil-moisture sensor sends readings to an irrigation controller. After comparing the moisture reading with the desired level, the controller commands an actuator to open or close a water valve.
Watering changes the soil moisture. Later readings feed this change back to the controller, helping it avoid continuing to water soil that is already sufficiently moist. A sensor in an unusually wet patch, though, may give a reading that doesn't represent the whole growing area. Other parts may then receive too little water.
An open-loop irrigation system offers an alternative: it opens the valve at scheduled times for a fixed duration. No moisture measurement is needed, but the system cannot automatically account for rain or unusually dry conditions.
| Feature | Community centre heating | School irrigation |
|---|---|---|
| Measured input | Room temperature | Soil moisture |
| Controller decision | Compare temperature with the desired temperature | Compare moisture with the desired level |
| Actuator action | Switch the heater on or off | Open or close the water valve |
| Feedback | Updated temperature reading | Updated moisture reading |
| Reason for feedback | Respond to changes in room temperature | Respond to changes in soil moisture |
These are just two applications, not an exhaustive list. Other systems can use the same input–decision–action relationship, provided their sensors, actuators and control algorithm suit the particular problem.
Key terms: control system, controller, sensor, actuator, control algorithm, input, output, feedback, open-loop, closed-loop.