Clastify logo
Subjects
Features
Review
HOT
Tutoring

A1.3: Operating systems and control systems

Master IB Computer Science A1.3: Operating systems and control systems with notes created by examiners and strictly aligned with the syllabus.

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.

Abstracting hardware complexity

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.

The layered figure shows how this works. Users interact with applications, which request services from the operating system. The OS manages the hardware: the CPU, memory, storage and input/output devices.

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.

Managing system resources

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.

Resource and service management

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.

FunctionWhat the operating system does
Memory managementTracks 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 systemOrganizes files and directories and records where data is stored. It supports operations such as creating, reading, changing and deleting files.
Device managementCoordinates input/output devices through device drivers and controls requests to use them. A device driver provides hardware-specific support.
SchedulingSelects which ready process receives CPU time and when. A process is a program in execution.
SecurityChecks user identities and enforces permissions for access to data, programs and devices.
AccountingRecords 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.
VirtualizationSupports virtual versions of computing resources so software can use an environment separated from the underlying physical resources.
NetworkingManages network connections and supports data exchange with other systems.

Background operations and integrity

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.

The figure links background operations to the controls that maintain system integrity: memory protection, permission checks and coordinated access. These controls apply as both applications and background operations use system resources.

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.

How the approaches differ

ApproachHow CPU time is allocatedStrengthsLimitations
First-come first-servedReady 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 robinEach 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 schedulingProcesses 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 schedulingThe 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.

Comparing their effects

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.

The figure contrasts the four selection rules using ready processes, a ready queue, a time slice, separate queues and assigned priorities.

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.

How events are detected

Polling follows a repeating sequence: check the device, handle any event present, then check again later. With interrupt handling, the CPU gets on with other work until an interrupt arrives. It then saves the necessary execution state, runs the interrupt handler and resumes the interrupted work. The figure contrasts the two paths.

Evaluating the choice

FactorPollingInterrupt handling
Event frequencyFrequent checks can be worthwhile when events occur almost continuously.Efficient for occasional events. Very frequent interrupts, though, can repeatedly disrupt other work.
CPU processing overheadsChecks 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 sourceRepeated 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 predictabilityScheduled checks suit events expected at known intervals.Suits events whose arrival time is unpredictable.
Controlled latencyA 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 concernsChecks 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.

Context determines the judgement

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

HL

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.

Task scheduling

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.

Resource contention

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

Deadlock occurs when tasks cannot proceed because each is waiting for a resource held by another task in the waiting cycle.

Suppose Task A holds Resource X and waits for Resource Y. Task B holds Resource Y and waits for Resource X. Neither releases what the other needs. Both remain blocked, creating the circular wait shown in the resource-allocation figure.

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

HL

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.

Input, process and output

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.

Components and their uses

ComponentRole in the system
ControllerReceives inputs and executes the control algorithm, then issues commands to output devices.
SensorDetects or measures a physical condition, such as temperature or moisture.
ActuatorResponds to a control signal by producing a physical action, such as moving a valve or operating a switch.
TransducerConverts one form of energy or signal into another. Sensors commonly turn physical conditions into electrical signals; actuators turn control signals into physical effects.
Control algorithmSets 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.

Open-loop control

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.

For example, a watering system can open a valve for a preset duration. The controller follows a timing algorithm without receiving soil-moisture feedback. In the open-loop figure, input passes through the controller and actuator to the output. There is no feedback path.

Closed-loop control

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.

A moisture-controlled watering system measures soil moisture, then compares it with the set point. Its control algorithm opens the valve when moisture is too low. Once the desired condition is reached, it closes the valve. The closed-loop figure adds a sensor and a feedback path from the controlled condition to the controller.

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

HL

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.

Heating a building

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.

Watering a growing area

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.

Comparing the applications

The figure shows the two closed-loop systems side by side. A heater controls room temperature in the heating system; a water valve controls soil moisture in the irrigation system. Both follow the same sequence: measurement, comparison, action and further measurement.
FeatureCommunity centre heatingSchool irrigation
Measured inputRoom temperatureSoil moisture
Controller decisionCompare temperature with the desired temperatureCompare moisture with the desired level
Actuator actionSwitch the heater on or offOpen or close the water valve
FeedbackUpdated temperature readingUpdated moisture reading
Reason for feedbackRespond to changes in room temperatureRespond 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.

Were those notes helpful?

A1.2 Data representation and computer logic

A1.4 Translation